Repo context
M07 · 9 min

AGENTS.md teaches the agent

Put conventions where Grok Build looks: project instruction files beat repeating yourself.

Grok Build works with existing tools: AGENTS.md, plugins, hooks, skills, MCP servers. When you start in a repo, it absorbs how you work. That means a short AGENTS.md is leverage for every future session.

What to put in AGENTS.md

  • Stack and commands: dev, test, typecheck, build
  • Folder map: where routes, components, server code live
  • Non-negotiables: no drive-by refactors, no new deps without ask
  • UI rules if relevant: tokens, no emoji chrome, mobile-first
  • Security: never commit secrets; validate at boundaries only

Minimal AGENTS.md starter

# Agent instructions

## Commands
- dev: npm run dev
- test: npm test
- typecheck: npm run typecheck
- build: npm run build

## Structure
- src/routes — pages
- src/components — UI
- src/lib — shared logic

## Rules
- Prefer small diffs; no unrelated refactors
- Match existing patterns before inventing new ones
- After changes: run typecheck + relevant tests
- Ask before adding dependencies

Exercise

Draft AGENTS.md

Write a 15–25 line AGENTS.md for a project you care about.

  • Commands listed
  • Structure listed
  • ≥3 hard rules
Next