Skip to main content

AI Coding Cheatsheet

Quick reference for repository instruction files, effective prompt patterns, and a safety checklist for AI coding agents.

Rules / Instructions File Map​

ToolRepository-Level FilesUser-Level (Global)
Claude CodeCLAUDE.md, .claude/rules/~/.claude/CLAUDE.md
AntigravityAGENTS.md, .agent/rules/~/.gemini/GEMINI.md
GitHub Copilot.github/copilot-instructions.md, .github/instructions/*.instructions.mdIDE / 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.c and tests/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 run npm run build to 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 diff produced 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​