Codex repo instructions examples
Examples of repo instructions that help Codex respect architecture, tests, security rules and product constraints.

Put it into practice
What you will produce
A repository instruction sample that names architecture, validation commands, protected actions and how to report incomplete checks.
- 01
Choose a real repository task
Pick a common discovery need such as locating a route and its validation command.
Expected result: The example serves an actual repository task.
- 02
Draft durable rules only
Document local architecture pointers, commands, protected actions, and reporting expectations; omit temporary task details.
Expected result: The sample gives useful context without copying the handbook.
- 03
Place instructions at the right scope
Put shared guidance at the root and narrower rules near their package; inspect nested instruction files.
Expected result: The working directory resolves to the intended instruction set.
- 04
Test with a fresh session
Ask a new session to find the route and command, then verify its cited files.
Expected result: The answer matches repository evidence.
Example structure to adapt
# AGENTS.md
## Project map
- Explain where routes, domain logic and tests live.
## Working rules
- Read the local framework docs before using version-sensitive APIs.
- Keep changes within the user-approved scope.
## Verification
- Run: <project check command>
- Report skipped or failing checks explicitly.Adapt the fields to your SDK or repository, then verify the format against the linked official documentation. This is a starting structure, not a claim that it was tested in your environment.
Acceptance checks
- The example serves an actual repository task.
- The working directory resolves to the intended instruction set.
- The answer matches repository evidence.
Limits and trade-offs
AGENTS.md behavior depends on its location and the client. Confirm which instruction files are loaded for the current working directory.
Official sources
Write repo instructions
Related guides
CLAUDE.md: A Guide for Every Developer
One markdown file that makes AI coding assistants actually understand your codebase. Here's what to put in it.
There's a reason Claude Code writes great code in some projects and generic boilerplate in others. It's not the model. It's CLAUDE.md . It is one part of my Claude Code workflow: project conventions reduce guesswork, but they do not guarantee a speedup or remove the need to review the change. What it is CLAUDE.md is a plain markdown file that Claude Code reads at the start of every session. Think of it as the onboarding doc you'd give a senior contractor on day one: stack, conventions, rules, context. Without it, Claude infers patterns from what it sees in the codebase. Sometimes it infers correctly. Often it doesn't especially for implicit conventions your team just "knows". A CLAUDE.md makes your rules available without repeating them, but does not guarantee compliance: review the diff and run the checks. What to put in it 1. Stack and versions Simple but important. These…
Read the guideClaude Code Subagents: Parallel Agents
Learn when Claude Code subagents help, how to split parallel work, and how to configure a focused custom subagent without creating conflicts.
Subagents are useful when a task can be split cleanly: one agent searches the authentication code, another traces the database path, and the main conversation compares what they found. They add little to "read this file" or to work where every step depends on the same context. Short version: delegate independent research or a separate review when the results are worth the extra context and usage. Give each agent a narrow scope, the files or area to inspect, and a specific report format. Keep dependent work in the main conversation. Claude Code agents vs subagents Claude Code's documentation calls delegated workers subagents and uses Agent for the tool that starts them. When people search for Claude Code agents in this context, they usually mean subagents: workers that handle a delegated task in their own context and return a result to the main conversation. Claude Code's subagent documentation uses this terminology.…
Read the guideClaude Code MCP: Connect Servers & Tools
Claude Code MCP (Model Context Protocol) lets you plug external tools and data into Claude. Full guide: how to add an MCP server, list available ones, and the patterns that work.
A Claude Code conversation can only do so much with the tools shipped in the box. The moment you want Claude to touch Notion, Stripe, your AWS account, a specific database you need MCP. MCP (Model Context Protocol) is the standard that connects Claude to external tools. Here's what it is, how to add servers, and the patterns that don't waste your time. What MCP actually is MCP is an open protocol. A small server process (the "MCP server") exposes a set of tools. Claude Code (the "MCP client") talks to it over stdio or HTTP. When Claude needs to call one of those tools, it sends a JSON RPC request; the server runs the function and returns the result. Three pieces: MCP server the process that exposes tools. Usually npx installable. Examples: filesystem, GitHub, Notion, Stripe, Postgres. MCP client Claude Code itself. It manages connections, surfaces tools to the…
Read the guide