headless

Run Claude Code non-interactively via CLI with JSON output.

5|1|Updated Oct 30, 2025
One-click install
npx skills add https://github.com/reggiechan74/claude-plugins --skill headless
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: headless
Source: https://github.com/reggiechan74/claude-plugins/tree/main/plugins/claude-code-metaskill/skills/headless
Command: npx skills add https://github.com/reggiechan74/claude-plugins --skill headless

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Integrating AI into automated scripts, CI/CD pipelines, or other programmatic tools requires a non-interactive interface. This Skill enables running Claude Code in headless mode for seamless automation, eliminating manual intervention.

Core Features & Use Cases

  • Non-Interactive Execution: Run Claude Code programmatically via CLI for automation, scripting, and integration with other tools.
  • Structured Output: Get responses in JSON or streaming JSON formats for easy programmatic parsing and data extraction.
  • Session Management: Resume existing conversations for multi-turn workflows in scripts, maintaining context across automated tasks.
  • Use Case: Create a CI/CD pipeline step that uses Claude Code in headless mode to automatically review pull request changes for security vulnerabilities and output a JSON report, streamlining your code review process.

Quick Start

Run Claude Code in headless mode to ask 'What is the current git status?' and print the output as JSON.

Frequently Asked Questions about headless

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run Claude Code in headless mode for CI/CD pipelines?

Headless mode enables non-interactive Claude Code execution via CLI using the --print flag, letting you integrate AI into automated workflows, scripting, and CI/CD pipelines without manual intervention or interactive prompts.

Can I get structured JSON output from Claude Code in automated scripts?

Yes, use the --output-format flag to configure JSON or streaming JSON responses, making programmatic parsing and data extraction straightforward for automation and scripting workflows.

How do I maintain context across multiple Claude Code calls in a script?

Session management via --resume and --continue flags preserves conversation context across automated tasks, enabling multi-turn workflows within scripts while maintaining state between CLI invocations.

What's the best way to control tool access in headless Claude Code execution?

Tool whitelisting through the --allowedTools flag restricts which commands Claude Code can execute in automation workflows, providing security and control in CI/CD pipelines and programmatic integrations.

Can I load MCP configurations when running Claude Code headlessly?

Optional --mcp-config loading allows dynamic MCP configuration during headless execution, enabling flexible tool integration and customization for complex automation and CI/CD scenarios.

Do I need interactive mode to integrate Claude Code into my deployment pipeline?

No, headless mode with --print eliminates interactive prompts entirely, making Claude Code suitable for fully automated deployment pipelines, CI/CD steps, and unattended scripting workflows.