programmatic-claude

Run Claude Code programmatically via CLI (-p flag), Python SDK, or TypeScript SDK. For automation, CI/CD, session chaining, headless execution, and orchestrating multiple Claude instances. Triggers: programmatic, headless, CLI automation, session chaining, -p flag, Python SDK, orchestrate Claude, CI/CD Claude, run Claude automatically.

16 stars

Best use case

programmatic-claude is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Run Claude Code programmatically via CLI (-p flag), Python SDK, or TypeScript SDK. For automation, CI/CD, session chaining, headless execution, and orchestrating multiple Claude instances. Triggers: programmatic, headless, CLI automation, session chaining, -p flag, Python SDK, orchestrate Claude, CI/CD Claude, run Claude automatically.

Teams using programmatic-claude should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/programmatic-claude/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/cli-automation/programmatic-claude/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/programmatic-claude/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How programmatic-claude Compares

Feature / Agentprogrammatic-claudeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Run Claude Code programmatically via CLI (-p flag), Python SDK, or TypeScript SDK. For automation, CI/CD, session chaining, headless execution, and orchestrating multiple Claude instances. Triggers: programmatic, headless, CLI automation, session chaining, -p flag, Python SDK, orchestrate Claude, CI/CD Claude, run Claude automatically.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Programmatic Claude Code

Run Claude non-interactively for automation workflows.

## Three Interfaces

| Interface | Install | Best For |
|-----------|---------|----------|
| CLI (`-p`) | Built-in | Scripts, CI/CD, quick tasks |
| Python SDK | `pip install claude-agent-sdk` | Custom agents, hooks, multi-turn |
| TypeScript SDK | `npm install @anthropic-ai/claude-agent-sdk` | Type-safe apps, Node.js |

## Core Patterns

### One-Shot Task
```bash
claude -p "Fix TypeScript errors in src/" \
  --allowedTools "Read,Edit,Bash" \
  --output-format json
```

### Session Chaining
```bash
# Start task, capture session ID
result=$(claude -p "Create auth system" --output-format json)
session_id=$(echo "$result" | jq -r '.session_id')

# Continue in same session
claude -p "Add tests for auth" --resume "$session_id"
```

### Structured Output
```bash
claude -p "List all API endpoints" \
  --output-format json \
  --json-schema '{"type":"object","properties":{"endpoints":{"type":"array"}}}'
```

### Python Multi-Turn
```python
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions

options = ClaudeAgentOptions(
    allowed_tools=["Read", "Write", "Edit", "Bash"],
    permission_mode="acceptEdits"
)

async with ClaudeSDKClient(options=options) as client:
    await client.query("Build the component")
    async for msg in client.receive_response():
        print(msg)

    await client.query("Now add tests")
    async for msg in client.receive_response():
        print(msg)
```

## Key Flags

| Flag | Purpose |
|------|---------|
| `-p "prompt"` | Non-interactive mode |
| `--allowedTools "X,Y"` | Auto-approve tools (no prompts) |
| `--output-format json` | Structured output with session_id |
| `--json-schema '{...}'` | Enforce response format |
| `--resume <id>` | Continue specific session |
| `--continue` | Continue most recent session |

## Files

- `README.md` - Overview and quick examples
- `harvest-and-build.md` - Website cloning automation pipeline

## Use Cases

1. **CI/CD** - Run in GitHub Actions for automated fixes
2. **Orchestration** - Chain multiple Claude sessions
3. **Pipelines** - Harvest → Analyse → Build → Validate workflows
4. **Scheduled Tasks** - Daily security scans, dependency updates

Related Skills

claude-player

16
from diegosouzapw/awesome-omni-skill

An AI-powered Game Boy emulator agent that uses Claude's vision and reasoning to autonomously play Game Boy games.

claude-opus-4-5-migration

16
from diegosouzapw/awesome-omni-skill

Migrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5. Use when the user wants to update their codebase, prompts, or API calls to use Opus 4.5. Handles model string updates and prompt adjustments for known Opus 4.5 behavioral differences. Does NOT migrate Haiku 4.5.

claude-config-management

16
from diegosouzapw/awesome-omni-skill

Claude Code設定(リポジトリルート)の構成管理ガイド。ファイルレベルsymlinkによる設定管理、管理対象の追加・削除、Taskfileタスクの実行方法を提供する。「設定ファイルを追加して」「新しいスキルを追加して」「symlinkの状態を確認して」「Claude設定を変更して」のようにClaude Code設定の構成変更を行うときに使用する。

varlock-claude-skill

16
from diegosouzapw/awesome-omni-skill

Secure environment variable management ensuring secrets are never exposed in Claude sessions, terminals, logs, or git commits

templar-miner-claude-skill

16
from diegosouzapw/awesome-omni-skill

This skill should be used when setting up, optimizing, or managing Templar AI miners on Bittensor Subnet 3 (netuid 3). Use it for tasks involving miner configuration, performance optimization, troubleshooting gradient scoring issues, managing Bittensor wallets with btcli, monitoring miner metrics, renting GPUs via Basilica for mining operations, or strategizing to achieve top miner ranking in the Templar decentralized training network. Integrates seamlessly with the basilica-cli-helper skill for GPU rentals.

linear-claude-skill

16
from diegosouzapw/awesome-omni-skill

Manage Linear issues, projects, and teams

claude-cli

16
from diegosouzapw/awesome-omni-skill

Use claude CLI for interactive AI sessions, scripting with print mode, MCP server management, and plugin configuration. Master session management, tool control, and automation workflows.

programmatic-seo

16
from diegosouzapw/awesome-omni-skill

When the user wants to create SEO-driven pages at scale using templates and data. Also use when the user mentions "programmatic SEO," "template pages," "pages at scale," "directory pages," "location pages," "[keyword] + [city] pages," "comparison pages," "integration pages," or "building many pages for SEO." For auditing existing SEO issues, see seo-audit.

verify-claude-setup

16
from diegosouzapw/awesome-omni-skill

Verify .claude directory configuration is complete and correct. Use when checking if agents, hooks, rules, and memory are properly set up, or after making changes to .claude configuration.

utils:find-claude-plugin-root

16
from diegosouzapw/awesome-omni-skill

This skill should be used when the user needs to locate a plugin's installation path, when ${CLAUDE_PLUGIN_ROOT} doesn't expand in markdown files, or when invoked via /utils:find-claude-plugin-root. Generates a CPR resolver script at /tmp/cpr.py.

moai-foundation-claude

16
from diegosouzapw/awesome-omni-skill

Canonical Claude Code skill authoring kit covering agent Skills, sub-agent templates, custom slash commands, orchestration patterns, hooks, memory, settings, and IAM permission rules aligned with official documentation.

ffuf-claude-skill

16
from diegosouzapw/awesome-omni-skill

Web fuzzing with ffuf