Cheat Sheet
Claude Code
Anthropic's agentic coding CLI
Getting Started
claudeLaunch interactive REPLclaude "task"Run a one-shot task and exitclaude -cResume last conversationclaude --resume <id>Resume a specific session by IDclaude -p "task"Non-interactive, print output and exitclaude --helpShow all CLI flagsCLI Flags
--model claude-sonnet-4-6Specify the model to use--system-prompt "..."Override the system prompt--allowedTools <list>Whitelist specific tools--disallowedTools <list>Blacklist specific tools--max-turns <n>Limit agentic loop iterations--output-format jsonOutput JSON for scripting--verboseEnable debug logging--dangerously-skip-permissionsSkip all permission prompts (CI)Slash Commands
/helpList all slash commands/initCreate CLAUDE.md for this project/clearClear conversation context/compactCompress context to a summary/commitGenerate commit message from diff/reviewReview current file for issues/fixAuto-fix last error or warning/modelSwitch model mid-session/statusShow session status and usage/bugFile a bug reportMemory & Context
CLAUDE.mdProject-level instructions file~/.claude/CLAUDE.mdUser-level (global) instructions.claude/CLAUDE.mdSub-directory scoped instructions@path/to/fileReference a file in your prompt.claudeignoreExclude files from context (gitignore syntax)# headingMark a section as important in CLAUDE.mdANTHROPIC_API_KEY=...Set API key via environment variableHooks
PreToolUseHook fires before any tool callPostToolUseHook fires after any tool callNotificationHook fires on agent notificationsStopHook fires when the agent stopsPreCompactHook fires before context compressionmatcherFilter hooks by tool name patternhooks in settings.jsonConfigure hooks in Claude settingsMCP
claude mcp add <name> <cmd>Register a stdio MCP serverclaude mcp add --transport sse <name> <url>Register an SSE MCP serverclaude mcp listList registered MCP serversclaude mcp remove <name>Remove an MCP serverclaude mcp get <name>Show MCP server details--mcp-config <file>Load MCP config from a JSON file/mcpCheck MCP server status in REPLScripting & CI
cat file.py | claude -p "refactor"Pipe file content to Claudegit diff | claude -p "write commit msg"Generate commit message from diffclaude -p "task" --output-format jsonJSON output for automationclaude -p "task" --max-turns 3Limit turns for CI pipelines--dangerously-skip-permissionsSkip confirmations for unattended CIANTHROPIC_API_KEY=... claude -p "..."Inline API key for scriptscode-agents.oday-bakkour.com · Claude Code · Last verified: April 2026