Claude Code CLI Cheatsheet
💬 hippo: A scenario-driven CLI command cheatsheet. Jump straight to the workflow you need and copy the command. For a full breakdown of how every flag works under the hood, see Official Docs Breakdown: CLI Reference. Based on Claude Code 2.1.91.
1. Daily Development: Five Ways to Launch
Pick the launch pattern that fits what you’re doing in the terminal:
1 | # 1. Open an interactive session to explore the codebase |
Good habit: Name important sessions with
-nso you can easily resume them later via-r—for example,claude -n "auth-refactor".
2. Controlling Thinking Depth and Model Selection
Match reasoning budget to task complexity: save tokens with lower effort on quick lookups, and dial up depth and model strength for architectural decisions.
1 | # Simple query, fast response |
| Effort Level | Best For | Notes |
|---|---|---|
low |
Quick Q&A, naming suggestions | Fast, saves tokens |
medium |
Everyday development | Default |
high |
Refactoring, architecture design | Deep reasoning |
max |
Critical technical decisions | Opus only |
3. Permission Controls: Fewer Approval Prompts
Tired of constant permission dialogs during local development? Pick the policy that fits your session.
1 | # Pre-approve read-only operations to eliminate most daily prompts |
Security warning:
bypassPermissionsskips every confirmation prompt. Restrict it to sandboxed environments only.
4. Script Integration: Embedding in Toolchains
When calling Claude from shell scripts, Makefiles, or npm scripts, -p is the core flag for non-interactive output.
1 | # Pipe input + JSON output for jq parsing |
| Output Format | Use Case | Notes |
|---|---|---|
text |
Terminal display | Default; human-readable |
json |
Programmatic parsing | Complete result; easy to extract with jq |
stream-json |
Real-time streaming | Processes chunks as they arrive; suited for long outputs |
5. CI/CD: Production-Ready Command Template
Running Claude in GitHub Actions or GitLab CI requires three things: zero interactivity, hard guardrails, and safe retries.
1 | # Copy-ready CI command template |
Line-by-line breakdown:
-p: Non-interactive mode; exits when finished--output-format json: Structured output for easy parsing in CI--max-turns 5: Caps tool-use turns at 5 to prevent infinite loops--max-budget-usd 5.00: Caps spend at $5 to prevent runaway costs--allowedTools: Pre-approves read-only tools so execution never blocks on prompts--fallback-model sonnet: Automatically falls back to Sonnet if Opus is overloaded
Pre-flight checks:
1 | # Verify authentication status (exit code 0 = signed in) |
6. Parallel Development: Worktrees
When juggling multiple tasks—such as feature work alongside an urgent hotfix—isolate each session in its own Git worktree.
1 | # Spin up an isolated worktree for a new feature |
Note: Each worktree is a separate working directory, so project dependencies must be installed there separately.
7. Customizing Behavior: System Prompts and MCP
Tailor Claude to your team’s conventions or wire up external tools and plugins.
1 | # Append coding conventions (recommended—preserves built-in behavior) |
Append vs. Replace: Prefer
--append-system-prompt—it keeps all of Claude Code’s built-in capabilities intact.--system-promptreplaces the entire default system prompt; use it with caution.
8. Debugging and Troubleshooting
When a command misbehaves, produces unexpected output, or needs lower-level inspection:
1 | # Inspect the full thinking process |
| Command / Flag | What It Shows |
|---|---|
--verbose |
Full thinking trace and tool-call execution |
--debug |
Low-level API requests/responses and hook triggers |
claude doctor |
Auto-updater and MCP server health status |
claude auth status |
Login status and authentication method |
Summary
All eight workflows at a glance:
| Workflow | Core Commands / Flags |
|---|---|
| Daily development | claude / claude -c / claude -p |
| Thinking depth | --effort / --model |
| Permission controls | --allowedTools / --permission-mode |
| Script integration | -p + --output-format json |
| CI/CD | CI template + --fallback-model |
| Parallel development | --worktree |
| Customizing behavior | --append-system-prompt / --mcp-config |
| Debugging & troubleshooting | --verbose / --debug / claude doctor |
For detailed flag mechanics and the complete option list, see Official Docs Breakdown: CLI Reference.
Based on Claude Code 2.1.91.




