claude-code
它能做什么
这项技能让你的智能体运行 Claude Code 命令行工具来委派编程工作。适合希望另一个编程智能体完成任务、而自己继续工作的开发者。
适用场景
- ✓当你想让 Claude Code 完成一次性的代码修复、功能开发或审查的时候。
- ✓当一项任务需要多轮编辑、测试和审查的时候。
- ✓当你希望一项较长的编程任务在后台运行的时候。
技能链接
https://github.com/XiaomiMiMo/MiMo-Code/blob/main/packages/cli/src/skill/builtin/.bundle/claude-code/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请让 Claude Code 修复我项目中失败的测试,并告诉我它做了哪些改动。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会先检查 claude 工具是否已安装并已登录。然后它会根据任务选择打印模式、交互式会话或后台运行。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Claude Code Delegation
Delegate coding work to Claude Code, Anthropic's autonomous coding agent CLI.
Setup (once): npm install -g @anthropic-ai/claude-code && claude auth login · verify with claude auth status / claude doctor. CI token: claude setup-token. Full auth/install variants → references/flags.md.
Platform check (before running anything): detect the OS first. All shell examples in this skill are POSIX (bash). Linux/macOS run them as-is. On Windows, run Claude Code natively in PowerShell/Git Bash for print and background modes, but interactive tmux orchestration requires WSL. Shell-syntax translation table (quoting, env vars, piping, paths) → references/platforms.md.
Mode Selection (decide FIRST)
| Task shape | Mode | Why |
|---|---|---|
| One-shot task: fix bug, add feature, review diff, extract data | Print -p ← default |
No PTY, no dialogs, structured output |
| Multi-turn iterate: refactor → review → fix → test; needs slash commands | Interactive tmux → references/interactive-tmux.md |
Full REPL, requires dialog handling |
| Long-running, shouldn't block; large fan-out supervision | Background --bg |
Native supervision via claude agents |
| High-stakes PR review | claude ultrareview [pr#] |
Cloud multi-agent, exit-code driven (uploads diff to cloud — never on branches with secrets) |
Do NOT hand-roll tmux fan-outs for parallel work — prefer --bg + claude agents --json --all.
Print Mode (the 90% path)
terminal(command="claude -p 'Fix the auth bug in src/auth.py' \
--allowedTools 'Read,Edit' --max-turns 10 --output-format json",
workdir="/path/to/project", timeout=180)
Always set: workdir · --max-turns (5–10; print-mode only) · --allowedTools (least privilege: Read,Edit,Write,Bash, patterns like Bash(git *)).
JSON result fields: result (text) · session_id (for resume) · subtype (success | error_max_turns | error_budget) · total_cost_usd · num_turns · structured_output (with --json-schema).
Common variants:
git diff main... | claude -p 'Review for bugs' --max-turns 1 # pipe input, cheapest review
claude -p 'Continue: add pooling' --resume <session_id> # resume; --continue = latest in cwd; --fork-session = branch
claude -p 'List functions' --output-format json --json-schema '<schema>' --max-turns 5 # structured extraction (needs turns to read files)
claude --bare -p 'task' --settings ci.json # CI: skips hooks/plugins/CLAUDE.md; auth = ANTHROPIC_API_KEY only
claude -p 'task' --max-budget-usd 0.50 --fallback-model haiku # cost cap (min ~$0.05) + overload fallback
Streaming, stream-json events, bidirectional input, cache-reuse (--exclude-dynamic-system-prompt-sections) → references/print-mode.md.
Background Mode
claude --bg 'investigate flaky test in tests/api.test.ts' # NOT compatible with -p
claude agents --json --all # list/inspect
claude attach <id> | logs <id> | stop <id> | respawn <id> | rm <id>
Guardrails & Gotchas (violations break agents)
-pauto-skips trust/permission dialogs (any non-TTY does) — only run in trusted directories.- Interactive mode = tmux required (Windows: only inside WSL — never attempt tmux in PowerShell/cmd; fall back to
-por--bg); two startup dialogs, and the--dangerously-skip-permissionsdialog defaults to "No, exit" (must sendDownthenEnter). Full patterns →references/interactive-tmux.md. - Session resume is per-directory —
--continueonly finds sessions from the same cwd. - Slash commands don't work in
-p— describe the task in natural language instead. - Context >70% degrades quality — in interactive sessions monitor
/context, use/compact. - Clean up: kill tmux sessions and
claude stop/rmbackground sessions when done. - Don't kill slow sessions — capture progress first (
tmux capture-pane/claude logs). - Report back: after completion, summarize what changed (use the JSON
result+git diff).
References (read on demand)
| File | Read when |
|---|---|
references/print-mode.md |
Streaming output, stream-json events, piping, schemas, session mgmt, cache reuse |
references/interactive-tmux.md |
Any tmux/PTY session: dialogs, send-keys, monitoring, slash commands, shortcuts |
references/flags.md |
Full CLI flag & subcommand tables, auth vari |
常见问题
它会在没有我许可的情况下运行吗?
不会。只有在你明确授权或点名 Claude Code 时,才会加载这项技能。
如果没有安装 Claude Code 怎么办?
智能体会停止,并向你提供安装和登录的指引。
它能在 Windows 上运行吗?
打印和后台模式可以原生运行,但在 Windows 上交互式会话需要 WSL。
详情
作者的原始描述
Operate Claude Code CLI (v2.1+) via the terminal. Load only when the user explicitly authorizes this skill or names Claude Code / claude-code. Before any command, confirm the `claude` binary is available; if missing, stop and give install or auth guidance. Covers print mode (-p), interactive tmux sessions, and background (--bg) orchestration.
repo: XiaomiMiMo/MiMo-Code
热度
- GitHub 星标
- 14k
- 排名
- #11304
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …