claude-headless

Automate headless Claude Code CLI, stream-json, and resume modes.

37|7|Updated Apr 8, 2026
One-click install
npx skills add https://github.com/archibate/dotfiles-claude --skill claude-headless-archibate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: claude-headless
Source: https://github.com/archibate/dotfiles-claude/tree/main/skills/claude-headless
Command: npx skills add https://github.com/archibate/dotfiles-claude --skill claude-headless-archibate

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Claude Code headless usage for programmatic control, streaming results, and SDK integration.

Core Features & Use Cases

  • CLI-based control for Claude Code (one-shot, stream-json, resume)
  • NDJSON streaming protocol for real-time interaction
  • Agent SDK wrappers for multi-turn automation and testing

Quick Start

Start a headless Claude session to spawn Claude as a subprocess, test prompts, and verify streaming output.

Frequently Asked Questions about claude-headless

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

FAQPage Schema
How do I run Claude Code headlessly for CLI automation?

Run Claude Code headlessly by spawning it as a subprocess to automate CLI workflows. This Skill provides command-line control supporting one-shot, stream-json, and resume modes for programmatic execution.

What is NDJSON streaming and how does it work with Claude subprocesses?

NDJSON streaming enables real-time interaction with a Claude subprocess by sending structured data line by line. This Skill implements the NDJSON streaming protocol to parse streaming output during headless sessions.

Can I use the Agent SDK for multi-turn automation and testing with Claude?

Yes, you can use the Agent SDK wrappers to build multi-turn automation and test agent behavior. The Skill provides references for SDK integration to validate prompts and manage interactive sessions.

Does headless Claude Code support resuming previous sessions?

Headless Claude Code supports resuming previous sessions through its resume mode. This allows you to continue multi-turn interactions programmatically without losing the context of earlier subprocess executions.

What's the best way to test skill behavior programmatically using Claude?

The best way to test skill behavior is by spawning Claude as a subprocess and using stream-json mode. This Skill automates headless usage to verify prompts, test skills, and capture real-time streaming output.

When do I need to use stream-json mode for headless Claude sessions?

You need stream-json mode when you require real-time, structured output parsing during headless Claude sessions. It allows your automation scripts to process NDJSON streams as the subprocess generates responses.