claude-code-cli

Invokes the Claude Code CLI as a controlled non-interactive subprocess from other shell agents.

1|Updated Nov 11, 2012
One-click install
npx skills add https://github.com/fairchild/dotfiles --skill claude-code-cli-fairchild
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: claude-code-cli
Source: https://github.com/fairchild/dotfiles/tree/main/agents/shared/first-party-skills/claude-code-cli
Command: npx skills add https://github.com/fairchild/dotfiles --skill claude-code-cli-fairchild

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Calling the Claude Code CLI from another agent (Codex, pi, or a shell script) can silently load user plugins, MCP connectors, hooks, and session state, causing unpredictable side effects and costs. This Skill defines safe, explicit flag profiles for running claude -p as a bounded subprocess. ## Core Features & Use Cases - Lean Text-Only Profile: Runs Claude with no tools, no MCP servers, no slash commands, and no session persistence for second opinions, classification, or synthesis. - Read-Only Inspection Profile: Grants only the Read tool so Claude can inspect specific files without write access. - Full-Fidelity Mode: Documents when and how to run with normal user settings, flagging the higher side-effect risk. - Use Case: From a Codex session, ask Claude for a code review of a diff using the lean profile with a $0.01 budget cap and JSON output, then parse the result programmatically. ## Quick Start Ask the agent to get a second opinion from the Claude Code CLI on a piece of code using the lean non-interactive profile with a budget cap and JSON output.

Frequently Asked Questions about claude-code-cli

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

FAQPage Schema
How do I run Claude Code CLI non-interactively from a script?▼

Use `claude -p` with `--output-format json` to run Claude Code as a subprocess with captureable output. Add `--no-session-persistence`, `--disable-slash-commands`, and a strict empty MCP config to keep the run free of user-level side effects.

How do I prevent Claude Code subprocess from loading MCP servers and plugins?▼

Pass `--strict-mcp-config --mcp-config '{"mcpServers":{}}'` to block remote connector MCP servers, and use `--setting-sources project` to avoid loading user plugins while keeping OAuth authentication working.

Why does claude --bare return Not logged in?▼

The `--bare` flag does not work with OAuth/keychain-based authentication paths and returns `Not logged in`. Use `--setting-sources project` instead, which preserves auth while reducing side effects from user settings.

How do I limit cost when calling Claude Code as a subprocess?▼

Set `--max-budget-usd` on every invocation and prefer the haiku model for quick probes. If a valid answer returns with an over-budget exit code, raise the budget slightly and rerun.

When should I use full-fidelity Claude Code mode instead of lean mode?▼

Use full-fidelity mode only when the task intentionally needs the user's normal environment, such as skills, hooks, plugins, or MCP connectors. It carries higher side-effect risk, including writes to ~/.claude config state.