Claude Code cheatsheet
Claude Code: Sessions and flags
9 common Claude Code tasks.
Run one prompt and exit
Print mode runs the prompt, prints the answer and exits, which suits scripts.
claude -p "summarize this repository"
Pipe content in
Send a file or command output to Claude as context.
cat error.log | claude -p "explain this error"
Start in plan mode
Plan mode lets Claude read and plan without making changes.
claude --permission-mode plan
Give access to another folder
Let Claude work with files outside the current directory.
claude --add-dir ../shared-lib
Get machine-readable output
Return the result as JSON so scripts can parse it.
claude -p "list the TODOs" --output-format json
Add to the system prompt
Add instructions for this run while keeping Claude Code's defaults.
claude --append-system-prompt "Always write tests for new code"