2 min lesson
Keep agent rules in the repository
Explain why rules belong in git and where to place shared and area-specific instructions.
Step 1 of 4
Project RulesVersion-controlled instructions in the repo that every Cursor agent interaction inherits, so standards are encoded once. Press Enter for the full definition. give the agent reusable instructions about a codebase. Put test, style and architecture requirements in the repository so the team does not have to repeat them in every request.
Cursor Project RulesVersion-controlled instructions in the repo that every Cursor agent interaction inherits, so standards are encoded once. Press Enter for the full definition. live in .cursor/rules/ as .mdc files. Their frontmatter can scope them to file patterns. A plain AGENTS.md can sit at the repository root or inside a subdirectory.
Keeping these rules in git gives changes a review, history and rollback path. A teammate can see who changed an instruction and why.
Learn more
Full explanation
Payments rule example
# Payments service rules - All money is int cents; never float. - Every new endpoint requires a contract test + an idempotency key. - No new outbound network calls without an entry in ALLOWED_EGRESS.md. - Follow the repository pattern; controllers must not import the DB client. - Example to imitate: see charges/create_charge.py
Learn more
Optional practice
Check a monorepo rule setup
QA team puts every standard for a 40-service monorepo into one root AGENTS.md. What should it change?