/claude-code-cli:claude-code-clifrom claude-code-cli
Build and run AI agents using Claude Code CLI. Use when developing autonomous agents, multi-agent systems, CI/CD automation, or scripting Claude for programmatic tasks. Covers authentication, headless mode (-p), JSON output parsing, tool restrictions, subagents, and orchestration patterns.
Ships in claude-code-cli. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Build autonomous agents using Claude Code CLI. Language-agnostic patterns for agent orchestration and programmatic integration.
| Task | Command |
|---|---|
| Basic agent | claude -p "prompt" |
| JSON output | claude -p --output-format json "prompt" |
| Streaming | claude -p --output-format stream-json "prompt" |
| Autonomous | claude -p --dangerously-skip-permissions "prompt" |
| Budget limit | claude -p --max-budget-usd 5 "prompt" |
| Restrict tools | claude -p --tools "Read,Edit" "prompt" |
| Structured output | claude -p --output-format json --json-schema '{...}' "prompt" |
export ANTHROPIC_API_KEY="sk-ant-..."
claude setup-token # Interactive setup
export CLAUDE_CODE_OAUTH_TOKEN="your-token"
-p)# Basic prompt
claude -p "Implement a REST API"
# Piped input
echo "Fix the bug" | claude -p
# Full autonomy (sandboxed environments only)
claude -p --dangerously-skip-permissions "Build the feature"
| Format | Flag | Use Case |
|---|---|---|
text | default | Simple scripts |
json | --output-format json | Programmatic parsing |
stream-json | --output-format stream-json | Real-time UI |
For detailed parsing examples: See references/response-parsing.md
echo "What is 2+2?" | claude -p --output-format json \
--json-schema '{"type":"object","properties":{"answer":{"type":"number"}},"required":["answer"]}'
Result: {"type": "result", "structured_output": {"answer": 4}, ...}
# Read-only agent
claude -p --tools "Read,Glob,Grep" "Analyze code"
# Specific bash commands only
claude -p --allowed-tools "Bash(npm:*) Bash(git:*)" "Build project"
# Deny dangerous operations
claude -p --disallowed-tools "Bash(rm:*)" "Clean up"
For project configuration: See references/configuration.md
analysis=$(claude -p --output-format json "Analyze codebase")
claude -p "Implement based on: $analysis"
claude -p "Review auth/" > auth.txt &
claude -p "Review api/" > api.txt &
wait
claude -p "Summarize: $(cat *.txt)"
claude --agents '{"security": {"prompt": "You are a security expert"}}' \
--agent security -p "Review auth"
For complete orchestration patterns: See references/orchestration.md
# Persistent session
claude --session-id "task-123" -p "Start feature"
claude --session-id "task-123" -c -p "Continue"
# Stateless
claude -p --no-session-persistence "One-off task"
.claude/settings.json{
"permissions": {
"allow": ["Bash(npm:*)", "Edit", "Read"],
"deny": ["Bash(rm -rf:*)"]
}
}
CLAUDE.mdProject instructions auto-loaded by Claude.
For CI/CD and MCP: See references/configuration.md
# Get result
claude -p --output-format json "prompt" | jq -r '.[-1].result'
# Check success
claude -p --output-format json "prompt" | jq '.[-1].is_error'
# Get cost
claude -p --output-format json "prompt" | jq '.[-1].total_cost_usd'
| Type | Description |
|---|---|
system | Init with tools, model, session |
assistant | Claude's response |
user | Tool results |
result | Final status and cost |
For complete parsing guide: See references/response-parsing.md
--max-budget-usd for autonomous agents--tools--json-schema for reliable parsing--dangerously-skip-permissions only in isolated environmentsis_error and exit codesWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub filipexyz/plugins --plugin claude-code-cli