💬 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
2
3
4
5
6
7
8
9
10
11
12
13
14
# 1. Open an interactive session to explore the codebase
claude

# 2. Start with a specific question right away
claude "Analyze this project's auth module"

# 3. Continue the last conversation
claude -c

# 4. Resume a named session (created earlier with -n)
claude -r "auth-refactor" "Finish implementing the auth module"

# 5. Ask a quick question and exit
claude -p "What does this function do?"

Good habit: Name important sessions with -n so 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
2
3
4
5
6
7
8
9
10
11
# Simple query, fast response
claude -p --effort low "Is this variable name clear?"

# Everyday development (default level)
claude --effort medium

# Complex refactoring, deeper reasoning
claude --effort high "Refactor the auth module while preserving backward compatibility"

# Maximum reasoning with Opus
claude --model opus --effort max "Evaluate strategies for splitting this microservice"
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
2
3
4
5
6
7
8
9
10
11
# Pre-approve read-only operations to eliminate most daily prompts
claude --allowedTools "Bash(git log *)" "Bash(git diff *)" "Read" "Glob" "Grep"

# Read-only review mode—block file edits and publishing
claude --disallowedTools "Edit" "Write" "Bash(npm publish *)"

# Plan mode—inspect and propose a plan without making changes
claude --permission-mode plan

# Fully autonomous (isolated Docker/CI sandboxes ONLY!)
claude --permission-mode bypassPermissions -p "Batch rename these files"

Security warning: bypassPermissions skips 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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Pipe input + JSON output for jq parsing
cat error.log | claude -p "Analyze the root cause" --output-format json | jq '.result'

# Cap turns and spend to prevent runaway runs
claude -p --max-turns 3 --max-budget-usd 1.00 "Review this code"

# Structured output constrained by a JSON Schema
claude -p --json-schema '{
"type": "object",
"properties": {
"score": {"type": "number"},
"issues": {"type": "array", "items": {"type": "string"}}
},
"required": ["score", "issues"]
}' "Score the code quality"

# Bare mode—skip hooks, plugins, and MCP for faster startup
claude --bare -p "Generate a commit message"
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
2
3
4
5
6
7
8
# Copy-ready CI command template
claude -p \
--output-format json \
--max-turns 5 \
--max-budget-usd 5.00 \
--allowedTools "Bash(git log *)" "Bash(git diff *)" "Read" \
--fallback-model sonnet \
"Review code quality and output a JSON report"

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
2
3
4
5
6
7
8
# Verify authentication status (exit code 0 = signed in)
claude auth status

# Health check
claude doctor

# Inject CI-specific MCP config (strict mode loads only the specified file)
claude -p --mcp-config ./ci-mcp.json --strict-mcp-config "query"

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
2
3
4
5
6
7
8
9
10
11
# Spin up an isolated worktree for a new feature
claude --worktree feature-auth

# Open another worktree for an urgent bugfix
claude --worktree hotfix-123

# Omit the name to auto-generate one
claude --worktree

# Add an extra directory for context (e.g., shared libraries)
claude --worktree feature-auth --add-dir ../shared-libs

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
2
3
4
5
6
7
8
9
10
11
12
13
14
# Append coding conventions (recommended—preserves built-in behavior)
claude --append-system-prompt "Always use TypeScript strict mode"

# Load team conventions from a file
claude --append-system-prompt-file ./team-conventions.md

# Specify an MCP configuration file
claude --mcp-config ./mcp-servers.json

# Strict mode: load only the specified MCP config and ignore others
claude --mcp-config ./mcp.json --strict-mcp-config "query"

# Load a local plugin for testing
claude --plugin-dir ./my-plugin

Append vs. Replace: Prefer --append-system-prompt—it keeps all of Claude Code’s built-in capabilities intact. --system-prompt replaces 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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Inspect the full thinking process
claude --verbose

# Debug mode to inspect low-level API traffic (filterable by category)
claude --debug -p "test"
claude --debug "api,hooks" -p "test"

# Write debug logs to a file
claude --debug-file ./claude-debug.log -p "test"

# Health check (auto-updater, MCP servers, etc.)
claude doctor

# Check authentication status
claude auth status
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.

Series Navigation