Loading...
Loading...
Claude Code CLI commands, flags, headless mode, and automation patterns
npx skill4agent add parcadei/continuous-claude-v3 cli-reference| Command | Description | Example |
|---|---|---|
| Start interactive REPL | |
| REPL with initial prompt | |
| Headless mode (SDK) | |
| Process piped content | |
| Continue most recent | |
| Continue via SDK | |
| Resume session | |
| Update version | |
| Configure MCP servers | See MCP docs |
| Flag | Description | Example |
|---|---|---|
| Load most recent conversation | |
| Resume session by ID/name | |
| Use specific UUID | |
| Create new session on resume | |
| Flag | Description | Example |
|---|---|---|
| Non-interactive, exit after | |
| | |
| Limit agentic turns | |
| Full turn-by-turn output | |
| Skip permission prompts | |
| Include streaming events | |
| Input format (text/stream-json) | |
| Flag | Description | Example |
|---|---|---|
| Auto-approve these tools | |
| Block these tools | |
| Only allow these tools | |
claude --agents '{
"code-reviewer": {
"description": "Expert code reviewer. Use proactively after code changes.",
"prompt": "You are a senior code reviewer. Focus on code quality and security.",
"tools": ["Read", "Grep", "Glob", "Bash"],
"model": "sonnet"
},
"debugger": {
"description": "Debugging specialist for errors and test failures.",
"prompt": "You are an expert debugger. Analyze errors and provide fixes."
}
}'| Field | Required | Description |
|---|---|---|
| Yes | When to invoke this agent |
| Yes | System prompt for behavior |
| No | Allowed tools (inherits all if omitted) |
| No | |
| Flag | Behavior | Modes |
|---|---|---|
| Replace entire prompt | Interactive + Print |
| Replace from file | Print only |
| Append to default (recommended) | Interactive + Print |
--append-system-prompt| Flag | Description | Example |
|---|---|---|
| Set model for session | |
| Fallback if default overloaded | |
sonnetopushaiku| Flag | Description | Example |
|---|---|---|
| Load MCP servers from JSON | |
| Only use these MCP servers | |
| Flag | Description | Example |
|---|---|---|
| Add working directories | |
| Specify agent for session | |
| Start in permission mode | |
| MCP tool for permissions | |
| Load plugins from directory | |
| Load settings from file/JSON | |
| Which settings to load | |
| Beta API headers | |
| Enable debug mode | |
| Auto-connect to IDE | |
| Enable Chrome integration | |
| Disable Chrome for session | |
| Verbose LSP debugging | |
| Output version | |
claude -p "query" --output-format json
# {"result": "...", "session_id": "...", "usage": {...}}claude -p "query" --output-format stream-json
# Newline-delimited JSON eventsclaude -p "Extract data" \
--output-format json \
--json-schema '{"type":"object","properties":{...}}'claude -p "$TASK_PROMPT" \
--session-id "$UUID" \
--dangerously-skip-permissions \
--max-turns 100 \
--output-format stream-json \
--agents '{...}' \
--append-system-prompt "Context: ..."--session-id--dangerously-skip-permissions--max-turnsclaude -p "Run tests and fix failures" \
--dangerously-skip-permissions \
--max-turns 50 \
--output-format json | jq '.result'cat error.log | claude -p "Find root cause"
gh pr diff | claude -p "Review for security"id=$(claude -p "Start task" --output-format json | jq -r '.session_id')
claude -p "Continue" --resume "$id"claude -p "Long task" \
--output-format stream-json \
--include-partial-messages | while read -r line; do
echo "$line" | jq '.type'
done| Shortcut | Action |
|---|---|
| Cancel current |
| Exit |
| Reverse search history |
| Rewind changes |
| Toggle permission mode |
| Prefix | Action |
|---|---|
| Slash command |
| Bash mode |
| Add to memory |
| File mention |