Agent skill · AI & Agents

headless-cli-agents

Build agentic systems using Claude CLI in headless mode or the Claude Agent SDK. Use when building automation pipelines, CI/CD integrations, multi-agent orchestration, or programmatic Claude interactions. Covers CLI flags (-p, --output-format), session management (--resume, --continue), Python SDK (claude-agent-sdk), custom tools, and agent loop patterns.

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill headless-cli-agents-cuba6112-skillfactory --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 5 KB
Bundled scripts: none
Path: skills/agent/headless-cli-agents-cuba6112-skillfactory/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Headless CLI Agents Build agentic systems using Claude Code CLI or the Claude Agent SDK. ## CLI Headless Mode Use `-p` flag for non-interactive execution: ```bash # Basic query claude -p "Explain this code" # With JSON output for parsing claude -p "Create a REST API" --output-format json # Streaming JSON for real-time output claude -p "Build a CLI app" --output-format stream-json # Restrict tools claude -p "Stage changes" --allowedTools "Bash,Read" --permission-mode acceptEdits ``` ### Output Formats | Format | Flag | Use Case | |--------|------|----------| | Text | (default) | Simple scripts | | JSON | `--output-format json` | Programmatic parsing | | Stream JSON | `--output-format stream-json` | Real-time streaming | JSON response includes: `session_id`, `total_cost_usd`, `duration_ms`, `num_turns`, `result`. ### Multi-Turn Sessions ```bash # Get session ID session_id=$(claude -p "Start review" --output-format json | jq -r '.session_id') # Continue conversation claude -p --resume "$session_id" "Now implement the plan" # Or continue most recent claude --continue "Add tests" ``` ### Key Flags | Flag | Purpose | |------|---------| | `-p, --print` | Non-interactive mode | | `--outp

What's inside
Steps it walks through
  1. CLI Headless Mode
  2. Output Formats
  3. Multi-Turn Sessions
  4. Key Flags
  5. Python Agent SDK
  6. Basic Usage
  7. Custom Tools (In-Process MCP)
  8. ClaudeSDKClient Options
  9. Agent Loop Pattern
  10. Subagents
  11. Best Practices
  12. Integration Examples
  13. CI/CD Pipeline
  14. Multi-Step Workflow
Ships with 1 file
  • metadata.json
Commands it runs
Basic query
claude -p "Explain this code"
With JSON output for parsing
claude -p "Create a REST API" --output-format json
Streaming JSON for real-time output
claude -p "Build a CLI app" --output-format stream-json
Restrict tools
claude -p "Stage changes" --allowedTools "Bash,Read" --permission-mode acceptEdits
Get session ID
Continue conversation
More from claude-skill-registry
All skills →
About this skill
What does the headless-cli-agents skill do?

Build agentic systems using Claude CLI in headless mode or the Claude Agent SDK. Use when building automation pipelines, CI/CD integrations, multi-agent orchestration, or programmatic Claude interactions. Covers CLI flags (-p, --output-format), session management (--resume, --continue), Python SDK (claude-agent-sdk), custom tools, and agent loop patterns.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill headless-cli-agents-cuba6112-skillfactory --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going