Cheatsheets as AI Context
Why format matters for AI
Section titled “Why format matters for AI”When you paste a cheatsheet into Claude or include it via @, the AI reads it as plain text. A well-formatted cheatsheet gives the AI structured, unambiguous information. A poorly formatted one wastes context and produces worse output.
Use fenced code blocks for commands
Section titled “Use fenced code blocks for commands”AI tools treat fenced code blocks as literal, executable content. Inline code in prose gets mixed up with the surrounding text.
git stash # good: in a code block, clearly a commandAvoid: “you can use git stash to save your changes” — the command is buried in prose.
Use consistent comment style
Section titled “Use consistent comment style”Pick one comment style and use it everywhere. For shell commands, # inline is standard:
git commit -m "message" # commit staged changesgit push # push to remoteFor non-shell content (prompts, shortcuts), a # or → arrow works:
Ctrl + Z # undoCtrl + Y # redoKeep sections flat
Section titled “Keep sections flat”Deeply nested structure confuses AI context parsing. Two levels max:
## Section headingcommand # descriptioncommand # descriptionAvoid: ### Sub-sub-section — the AI loses track of which group a command belongs to.
Label each section clearly
Section titled “Label each section clearly”Section headings are how the AI knows which commands belong to which task. Make them task-oriented:
## Start a Session ✅ task-oriented## Commands ❌ too vagueInclude the “when to use” in the comment
Section titled “Include the “when to use” in the comment”The inline comment should say why, not just what:
git restore . # discard ALL unstaged changes — destructive, can't undoThis lets the AI reason about whether a command is appropriate for a given situation, not just what it does syntactically.
Keep it short
Section titled “Keep it short”The longer a cheatsheet, the more context it consumes. A 40-line cheatsheet included in a prompt uses roughly the same tokens as a paragraph of instructions — worth it. A 200-line cheatsheet starts competing with the actual task for context space.