Claude Agents 标志

Claude Agents

社区
phuryn
claude-agents

'Ask Claude', 'have Claude build or review this': drive Claude Code headless (claude -p) from another agent as a peer, builder or fresh reviewer.

概览

发布者phuryn
代码仓库product-engineering
技能名称claude-agents
星标数
189
复刻数
27
附带文件
1
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 1 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 phuryn 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Claude Agents AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/phuryn/product-engineering/tree/main/agent-teams/skills/claude-agents
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/phuryn/product-engineering.git /tmp/product-engineering
mkdir -p .claude/skills
cp -r /tmp/product-engineering/agent-teams/skills/claude-agents .claude/skills/claude-agents
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Claude Agents,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Claude Agents。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Claude Agents 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Claude agents — Claude Code headless as a partner

Any agent can run Claude Code non-interactively (claude -p) and get a full Claude Code session back: the repository's instructions, its tools, a conversation that can be continued. Used that way it is a partner, same standing as the agent calling it — a peer that argues a decision through, a builder that takes a stage, or a reviewer that has never seen the build. This skill is how to brief it, which mode to run it in, and the mechanics, through the wrapper in <skill dir>/scripts/claude_agent.py.

The partner discipline (compact)

The full doctrine is the delegation skill; this is what must hold even when this folder is copied alone.

  1. A delegate gets the why, not just the what. The goal in the owner's terms, the decision it feeds, the facts, the reasoning behind non-obvious choices, the constraints that bind and the traps a smart newcomer would walk into, and how the result will be proved. Never a keystroke script: no prescribed paths, filenames, libraries or steps unless they are hard constraints. A brief with the goal in it comes back with judgement; an instruction-only brief comes back compliant and wrong in the large.
  2. Peer, not tool. Its view is not binding, and neither is yours. A choice you would not have made is a disagreement to surface, not a defect.
  3. Early, not late. The cheapest wins are at framing: the angle, the load-bearing claim, what to cut. A late sign-off is the least valuable use.
  4. Iterate. Three to eight turns is normal. Stopping at turn 1 because a draft came back treats a partner as a one-shot generator.
  5. Converge before surfacing. The human arbitrates intent and taste, not trade-offs two agents could argue through. Bring one result, or a disagreement stated cleanly.
  6. A delegated diff is unreviewed code, and the session that wrote it never clears it. Read it, check the disk, re-run the gate yourself; the independent review is a fresh session (independent-review).
  7. What never delegates: deciding what the product should do; accepting or rejecting a review finding; anything that touches a real system, development included (a deploy, a migration applied to any database, a server's secrets, a live setting): the builder makes each one command and names it, and you run it; final verification; the judgement that a stage is done.
  8. Size, not time. If the brief would be nearly as long as the diff, write the diff yourself.

Peer, builder or reviewer

RoleModeWhat it can doSession
Peer — argue a framing, pressure-test a claim, a second opinion on a planconsult (default)Read, Grep, Glob and the read-only shell (git log, git diff, git status); every write is deniedcontinued turn after turn
Builder — a stage with a goal, its binding decisions and how to prove itbuildEdits, shell, tests; a classifier reviews each action (auto mode)continued within the stage
Reviewer — fresh eyes on an artifact, a plan, a changereviewRead, Grep, Glob only; no settings, hooks, plugins, MCP, project instructions or memoryalways new, never saved
  • A review needs a fresh session. Never the building thread resumed or forked (--fork-session copies the builder's beliefs with its transcript), never a subagent of it. --mode review always starts one and never saves it. It has no shell, so it cannot read a git range: a review of commits (a change before a push, a release) goes through the independent-review skill's wrapper, whose --reviewer claude is this same fresh headless session: it writes the range's log and diffs to a file the reviewer pages through, fails short rounds loudly, and runs the loop until nothing introduced is above Low and no High or Critical of any age is open. Don't give review mode git commands instead: an allow rule such as Bash(git diff:*) also lets git diff --output=<file> write. (2026-11-01, an evals product ran each review round by hand with git commands allowed, because this line did not say where a review of commits goes.)
  • When the caller is itself Claude, a headless Claude is the same model family. A consult still buys a fresh context and a different line of reasoning, but blind spots are shared; for an independent review prefer another family (Grok, which the independent-review skill's wrapper runs by default, as grok-agents describes); without Grok, its fallback is this same fresh headless session, which is accepted.
  • In consult and build the delegate reads what you read. The repository's CLAUDE.md (or AGENTS.md when there is no CLAUDE.md), the user's own ~/.claude/CLAUDE.md, the project's auto-memory, its hooks and skills all load. It is not independent of what is written there — which is the point for a builder and the reason review mode loads none of it.

The opening brief

Claude Code reads the repository's instructions on its own in consult and build, so the brief carries what those files do not: the decision at hand, the conversation so far, what you have already tried and rejected.

WhatExample
TARGETWhat we are producing or deciding, and for whom"a call on whether retries belong in the client or the queue", "stage 3: the export endpoint"
RESEARCHWhat is actually knownlogs, measurements, the source quote, what the owner said, prior attempts
DRAFTThe current version and the variants consideredpaste the artifact, not a description of it
REASONINGWhy you are stuck, or what binds the buildwhat you rejected and why; the trap ("the same string feeds another spawn path, so not in the argument builder"); how it will be proved

In review mode it reads nothing on its own, so the brief also names the files that are the binding spec.

Long briefs go in a file and are read from there: the wrapper sends every prompt on stdin, never as an argument.

bash
python <skill dir>/scripts/claude_agent.py --new --cwd <repo> --read <brief file>
python <skill dir>/scripts/claude_agent.py --new --mode build --cwd <worktree> --read <stage brief>
python <skill dir>/scripts/claude_agent.py --mode review --cwd <repo> --read <review brief>

Run a partner on the strongest model the account offers (--model opus tracks the newest Opus; best picks Fable where the account has it) — the wrapper sends xhigh effort by default and max for a review, because without an explicit level Opus, Sonnet and Haiku 5.5 run at medium (model configuration docs, read 2026-10-24).

Follow-up turns

React like a colleague: agree where it is right, push back where it is wrong, ask why where it surprises you, name what it missed. Do not re-package the goal as a new structured prompt; if you are rewriting the goal in turn 3, you have left the conversation.

bash
python <skill dir>/scripts/claude_agent.py --cwd <repo> "agree on the queue, but a poison message would block the shard — doesn't that kill it?"

A plain call continues the session the wrapper last opened in that directory, in the same mode, on the same model and effort.

Signs you are not done: a critique you have not voiced; a choice it made that you do not buy and did not push on; an option neither of you explored; the temptation to ask the human "which of these two?". Signs you have converged: you would defend the result against your own critique; neither of you is finding new angles; what remains is taste. Surface to the human on genuine deadlock, on ambiguity about what they want, or on a fact only they have.

Resume or start fresh

  • Within a stage or a conversation, resume. The default.
  • A new stage or a new question starts fresh, with --new. What the project knows belongs in its docs and the brief, not in a long thread carrying assumptions the docs have since replaced. If a fresh session would miss something, that is a gap in the docs.
  • Parallel builds get a worktree each. The wrapper keeps one session per working directory, so two worktrees never share one. Two sessions in one directory need a state file each: CLAUDE_AGENT_STATE=<a file per session> on every call for it.
  • An earlier session resumes by id: --session <id>. The wrapper prints every run's id; Claude Code finds an id in any project on the machine and keeps transcripts 30 days by default (sessions docs, read 2026-10-24). --session fails rather than starting a new session.
  • A usage limit makes the partner unavailable, as a missing CLI does. The run fails with the limit's message ("You've hit your session limit · resets 3:45pm", errors docs, read 2026-10-24) and a non-zero exit. Wait if the reset is near; otherwise do the work yourself, and the independent review still applies. The state keeps the session, so after the reset the next call continues it.

How you can tell it worked

The answer came from a session that started with only your brief, its exit code and output were read from the run itself, and anything it built was reviewed before it was trusted.

Mechanics

The script is this skill's own scripts/claude_agent.py. Use its absolute path so it works from any directory, and pass --cwd so the session is scoped to the repository it works in. Python standard library only; --check shows the binary, its version and the state file without running anything, --dry-run prints the exact claude command.

CommandEffect
claude_agent.py "<msg>"Continue this directory's session, else start one (consult)
claude_agent.py --new "<msg>"Force a new session
claude_agent.py --session ID "<msg>"Resume that session; no fallback
claude_agent.py --read FILEMessage from FILE (- for stdin)
claude_agent.py --status / --resetShow / forget this directory's session
FlagDefaultNotes
--modeconsult; a resume keeps the session's last modeconsult / build / review (table below). Applied on every turn.
--modelthe CLI'sAlias or full id. Remembered and re-sent on every resume.
--effortxhigh; review maxlow … max. Remembered and re-sent on every resume, which does not keep it.
--cwd DIRcurrent directoryWhere the session works; sessions are scoped to it.
--add-dir DIR—Extra directory the tools may reach; repeatable; re-sent on resume.
--budget USDnone--max-budget-usd: stops the run at that estimated spend.
--max-turns NnoneStops after N agentic turns.
--schema FILE—A JSON Schema; prints the validated structured_output instead of text.
--mcpoffLoad the configured MCP servers (consult, build).
--timeout SEC3600Kills the run; the state keeps the session if it opened.
--log FILE—Appends the raw stream-json events as they arrive, to tail a long build.
--rawoffPrints the whole result event as JSON.

What each mode sends, every turn:

ModeFlags
consult--permission-mode dontAsk --permission-prompts none --tools Read,Grep,Glob,Bash --strict-mcp-config
build--permission-mode auto --permission-prompts none --strict-mcp-config (default tools)
review--restricted --tools Read,Grep,Glob --strict-mcp-config --permission-mode dontAsk --permission-prompts none --no-session-persistence, CLAUDE_CODE_DISABLE_AUTO_MEMORY=1, and CLAUDE_CODE_EFFORT_LEVEL removed

All three add -p --output-format stream-json --verbose --effort <level>. After each run the answer goes to stdout and one line to stderr — new or resumed session id, mode and the permission mode that actually ran, the model that ran, the effort the reply ran at, this run's cost and the session's, turns — plus a warning when any of those differs from what was asked, the list of denied tool calls, and a warning when Claude Code saved no transcript. Read that line before trusting a round. A failed run prints nothing on stdout and exits non-zero (2 for a bad argument to the wrapper).

Session continuity

One small state file per working directory under <claude config dir>/claude-agent/ records the session id Claude Code reported when it opened the session, with its mode, model, effort and extra directories; the next call resumes that id (--resume <id>) with the same settings. Not --continue: that takes the most recent conversation in the directory, whoever started it, and claude -p --continue includes every -p session there (CLI reference, read 2026-10-24).

The state names the last session that opened in the directory, whether the run then succeeded or failed. A usage limit or a timeout part-way through a build leaves it on that session, which holds the brief and the work so far, so the next call continues it; --new starts over. A resume falls back to a new session only when Claude Code has no transcript for the id (No conversation found with session ID, exit 1, no session opened — observed 2026-10-24); with --session it fails instead.

claude -p --resume restores the model and nothing else the wrapper sets. Observed 2026-10-24, Claude Code 2.1.310: a session started on Haiku at effort low with --permission-mode dontAsk, three tools and no MCP servers, resumed with a bare --resume <id>, came back on Haiku — but at effort medium, in permission mode default, with 145 tools and 11 MCP servers. The docs agree: a -p resume starts in the permission mode a new -p run would, and --add-dir, --mcp-config and --settings must be passed again (sessions docs, read 2026-10-24). So the wrapper re-sends mode, model, effort and directories on every turn. When calling claude -p --resume directly, pass them all every time — a build session resumed without its permission mode runs in a mode that denies its writes and reports work it never did.

What a -p session loads

Plain claude -pconsult / buildreview--bare
Project CLAUDE.md / AGENTS.md, user ~/.claude/CLAUDE.mdyesyes (the project file observed)no (observed)no
Auto-memory for the directoryyesyesnono
Hooks, skills, plugins from settingsyesyes; consult lists the skills but has no Skill tool to run themno (--restricted ignores user, project and local settings)no
MCP serversall configured, the account's connectors includednone unless --mcpnoneonly --mcp-config
Loginsubscription or API keysamesameANTHROPIC_API_KEY or apiKeyHelper only

Observed 2026-10-24: a plain claude -p in a scratch folder loaded 145 tools, 11 MCP servers (the account's mail, chat and drive connectors among them), 15 plugins and 110 skills, and its first reply wrote a 47k-token prompt cache — $0.0096 on Haiku 5.5, against $0.0012 with three tools and no MCP. A delegate does not need the owner's mailbox; the modes leave MCP out unless asked. --bare is not usable on a subscription login (it never reads OAuth or the keychain) and skips the project's instructions; the headless docs (read 2026-10-24) say it will become the default for -p in a future release, which would change all of this — re-check claude --help when the wrapper's runs start answering without the project's instructions.

Without --bare or --restricted, a -p run executes the project's hooks, and without --strict-mcp-config connects its .mcp.json servers, even in a folder never trusted, with no trust dialog (headless docs, read 2026-10-24). Consult and build keep the hooks; point them only at repositories you trust.

Permission modes, and why nothing may wait on a prompt

Since 2.1.302 a -p run with no mode set starts in Manual, which denies every call that needs approval, unless a settings file's defaultMode says otherwise (permission-modes docs, read 2026-10-24) — so the mode depends on the machine unless it is passed. The wrapper always passes one, plus --permission-prompts none (2.1.259+): anything that would prompt is denied at once, Claude is told nobody can approve it, and the run continues. dontAsk still runs what an allow rule in the user's settings permits; --restricted (review) does not read those settings.

Observed 2026-10-24: in consult, the Write tool was absent, echo x > f and a python -c file write were both denied (two permission_denials), git status ran, and the disk was unchanged; in review the session had only Read, Grep and Glob and did not attempt a write; in build (auto mode, Haiku 5.5) it edited a file, ran it and ran git status. Auto mode needs a supported model (on the Anthropic API: Opus 4.6+, Sonnet 4.6+, Haiku 5.5, Fable; narrower on cloud providers) and an organization that has not turned it off; otherwise the session starts in Manual (permission-modes docs, read 2026-10-24), and the wrapper's stderr line shows the mode that actually ran. Auto mode is a safety net, not a boundary: production, and every other real system, stays out of a build brief.

Calling it from inside a sandbox

The claude process needs the network, to reach the API, and write access to its config directory (claude auth status prints it as configDirectory), to save the session. A sandbox that blocks either breaks the partner in a different way:

  • Codex workspace-write (Codex CLI 0.159 on Windows, observed 2026-10-24). Default config: the session opened, then the run failed with API Error: Connection refused … (ECONNREFUSED) after about three minutes of retries. With -c sandbox_workspace_write.network_access=true it answered in seven seconds but saved no transcript, so the next call could not continue it — the wrapper now warns when that happens. Adding the config directory as a writable root made a two-turn conversation work:

    bash
    codex exec -s workspace-write \
      -c sandbox_workspace_write.network_access=true \
      -c "sandbox_workspace_write.writable_roots=['<claude config dir>']" ...

    The two keys are in Codex's config reference and its approvals-and-security page (read 2026-10-24), as [sandbox_workspace_write] entries in config.toml too. danger-full-access also works, with no sandbox at all. Codex ran the command through PowerShell, so a message with quotes belongs in a file passed with --read.

  • Other agents' sandboxes (Cursor, Gemini CLI, OpenCode, Grok Build): not tested here. The same two needs apply; check the disk for the transcript, or read the wrapper's warning.

Cost, limits and long runs

  • Login decides the bill. On a Claude subscription a run draws on the plan's usage limits; with an API key it is billed per token. The cost the result reports is a client-side estimate either way (headless docs, read 2026-10-24). On resume total_cost_usd is the session's whole total; the wrapper prints this run's cost from model_usage_since_last_result beside it (observed 2026-10-24).
  • --budget and --max-turns stop a run with a non-zero exit: the budget as error_max_budget_usd (observed 2026-10-24), and spend can pass the cap, so leave headroom (CLI reference). --max-turns is in the CLI reference though claude --help does not list it.
  • Usage limits show up as a failed run carrying the limit's message; every stream also carries a rate_limit_event with the five-hour and seven-day utilization (observed 2026-10-24).
  • A build round takes minutes to an hour. Run the wrapper as a background job of your own harness rather than inside a shell tool with a short timeout, and --log the events to watch progress. After its last turn a -p run waits up to ten idle minutes for background work it started (CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS, headless docs, read 2026-10-24).
  • Background sessions (claude --bg "<task>", then claude agents --json, claude logs <id>, claude attach <id>, claude stop <id>) are for a human watching sessions. --bg cannot be combined with -p, and prints a session id and returns at once instead of a result (CLI help and headless docs, read 2026-10-24); the wrapper runs in the foreground.

Binary lookup

$CLAUDE_BIN, then claude on PATH (on Windows the native claude.exe is preferred over an npm .cmd shim), then the native installer's locations (~/.local/bin, ~/.claude/local, and on macOS /opt/homebrew/bin, /usr/local/bin). The wrapper refuses a Claude Code older than 2.1.259, which lacks --permission-prompts.

Gotchas captured

  • Effort is visible only in the transcript. The JSON result names the model (modelUsage, and the init event's model) but not the effort; the transcript records it on every reply, and the wrapper reads it from there, best-effort, since that format is internal (observed 2026-10-24). CLAUDE_CODE_EFFORT_LEVEL in the environment overrides --effort (env-vars docs); the wrapper warns when it is set, and in review mode removes it, so a review runs at the effort it asks for.
  • An unknown model is not caught up front. The session opens, the first request fails with There's an issue with the selected model (API 404), the exit is 1, and the state keeps that session, so pass --model again or --new (observed 2026-10-24).
  • A failed run's result is the error text. The wrapper prints it on stderr, never as the answer; check is_error, not the exit code alone, when calling claude -p directly.
  • Nested under Claude Code it still works. The child inherits CLAUDECODE=1 and CLAUDE_CODE_CHILD_SESSION=1; -p sessions are still saved and resumable (observed 2026-10-24; env-vars docs agree).
  • The prompt goes on stdin, capped at 10 MB (headless docs); larger material goes in a file the brief names. Stdin is closed after it, or the run waits for more.

Not this skill

The general doctrine — briefs, what never delegates, parallel work, verifying what comes back — is delegation. The release-gate review loop is independent-review. Driving the Codex CLI the same way is codex-agents.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Claude Agents AI 技能有什么作用?

'Ask Claude', 'have Claude build or review this': drive Claude Code headless (claude -p) from another agent as a peer, builder or fresh reviewer.

为什么在 TypingMind 中使用 Claude Agents?

因为您只需安装一次,就能搭配任何模型使用。Claude Agents 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Claude Agents?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/phuryn/product-engineering/tree/main/agent-teams/skills/claude-agents。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Claude Agents?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Claude Agents 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Claude Agents 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Claude Agents AI 技能免费吗?

是的。phuryn 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇