Drive Claude Code (the `claude` CLI) to perform tasks the user delegates to Claude. Use when the user asks to use Claude, let Claude handle/analyze/review/build something, or route work to Claude Code ("use claude", "让 claude 做", "让 claude 处理", "claude 来做", "delegate to claude", "ask claude", "claude fix this"). Covers availability preflight, headless one-shot invocation, multi-turn session resume, output parsing, timeout control, and security bounds. Not for driving other CLIs or the local model.
Install
npx skillscat add sakurabytecore/axumagent/claude-driver Install via the SkillsCat registry.
SKILL.md
claude-driver
Route the task to the Claude Code CLI (claude) via headless invocation. Zero configuration is required beyond Claude Code itself being installed and logged in.
Preflight (always first)
- Run
claude --version. If it fails, Claude Code is not installed: tell the user to install it (npm install -g @anthropic-ai/claude-code, see https://claude.com/install) and log in once with an interactiveclaudesession. Do NOT silently fall back to the local model and do NOT fabricate output. - If
claude --versionsucceeds, Claude Code is authenticated out of the box — no API key setup is needed in this skill.
One-shot invocation (default)
Run the task in the target working directory:
- Simple:
claude -p "<task>" --dangerously-skip-permissionsfrom the target cwd. Stdout is the final answer. - Task text contains quotes or newlines: pipe it via stdin instead of hand-quoting:
printf '%s' "<task>" | claude -p --dangerously-skip-permissions. - Structured output needed: add
--output-format json; the JSON carries aresultfield (final answer) and asession_idfield (use it for resume). - Always wrap the call in a hard timeout (e.g.
timeout 300 claude -p ... --dangerously-skip-permissions) so a hung upstream cannot block the session.
Multi-turn work
- Continue the most recent session in the same cwd:
claude -c -p "<follow-up>" --dangerously-skip-permissions. - Resume a specific session:
claude --resume <session-id> -p "<follow-up>" --dangerously-skip-permissions(session_id comes from a previous--output-format jsonrun). - Keep one session per repository or task; do not mix unrelated work into one session.
Security bounds
- Every invocation runs with
--dangerously-skip-permissions(full-permission headless mode) so permission prompts can never block automation. Claude may therefore modify files and run commands in its cwd — only delegate a task when the user actually asked Claude (not the local agent) to do it. - Run Claude in the user's target project directory; do not point it at unrelated paths.
- Surface stderr and non-zero exits fully. A failed
claudecall is reported as failed — never rewrite it as a mock success.
Concurrency
- One
claudeprocess per task. Serialize calls that touch the same repository; independent repositories may run in parallel.