Rules files
Agents start every session with no memory of your project. A rules file is the note they read first.
More practice:One rulebook for every agentWriting rules that workRules for one folderCursor's project rules
Where each tool looks
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.mdprintf '@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.