Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Run Claude Code programmatically without interactive UI. Triggers on: headless, CLI automation, --print, output-format, stream-json, CI/CD, scripting.
.claude/skills/aiskillstore-claude-code-headless/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -16% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 4% | 0% |
| case-12 | ✗→✓ | ▲ Improved | -52% | 0% |
| case-14 | ✗→✓ | ▲ Improved | -25% | 0% |
Run Claude Code from scripts without interactive UI.
bash# Basic headless execution claude -p "Explain this code" --allowedTools "Read,Grep" # JSON output for parsing claude -p "List files" --output-format json # Continue conversation claude -p "Start analysis" --output-format json > result.json session=$(jq -r '.session_id' result.json) claude --resume "$session" "Now fix the issues"
| Flag | Description | |------|-------------| | -p, --print | Non-interactive (headless) mode | | --output-format | text, json, stream-json | | -r, --resume | Resume by session ID | | -c, --continue | Continue most recent session | | --allowedTools | Comma-separated allowed tools | | --disallowedTools | Comma-separated denied tools | | --mcp-config | Path to MCP server config JSON | | --verbose | Enable verbose logging | | --append-system-prompt | Add to system prompt |
| Mode | Flag | Effect | |------|------|--------| | Default | (none) | Prompt for permissions | | Accept edits | --permission-mode acceptEdits | Auto-accept file changes | | Bypass | --permission-mode bypassPermissions | Skip all prompts |
bashclaude -p "Hello" # Outputs: Human-readable response
bashclaude -p "Hello" --output-format json
json{ "type": "result", "subtype": "success", "result": "Hello! How can I help?", "session_id": "abc123", "total_cost_usd": 0.001, "duration_ms": 1234, "num_turns": 1 }
bashclaude -p "Hello" --output-format stream-json # Real-time JSONL output for each message
bashclaude -p "Analyze the codebase" \ --allowedTools "Read,Grep,Glob" \ --disallowedTools "Write,Edit,Bash"
bashclaude -p "Review this PR diff" \ --permission-mode acceptEdits \ --output-format json \ --append-system-prompt "Focus on security issues"
bashsession=$(claude -p "Start task" --output-format json | jq -r '.session_id') claude --resume "$session" "Continue with step 2" claude --resume "$session" "Finalize and report"
bashresult=$(claude -p "Task" --output-format json) if [[ $(echo "$result" | jq -r '.is_error') == "true" ]]; then echo "Error: $(echo "$result" | jq -r '.result')" >&2 exit 1 fi
./references/cli-options.md - Complete CLI flag reference./references/output-formats.md - Output format schemas./references/integration-patterns.md - CI/CD and scripting examplesSee Also: claude-code-hooks for automation events, claude-code-debug for troubleshooting
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 23,071 | 8,194 | -64% | 1 | 1 | 0% | 2,036 | 1,720 | -16% | 0 | 0 | — |
case-02 | pass→pass | 13,153 | 7,528 | -43% | 1 | 1 | 0% | 2,341 | 2,276 | -3% | 0 | 0 | — |
case-03 | fail→pass | 9,627 | 6,084 | -37% | 1 | 1 | 0% | 1,632 | 1,930 | +18% | 0 | 0 | — |
case-04 | fail→fail | 12,522 | 11,037 | -12% | 1 | 1 | 0% | 2,070 | 2,870 | +39% | 0 | 0 | — |
case-05 | pass→fail | 9,347 | 13,040 | +40% | 1 | 1 | 0% | 1,438 | 2,843 | +98% | 0 | 0 | — |
case-06 | fail→fail | 14,935 | 15,370 | +3% | 1 | 1 | 0% | 3,052 | 4,112 | +35% | 0 | 0 | — |
case-07 | fail→fail | 14,632 | 3,760 | -74% | 1 | 1 | 0% | 995 | 1,414 | +42% | 0 | 0 | — |
case-08 | pass→pass | 11,677 | 3,689 | -68% | 1 | 1 | 0% | 1,954 | 1,473 | -25% | 0 | 0 | — |
case-09 | fail→pass | 9,732 | 5,180 | -47% | 1 | 1 | 0% | 1,627 | 1,698 | +4% | 0 | 0 | — |
case-10 | pass→pass | 11,181 | 6,314 | -44% | 1 | 1 | 0% | 1,610 | 2,032 | +26% | 0 | 0 | — |
case-11 | pass→pass | 12,772 | 2,769 | -78% | 1 | 1 | 0% | 2,155 | 1,351 | -37% | 0 | 0 | — |
case-12 | fail→pass | 16,380 | 3,130 | -81% | 1 | 1 | 0% | 2,783 | 1,336 | -52% | 0 | 0 | — |
case-13 | pass→fail | 5,876 | 1,893 | -68% | 1 | 1 | 0% | 845 | 1,130 | +34% | 0 | 0 | — |
case-14 | fail→pass | 14,766 | 5,556 | -62% | 1 | 1 | 0% | 2,476 | 1,864 | -25% | 0 | 0 | — |
case-15 | fail→pass | 7,431 | 2,414 | -68% | 1 | 1 | 0% | 1,237 | 1,334 | +8% | 0 | 0 | — |
case-16 | pass→pass | 8,498 | 3,152 | -63% | 1 | 1 | 0% | 1,406 | 1,430 | +2% | 0 | 0 | — |
case-17 | pass→pass | 15,565 | 10,805 | -31% | 1 | 1 | 0% | 2,927 | 2,949 | +1% | 0 | 0 | — |
case-18 | pass→pass | 12,845 | 6,101 | -53% | 1 | 1 | 0% | 1,910 | 1,896 | -1% | 0 | 0 | — |
case-19 | pass→pass | 5,189 | 1,758 | -66% | 1 | 1 | 0% | 819 | 1,141 | +39% | 0 | 0 | — |
case-20 | fail→pass | 13,816 | 3,943 | -71% | 1 | 1 | 0% | 1,964 | 1,450 | -26% | 0 | 0 | — |
case-21 | pass→pass | 12,222 | 3,324 | -73% | 1 | 1 | 0% | 2,156 | 1,411 | -35% | 0 | 0 | — |
case-22 | fail→pass | 12,809 | 5,635 | -56% | 1 | 1 | 0% | 2,163 | 1,881 | -13% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +27 percentage points is the difference between those two pass rates over the 21 comparable cases. 3 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.