AI only works well
if it understands your project.
AI is not a mind reader. Without instructions it will happily:
These files are where you set the rules once per repo — instead of writing huge prompts every time.
AGENTS.md
High-level onboarding for any AI agent.
Most tools look for this first.
CLAUDE.md
Project rules for Claude Code.
CLI and IDE integrations.
.cursorrules
Detailed rules for Cursor.
Used in chat, inline edits, and agents.
.github/copilot-instructions.md
Focused guidance for GitHub Copilot.
Chat and PR review.
When these files say the same thing — all tools behave consistently.
AGENTS.md — The Entry PointKeep it short — overview only, not a full spec.
Use it to link out to more detailed rule files.
What to include:
.cursorrules, copilot-instructions.mdUpdate it in the same PR whenever you change architecture, standards, or workflows.
# Project: <Name>
## Purpose
Short description of the system.
## Tech Stack
- Languages
- Frameworks, libraries
- Testing tools
## Expectations for AI Agents
- Follow architecture & patterns.
- Prefer small, reviewable changes.
- Never add dependencies without confirmation.
- Treat security rules as hard constraints.
## Pointers
- Cursor rules: see .cursorrules
- Copilot: see .github/copilot-instructions.md
.cursorrules — Rules for CursorUsed in: chat, inline edits, multi-file agents
What to include:
Keep it concise and specific — long stories waste context and are less likely to be followed.
# Example .cursorrules
- FastAPI 0.109+ / SQLAlchemy 2.0 / Pydantic v2
- Clean Architecture: Domain → Application → Infrastructure
- Repository Pattern (NO Active Record)
- All inputs validated via Pydantic
- pytest with 80%+ coverage
- Black formatter, MyPy strict
- Never log PII or secrets
- Parameterized queries only — no string concatenation
copilot-instructions.md — Rules for CopilotPlaced in .github/copilot-instructions.md
*.instructions.md files# Copilot instructions
- Prefer pytest for tests; follow the style in tests/.
- Use type hints consistently in Python code.
- Follow the existing service/repository layering in src/.
- Do not introduce new frameworks without an explicit comment explaining why.
- Treat security and privacy rules as hard constraints, not suggestions.
Always include:
Best practices across all files:
These files are living documents.
Update them in the same PR as any architecture or standards change.
AGENTS.md — high-level entry point for any AI agentCLAUDE.md — rules for Claude Code.cursorrules — detailed rules for Cursor.github/copilot-instructions.md — rules for Copilot