SpillwaveSolutions avatar

using-claude-code-cli

Invoke Claude Code CLI from Python orchestrators and shell scripts. Use when asked to"spawn claude a

by SpillwaveSolutions|Open Source

Using Claude Code CLI

Agent Skill Standard License: MIT Skilz Compatible

A Claude Code skill for programmatically invoking Claude Code CLI from Python orchestrators, shell scripts, and automation pipelines.

Overview

This skill provides comprehensive patterns for:

  • Tool Pre-Approval - Eliminate permission prompts with --allowedTools
  • Directory Access - Grant Claude access to additional directories with --add-dir
  • Hooks Configuration - Set up logging, monitoring, and blocking hooks
  • Sandbox Mode - Safe execution for untrusted operations
  • Python Patterns - Synchronous, async, and parallel subprocess invocation
  • JSON Extraction - Parse structured output from CLI responses
  • Fallback Strategies - OpenCode CLI as backup

Quick Start

# Minimal automation command
claude -p "Your prompt" --allowedTools Write Read Edit

# Full automation with all options
claude \
  --model sonnet \
  --add-dir /path/to/skills \
  --allowedTools Write Read Edit Bash Task \
  --output-format json \
  -p "Your automation prompt"

Installation

Using Skilz Universal Installer (Recommended)

The recommended way to install this skill across different AI coding agents is using the skilz universal installer.

This skill supports the Agent Skill Standard which means it works with 14+ coding agents including Claude Code, OpenAI Codex, Cursor, and Gemini CLI.

Install Skilz

pip install skilz

Install from SkillzWave Marketplace

The easiest way to install is from the SkillzWave Marketplace:

# Claude Code (user-level - available in all projects)
skilz install SpillwaveSolutions_using-claude-code-cli-agent-skill/using-claude-code-cli

# Claude Code (project-level)
skilz install SpillwaveSolutions_using-claude-code-cli-agent-skill/using-claude-code-cli --project

# OpenCode
skilz install SpillwaveSolutions_using-claude-code-cli-agent-skill/using-claude-code-cli --agent opencode

# OpenAI Codex
skilz install SpillwaveSolutions_using-claude-code-cli-agent-skill/using-claude-code-cli --agent codex

# Gemini CLI (project-level only)
skilz install SpillwaveSolutions_using-claude-code-cli-agent-skill/using-claude-code-cli --agent gemini

Install from GitHub

You can also install directly from GitHub using HTTPS or SSH:

# HTTPS
skilz install -g https://github.com/SpillwaveSolutions/using-claude-code-cli-agent-skill

# SSH
skilz install --git git@github.com:SpillwaveSolutions/using-claude-code-cli-agent-skill.git

Agent-specific GitHub installs:

# Claude Code (user-level)
skilz install -g https://github.com/SpillwaveSolutions/using-claude-code-cli-agent-skill

# Claude Code (project-level)
skilz install -g https://github.com/SpillwaveSolutions/using-claude-code-cli-agent-skill --project

# OpenCode
skilz install -g https://github.com/SpillwaveSolutions/using-claude-code-cli-agent-skill --agent opencode

# OpenAI Codex
skilz install -g https://github.com/SpillwaveSolutions/using-claude-code-cli-agent-skill --agent codex

# Gemini CLI
skilz install -g https://github.com/SpillwaveSolutions/using-claude-code-cli-agent-skill --agent gemini

Installation Locations

AgentUser-Level LocationProject-Level Location
Claude Code~/.claude/skills/./.claude/skills/
OpenCode~/.config/opencode/skills/./.opencode/skills/
OpenAI Codex~/.codex/skills/./.codex/skills/
Gemini CLIN/A./GEMINI.md (inline)

Other Supported Agents

Skilz supports 14+ coding agents including Windsurf, Qwen Code, Aidr, Cursor, and more.

For the full list of supported platforms, visit:

File Structure

using-claude-code-cli/
├── SKILL.md                           # Main skill document
├── README.md                          # This file
├── .gitignore                         # Git ignore patterns
└── references/
    ├── cli-reference.md               # Complete CLI commands and flags
    ├── subprocess-patterns.md         # Python invocation patterns
    ├── hooks-examples.md              # Hook configuration and scripts
    ├── json-extraction.md             # Parsing JSON from output
    └── orchestrator_example.py        # Complete Python orchestrator class

Triggers

The skill activates on queries containing:

  • "claude cli", "claude subprocess", "claude permissions"
  • "--allowedTools", "--add-dir", "--settings"
  • "spawn claude", "headless claude", "parallel agents"

Use Cases

ScenarioReference
Python subprocess invocationsubprocess-patterns.md
Setting up hooks for logginghooks-examples.md
Parsing JSON from outputjson-extraction.md
Complete orchestrator classorchestrator_example.py
CLI flag referencecli-reference.md

Links

License

MIT