Repo instructions for AI agents
Write repo instructions that help AI coding agents respect architecture, tests, security rules and local workflows.
Quick answer
Good repo instructions tell the agent how the project is structured, which files are sensitive, which commands prove a change and which behaviors are forbidden.
What to include
Include architecture boundaries, naming rules, auth and data access constraints, test commands, formatting commands, deployment risks and how to handle dirty worktrees.
What to avoid
Avoid vague quality rules that cannot be checked. Replace be careful with concrete constraints, file paths and commands.
FAQ
Should repo instructions mention security rules?
Yes. Agents need explicit boundaries for secrets, user-scoped data, auth, external inputs and destructive commands.
Write better 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". With a good CLAUDE.md , Claude outputs code that follows your rules without being told each time. What to put in it 1. Stack and versions Simple but important. Claude will use the right…
Read the guideClaude Code Agents: When to Use Them
Claude Code Agents (subagents) let you spawn isolated work threads from the main session. Full guide: what they are, when to use them, how to write a custom one, and the patterns that actually ship.
Claude Code is great when you're driving one thread of work. When you need to run three threads in parallel, or want a fresh pair of eyes on a decision, or need to scope out a large refactor without polluting your main session that's what Agents are for. This is what Claude Code Agents actually are, when to use them, and how to write your own. What Claude Code Agents actually are An Agent (sometimes called a subagent) is an isolated work thread you spawn from the main Claude Code session via the Agent tool. It has its own context fresh, with no visibility into your conversation. You hand it a self contained prompt; it does the work; it returns a single message at the end. Three things make this different from just asking Claude another question: 1. Isolated context. The agent doesn't see what you've been doing. It can't…
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. If you want a step by step walkthrough of launching one, see the subagent spawning guide. Subagents can have their own instructions, tool access, and permissions. They start with a separate context, but by default work from the main conversation’s current directory. That means “separate context” does not necessarily mean “separate files.” If you want a repeatable checklist in the…
Read the guide