using-claude-code-cli
Invoke Claude Code CLI from Python orchestrators and shell scripts. Use when asked to "spawn claude as subprocess", "automate claude cli", "run claude headless", "configure --allowedTools", "set up claude hooks", or "parallel claude invocation". Covers permissions, directory access (--add-dir), hooks, sandbox mode, and async patterns.
npx skills add majiayu000/claude-skill-registry --skill using-claude-code-cli-spillwavesolutions-agent-rulez --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Using Claude Code CLI Patterns for programmatically invoking Claude Code CLI from orchestrators, scripts, and automation pipelines. ## Contents - [Quick Start Checklist](#quick-start-checklist) - [Essential Commands](#essential-commands) - [Core CLI Flags](#core-cli-flags) - [Sandbox Mode](#sandbox-mode) - [Validation](#validation) - [Troubleshooting](#troubleshooting) - [When Not to Use](#when-not-to-use) ## Quick Start Checklist Copy and track as you work: ``` CLI Automation Setup: - [ ] 1. Identify required tools, add to --allowedTools - [ ] 2. List directories Claude needs, add to --add-dir - [ ] 3. Choose pattern: sync, async, or parallel (see references/) - [ ] 4. Configure hooks if logging/monitoring needed - [ ] 5. Enable sandbox mode for untrusted operations - [ ] 6. Add fallback strategy if using OpenCode backup - [ ] 7. Test with simple prompt before full automation - [ ] 8. Validate setup (see Validation section) ``` ## Essential Commands **Minimal automation:** ```bash claude -p "Your prompt" --allowedTools Write Read Edit --max-turns 5 ``` **Full automation:** ```bash claude \ --model sonnet \ --add-dir /path/to/skills \ --add-dir /path/to/templates \ --allowedTools
- Contents
- Quick Start Checklist
- Essential Commands
- Core CLI Flags
- Sandbox Mode
- Validation
- Troubleshooting
- When Not to Use
- Reference Files
- OpenCode CLI Fallback
claude -p "Your prompt" --allowedTools Write Read Edit --max-turns 5
claude \
claude --settings '{"hooks":{},"sandbox":{"enabled":true}}' -p "prompt"
claude --settings '{"sandbox":{"enabled":true,"autoAllowBashIfSandboxed":true}}' -p "prompt"
claude -p "Create file test.txt with 'hello'" --allowedTools Write
claude -p "List files in /path/to/dir" --add-dir /path/to/dir --allowedTools LS
claude -p "Return {\"status\": \"ok\"}" --output-format json | jq .
claude --settings '{"hooks":{...}}' -p "Simple task" --allowedTools ReadWhat does the using-claude-code-cli skill do?
Invoke Claude Code CLI from Python orchestrators and shell scripts. Use when asked to "spawn claude as subprocess", "automate claude cli", "run claude headless", "configure --allowedTools", "set up claude hooks", or "parallel claude invocation". Covers permissions, directory access (--add-dir), hooks, sandbox mode, and async patterns.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill using-claude-code-cli-spillwavesolutions-agent-rulez --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
