🤖

AI 编码助手,直达本地文件系统

Claude Code Dispatch · v1.0.0
可以安装,但有提示 HAS_SCRIPTS
开发 安全 B 级 作者 ezpeasydave 公开目录收录
1.1k 下载 0 安装 4.6k 收藏 9 浏览

简介

通过子进程调用 Claude Code CLI,实现文件编辑、Shell 执行与多文件调试等复杂编码任务的代理分发。

原始描述

Invoke Claude Code CLI as a subprocess for coding tasks that require file access, editing, and shell execution

通过你的 Agent 添加

安装目录:claude-code-dispatch/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/claude-code-dispatch/
Codex CLI~/.codex/skills/claude-code-dispatch/
DeepSeek Harness~/.agents/skills/claude-code-dispatch/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心功能

Claude Code Dispatch 是一种任务代理技能,旨在将超出当前代理能力范围的复杂编码任务委托给 Claude Code CLI 处理。其核心定位是文件系统交互代理,弥补了纯对话式 AI 无法直接操作本地文件、执行 Shell 命令的短板。

该技能通过封装 invoke-claude.sh 脚本,提供标准化的 CLI 调用接口,支持文件读写(Read/Edit/Glob/Grep)与 Shell 命令执行(Bash)两大能力集群,并可灵活配置模型(Sonnet/Opus/Haiku)与工具权限。

显著优势

  1. 权限粒度可控:通过 --tools 参数精确限定 Claude Code 的操作范围,从只读审查到全功能编辑均可配置
  2. 成本透明化:内置预算控制与成本估算,便于团队管控 API 开支
  3. 模型智能路由:根据任务复杂度自动推荐模型——Haiku 处理简单重构、Sonnet 应对常规调试、Opus 负责架构级多文件修改
  4. 环境继承:自动继承宿主机的环境变量与 API 密钥,无需重复配置

潜在局限

  • 并发限制:同一工作目录禁止并发调用,需手动串行化任务队列
  • 无状态会话:每次调用独立执行,不支持多轮对话,复杂任务需一次性提供完整上下文
  • 输出截断:2000 字符后的响应会被截断,超长输出需配合文件写入或分页策略
  • 前置依赖苛刻:必须预先在 ~/.claude/settings.json 中授权工具权限,否则非交互模式直接失败

适用人群

  • 需要自动化代码审查的 CI/CD 流水线维护者
  • 从事大型项目重构、需跨文件协调的开发者
  • 希望将 AI 编码助手集成到现有 IDE/编辑器工作流的高级用户
  • 需批量处理代码库(如统一升级依赖、迁移语法)的 DevOps 工程师

常规风险

  • 配置泄露风险:settings.json 若配置过于宽泛(如 Bash(*:*)),可能导致任意命令执行
  • 工作目录污染:Claude Code 拥有直接文件写入权限,误操作可能破坏代码库
  • 成本失控:Opus 模型在处理大型代码库时代价高昂,需严格设置 --budget 上限
  • 超时中断:默认 300 秒超时可能不足以完成复杂构建任务,需根据项目规模调整

技能正文


name: claude-code-dispatch description: Invoke Claude Code CLI as a subprocess for coding tasks that require file access, editing, and shell execution version: 1.0.0 author: Claude Code (Anthropic) triggers:

  • "use claude code"
  • "have claude fix"
  • "claude code task"
  • "run claude on"
  • "send this to claude code" metadata: {"clawdbot":{"emoji":"🤖","requires":{"bins":["claude","jq"]},"install":[{"id":"claude","kind":"npm","package":"@anthropic-ai/claude-code","bins":["claude"],"label":"Install Claude Code (npm)"},{"id":"jq","kind":"brew","formula":"jq","bins":["jq"],"label":"Install jq (brew)"}]}}

Claude Code Dispatch

Delegate coding tasks to Claude Code CLI. Use this when a task requires capabilities beyond what the current agent can do: file editing, shell commands, multi-file debugging, code review with file access, or any work that needs direct filesystem interaction.

Prerequisites

Claude Code must be installed and authenticated on the host machine. The host's ~/.claude/settings.json must pre-authorize the tools this skill will use. Example minimal config:

{
  "permissions": {
    "allow": [
      "Read",
      "Edit",
      "Glob",
      "Grep",
      "Bash(git:*)",
      "Bash(npm:*)"
    ]
  }
}

Without pre-authorized permissions, Claude Code will fail in non-interactive mode because it cannot prompt for approval.

When to Use

Route tasks to Claude Code when they require:

  • File reading, editing, or creation on the host filesystem
  • Shell command execution (builds, tests, git operations)
  • Multi-file debugging or refactoring
  • Code review with actual file access
  • Any task where the agent needs to interact with the local filesystem

Do NOT use when:

  • The task is purely conversational (answering questions, planning)
  • You can handle it with your own capabilities or other skills
  • The task involves external APIs you already have access to

Usage

bash {baseDir}/scripts/invoke-claude.sh \
  --prompt "Fix the broken import in src/App.tsx" \
  --workdir "/path/to/project" \
  --model sonnet \
  --tools "Read,Edit,Glob,Grep,Bash"

Parameters

Parameter Required Default Description
--prompt Yes — Task description for Claude Code
--workdir Yes — Working directory (must exist)
--model No sonnet Model: sonnet, opus, or haiku
--tools No Read,Edit,Glob,Grep Comma-separated allowed tools
--budget No 2.00 Max budget in USD (for cost reporting)
--timeout No 300 Timeout in seconds
--system No — Additional system prompt text

Model Selection Guide

  • sonnet (default): Fast. Good for single-file fixes, simple refactors, code review, running tests.
  • opus: Slower but more capable. Use for complex multi-file debugging, architectural changes, tasks requiring deep reasoning across many files.
  • haiku: Fastest and cheapest. Use for trivial tasks like renaming, formatting, or simple lookups.

Tool Presets

Common tool combinations for different task types:

  • Read-only (code review, analysis): Read,Glob,Grep
  • Standard editing (default): Read,Edit,Glob,Grep
  • Full access (builds, tests, git): Read,Edit,Glob,Grep,Bash

Output Format

The script returns a structured summary:

STATUS: success|failure
MODEL: sonnet|opus|haiku
COST: $0.04
DURATION: 12s
RESULT: <Claude Code's response>

Exit codes: 0 = success, 1 = Claude Code error, 2 = preflight failure, 3 = timeout.

Examples

Fix a build error:

bash {baseDir}/scripts/invoke-claude.sh \
  --prompt "The build is failing with 'Cannot find module ./utils'. Diagnose and fix." \
  --workdir "/Users/dave/WebProjects/summer-camps" \
  --tools "Read,Edit,Glob,Grep,Bash"

Code review:

bash {baseDir}/scripts/invoke-claude.sh \
  --prompt "Review the changes in the last commit. Focus on correctness and security." \
  --workdir "/Users/dave/WebProjects/summer-camps" \
  --model opus \
  --tools "Read,Glob,Grep,Bash"

Run tests and fix failures:

bash {baseDir}/scripts/invoke-claude.sh \
  --prompt "Run the test suite, then fix any failing tests." \
  --workdir "/Users/dave/WebProjects/summer-camps" \
  --tools "Read,Edit,Glob,Grep,Bash" \
  --timeout 600

Limitations

  • No concurrent invocations to the same working directory. Queue tasks sequentially.
  • No multi-turn conversations. Each invocation is independent. For follow-up work, dispatch a new invocation with more context in the prompt.
  • Result truncation. Responses longer than 2000 characters are truncated at the nearest line boundary.

Notes

  • Cost is reported for observability. Subscription users are not charged per-token but the field shows what the task would cost on the API.
  • Claude Code inherits environment variables from the host, including any API keys loaded by load-openclaw-env or similar scripts.
  • The prompt is passed via stdin pipe, not shell interpolation, so special characters in prompts are safe.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

clicode-automationfile-systemanthropicshell-integrationdebuggingrefactoringci-cd

同类 Skill