</> CodeAgents

Cheat Sheet

Claude Code

Anthropic's agentic coding CLI

Learn More

Getting Started

claudeLaunch interactive REPL
claude "task"Run a one-shot task and exit
claude -cResume last conversation
claude --resume <id>Resume a specific session by ID
claude -p "task"Non-interactive, print output and exit
claude --helpShow all CLI flags

CLI 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 report

Memory & 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.md
ANTHROPIC_API_KEY=...Set API key via environment variable

Hooks

PreToolUseHook fires before any tool call
PostToolUseHook fires after any tool call
NotificationHook fires on agent notifications
StopHook fires when the agent stops
PreCompactHook fires before context compression
matcherFilter hooks by tool name pattern
hooks in settings.jsonConfigure hooks in Claude settings

MCP

claude mcp add <name> <cmd>Register a stdio MCP server
claude mcp add --transport sse <name> <url>Register an SSE MCP server
claude mcp listList registered MCP servers
claude mcp remove <name>Remove an MCP server
claude mcp get <name>Show MCP server details
--mcp-config <file>Load MCP config from a JSON file
/mcpCheck MCP server status in REPL

Scripting & CI

cat file.py | claude -p "refactor"Pipe file content to Claude
git diff | claude -p "write commit msg"Generate commit message from diff
claude -p "task" --output-format jsonJSON output for automation
claude -p "task" --max-turns 3Limit turns for CI pipelines
--dangerously-skip-permissionsSkip confirmations for unattended CI
ANTHROPIC_API_KEY=... claude -p "..."Inline API key for scripts

code-agents.oday-bakkour.com · Claude Code · Last verified: April 2026