IA Dev Learn

Rules files

Agents start every session with no memory of your project. A rules file is the note they read first.

Where each tool looks

ToolPersonal (all projects)Project (shared with the team)Notes
Claude Code~/.claude/CLAUDE.mdCLAUDE.md, .claude/CLAUDE.mdCLAUDE.local.md for personal notes in one project. @path lines import other files.
Codex~/.codex/AGENTS.mdAGENTS.mdAn AGENTS.md in a subfolder adds rules for that folder.
Gemini CLI~/.gemini/GEMINI.mdGEMINI.mdSupports @path imports too. For Code Assist and Google Cloud users.
Antigravity (app and agy)~/.gemini/GEMINI.md, ~/.gemini/AGENTS.md, ~/.gemini/config/rules/AGENTS.md, GEMINI.md, .agents/rules/*.mdOne file per topic in rules/.
Cursor.cursor/rules/*.mdc, AGENTS.md.mdc rules can target files with globs.

One rulebook for every agent

Write the shared rules once in AGENTS.md. Then point Claude Code and Gemini CLI at it with a one-line file each:

bash
printf '@AGENTS.md\n' > CLAUDE.md
printf '@AGENTS.md\n' > GEMINI.md

You can still add tool-specific rules under the import line.

What to write

Write what an agent can't guess and would otherwise get wrong:

markdown
# Tiny Shop
## Commands
- Install: `pnpm install`
- Test: `pnpm test` (run it after every change)
## Conventions
- Prices are integers in cents.
- Never edit `src/generated/`: it's rebuilt by `pnpm codegen`.

Exact commands in backticks, conventions that differ from the defaults, folders not to touch. Short sections with headings.

What to leave out

  • Wishes any agent already follows, like "write clean code" or "follow best practices".
  • Contradictions. If one line says npm and another says pnpm, the agent picks one, maybe the wrong one.
  • Long procedures. Every line is loaded into every conversation, so move step-by-step how-tos into skills.
  • Shouting. When five rules say IMPORTANT, none of them stands out.

/init in Claude Code, Codex or Gemini CLI writes a first draft from your project. Read it and fix it: you know things it can't see.