AI Coding Cheatsheet
Quick reference for repository instruction files, effective prompt patterns, and a safety checklist for AI coding agents.
Rules / Instructions File Map
| Tool | Repository-Level Files | User-Level (Global) |
|---|---|---|
| Claude Code | CLAUDE.md, .claude/rules/ | ~/.claude/CLAUDE.md |
| Antigravity | AGENTS.md, .agent/rules/ | ~/.gemini/GEMINI.md |
| GitHub Copilot | .github/copilot-instructions.md, .github/instructions/*.instructions.md | IDE / GitHub settings |
What to Put in Rules Files
- Language conventions, code style, and naming rules.
- Exact build, lint, and test commands (for example,
npm run build,cargo test,ctest). - Commit message format (Conventional Commits) and key folder structure.
- Hard constraints (do not edit generated files, never commit secrets, do not skip tests).
Effective Prompt Patterns
- Plan before editing: "Read
src/foo.candtests/test_foo.c, then propose a 3-step plan to fix bug X before editing files." - Debug with evidence: Paste the exact error log, command run, and environment (OS, version) instead of saying "it failed."
- Bound the scope: "Only edit files under
docs/tools/, keep the current format, and runnpm run buildto verify." - Define done: Always state a clear verification check (build passes, tests pass, zero broken links).
Safety Checklist Before Commit / Merge
- Never paste API keys, tokens, passwords, or private customer data into prompts or rules files.
- Review the full
git diffproduced by the agent; do not merge code you do not understand. - Run real build, lint, and unit test commands instead of trusting verbal confirmation alone.
- Split changes into small commits that are easy to revert.
References
- AGENTS.md Specification — Open convention for repository-level AI agent instructions.
- Anthropic — Prompt Engineering Overview
- Model Context Protocol (MCP)