claude-code
它能做什么
这项技能向 AI 展示如何以非交互模式运行 Claude Code,让它作为助手来编辑代码、分析项目或审查工作。适合希望由第二个模型来审查或完成任务的开发人员。
适用场景
- ✓你想把编写代码或重构任务交给 Claude Code,并取回结果的时候。
- ✓你想从另一个 AI 模型获得第二意见或独立审查的时候。
- ✓你想让多个 Claude Code 助手同时处理任务的不同部分的时候。
技能链接
https://github.com/kortix-ai/suna/blob/dev/.agents/skills/claude-cli/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请让 Claude Code 审查我的代码修改,并列出它发现的所有错误。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会编写清晰的指令,在无界面模式下使用正确的文件夹和权限设置运行 claude 命令,保存输出,然后自行检查被修改的文件。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Claude Code as a Sub-Agent
Claude Code is Anthropic's terminal coding agent. Its headless mode,
claude -p (a.k.a. --print), makes it a disposable sub-agent: you write the
metaprompt, Claude explores/edits/runs commands on its own, and returns a final
message you capture and verify. You stay the planner; Claude is the implementer —
it's a strong long-context planner, so this is useful for reviews, big-picture
design, and cross-cutting refactors.
Golden rule: Claude's self-report is a claim, not the truth. Capture its output, then independently verify the artifacts yourself (read the files, re-run the tests) before treating the task as done.
Verified locally: claude 2.1.167. Confirm install with claude --version.
The core command
claude -p "your metaprompt here" \
--add-dir <workdir> \
--permission-mode <default|acceptEdits|plan|bypassPermissions> \
--output-format json >/tmp/claude_<rand>.json 2>>/tmp/claude_<rand>.log
-p, --print— headless: print the response and exit. Required for scripting.- Prompt as the arg, OR pipe via stdin:
echo "$PROMPT" | claude -p(good for long/generated prompts). --output-format—text(default),json(single object withresult+session_id+ cost/usage), orstream-json(NDJSON events as they arrive). Usejsonfor clean capture and to grab thesession_idfor resume.- Redirect stdout to a capture file and stderr to a log so progress noise
doesn't pollute your context. Generate
<rand>once per run. --model <alias|id>— pin the model (e.g.opus,sonnet, or a full id).--add-dir <dir>...— extra directories Claude may read/write.--append-system-prompt <text>— inject extra instructions/persona.
Permission modes (pick the least privilege)
default— Claude asks before edits/commands. In headless-pit cannot prompt, so write actions are effectively blocked → good for read-only review/analysis.plan— Claude plans but does not edit. Use for "design this / find the bug".acceptEdits— auto-accepts file edits. Use for real implementation.bypassPermissions(or--dangerously-skip-permissions) — no gating at all. Powerful; only use when the user has explicitly authorized autonomous edits AND the working dir is scoped, or in a throwaway dir. When unsure, ask which mode before granting write access.
Output & session resume
- Parse
--output-format json: theresultfield is the final message; thesession_idfield lets you continue the same conversation. - Resume with context intact:
claude -p --continue "now also update the tests" # most recent session claude -p --resume <session-id> "..." # a specific session - Use resume for multi-turn delegation (draft → refine → fix) instead of re-sending all context.
Delegation patterns
- One-shot task — scope
--add-dir,acceptEdits, capture, verify. - Second opinion / adversarial review —
planmode, ask Claude to critique your diff or find bugs. Different model, different blind spots. - Plan/implement split — Claude designs; you implement (or vice-versa).
- Parallel fan-out — for N independent tasks, launch N
claude -pruns, each with its own capture/log file. For concurrent WRITE runs, give each its owngit worktree adddir and point--add-dirthere to avoid edit collisions.
The supervision loop (never skip)
- Delegate —
claude -p ... --output-format json >out 2>>log. - Capture — read the
resultfromout(andlog/stream-json for detail). - Verify INDEPENDENTLY — do not trust "tests pass" / "done":
git status/git diffto see what actually changed.- Read the changed files yourself.
- Re-run the build/tests/linter yourself and read the real output.
- Iterate — if wrong,
claude -p --continue "<correction>"and repeat. - Report — state what changed, what you verified, and how. Say plainly when something failed or was skipped.
Cleanup: remove /tmp/claude_* capture/log files (and any throwaway worktrees)
when done.
常见问题
AI 会相信 Claude Code 的报告吗?
不会。技能说明应把它的自我报告视为一种说法,在认定任务完成之前,先验证被修改的文件和测试。
需要安装 Claude Code 吗?
需要。必须安装 claude 命令行工具,技能要求先检查版本。
这些工作可以并行进行吗?
可以。技能涵盖同时运行多个智能体,例如分别处理任务的不同部分。
详情
作者的原始描述
Drive Anthropic's Claude Code CLI (`claude -p`) as a non-interactive coding sub-agent from inside Codex. Use when you want to delegate a coding/analysis/refactor task to Claude, get a second opinion / adversarial review from another model, hand off long-context planning, or fan out parallel agents. Covers the exact `claude -p` flags, permission modes, output capture, JSON/stream-json modes, session resume, parallel fan-out, and the mandatory "delegate → capture → independently verify, never trust the self-report" supervision loop.
repo: kortix-ai/suna
热度
- GitHub 星标
- 20k
- 排名
- #10370
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
codex-cli
20k帮你的智能体把编写代码或审查任务交给 OpenAI 的 Codex CLI,并取回结果,让第二个模型检查工作。
commit-dis
20k帮你的智能体把本次对话中的修改保存为当前 Git 分支上的一次提交,不推送,也不创建新分支。
composio
20k帮你的智能体使用 Composio 连接 Gmail、Slack、GitHub 和 Notion 等应用,服务于你自己的智能体或你开发的产品。
e2e
20k教你的智能体编写端到端测试,用通俗的目标描述和精确的检查来操作网页或移动应用。