Agent Engineering / Instructions & Prompting
Keep one source of truth for agent instruction files
- MUST keep shared project instructions in one file,
AGENTS.md, and nowhere else. - MUST make each tool-specific file either import
AGENTS.md, link to it, or be generated from it, and contain only what is specific to that tool. - MUST NOT copy shared instructions into tool-specific files. Copies drift, and agents then follow different rules depending on the tool.
- SHOULD, for Claude Code, use a
CLAUDE.mdthat starts with@AGENTS.md. Prefer the import over a symlink when anyone uses Windows (Git may check a symlink out as a plain text file) or when Claude must edit the file (Claude Code will not write through a symlink). - SHOULD check in CI that tool-specific files still reference
AGENTS.mdand do not repeat its sections. - SHOULD confirm in each tool that the shared file actually loaded (for Claude Code,
/contextlists memory files) after changing the arrangement.
When to apply
Section titled “When to apply”Any repository used with more than one coding agent, or likely to be.
Procedure
Section titled “Procedure”- Merge existing instruction files into
AGENTS.md(BP-0015); resolve contradictions while merging. - Replace each tool file with an import or pointer plus its tool-specific lines.
- Add a CI check (a few lines of shell or a Bun script) that fails if a tool file stops referencing
AGENTS.md. - Start a session in each tool and confirm the shared instructions loaded.
Examples
Section titled “Examples”| Tool | File | Contents |
|---|---|---|
| Shared | AGENTS.md |
All project instructions |
| Claude Code | CLAUDE.md |
@AGENTS.md then Claude-only lines (BP-0016) |
Other tools that read AGENTS.md natively |
— | Nothing extra needed |
| Tools with their own file only | their file | A pointer to AGENTS.md, or a copy generated from it in CI — never hand-edited |
Anti-patterns
Section titled “Anti-patterns”CLAUDE.md,GEMINI.mdand.cursorruleseach holding a slightly different copy of the build commands.- A symlinked
CLAUDE.mdin a repo with Windows contributors, which arrives as a one-line text file. - Tool-specific files that silently stopped loading the shared file after a rename.
Checklist
Section titled “Checklist”- Shared instructions only in
AGENTS.md - Tool files import or point to it, plus tool-only lines
- CI check for the reference
- Load confirmed in each tool