agents

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Agents

Agent 技能

Command-driven skill for building, diagnosing, and running agent systems (Cursor/Codex/Claude agents, Task/subagent trees, Trigger/durable workflows, custom orchestrators). Parse the first token as a command when it matches the table; otherwise map clear intent.
用于构建、诊断和运行Agent系统的命令驱动技能(Cursor/Codex/Claude agents、任务/子Agent树、触发器/持久化工作流、自定义编排器)。当第一个token匹配表格中的命令时,将其解析为命令;否则映射明确的意图。

Operating contract

操作契约

Shared by every DecisionNerd/dev-skills skill. Canonical copy:
handbook/concepts/14-operating-contract.md
.
  • Define done first. Before using tools, write the finish line in one or two lines: the acceptance criteria (existing issue AC, BDD scenarios, tests, or contract when they exist; otherwise propose them and say where they should live) and the evidence that will prove them. Re-check it before reporting done. Never report done on work you did not verify.
  • Requested scope sets the finish line. A question ("is it ready?", "why is it broken?", "what next?") ends with the answer and a
    Next:
    line naming the exact next invoke. An outcome request ("fix", "finish", "land", "#42") continues through the chain (diagnose → fix → test → check-readiness → merge-it) until the outcome or a real blocker. Do not end a turn with "Do you want me to…?" for in-scope, in-repo work.
  • Stop only for real blockers. Stop and ask only when you cannot continue without the user, or before: deleting data or unmerged work, force-push or history rewrite, changing anything outside this repository (GitHub objects, deployments, live data, production or paid resources, external services), or leaving the requested scope, unless the user's request already named that exact action. Keep the harness's permission prompts for risky commands. Otherwise keep going and put status notes in the same message as the next action.
  • Ask well, once. For a genuine question use the harness's structured question tool when it has one (Claude Code:
    AskUserQuestion
    ; Codex:
    request_user_input
    when the current mode supports it) with concrete options; otherwise plain text with numbered options. Treat the answer as settled; do not re-open earlier verdicts, plans, or answers unless asked.
  • Fan out when work is parallel. Use subagents for independent reads (repo survey, evidence gathering, per-option research, per-area audits) and for independent verification (a reviewer that did not write the change). Writes stay single-owner per path set and sequential. Brief every child with goal, done-when, constraints, must-not, and return shape; verify each child's result before consolidating. Use Claude Code's
    Workflow
    tool only for orchestration across many subagents that truly needs it; it is expensive.
  • Pick the model tier per child; defer to routing config. If the harness or user config already routes subagents (Claude Code
    CLAUDE_CODE_SUBAGENT_MODEL
    or a CLAUDE.md rule; Codex
    agents.default_subagent_model
    or a role's
    agents.<name>.config_file
    ; Cursor a custom subagent's
    model:
    frontmatter), follow it and do not pass a model. Otherwise: mechanical search or inventory → fast/cheap (Claude Code
    haiku
    ); implementation and evidence gathering → mid (
    sonnet
    ); planning, review, adversarial verification → top (
    opus
    or
    fable
    ). In Claude Code set it with the
    Agent
    tool
    model
    param or agent frontmatter
    model:
    ; in Codex pass a spawn model or set
    model
    in the role's config file; in Cursor set
    model:
    (default
    inherit
    ) in
    .cursor/agents/*.md
    . Where the harness cannot choose, children inherit the parent model or the harness picks one (Cursor's built-in Explore/Bash/Browser subagents pick per subtask); say which in the status note.
  • Keep a checklist on long runs. For more than about five steps or work that crosses skills, keep
    TASKS.md
    at the repo root and tick items as they finish. Do not commit it unless the repo already tracks one.
  • Close every run with three headings.
    Blocked on me
    (the one genuine question or blocker, else "none");
    Changed
    (files, commits, GitHub objects, deploys, else "nothing");
    Found
    (evidence, verdict, and
    Next: <exact invoke>
    ).
所有DecisionNerd/dev-skills技能通用。标准副本:
handbook/concepts/14-operating-contract.md
。
  • 先定义完成标准。 使用工具前,用一两行写下终点线:验收标准(现有issue的AC、BDD场景、测试或契约(如果存在);否则提出验收标准并说明应存放的位置)以及证明完成的证据。在报告完成前重新检查。永远不要对未验证的工作报告完成。
  • 请求范围决定终点线。 问题(“准备好了吗?”、“为什么坏了?”、“下一步是什么?”)以答案和明确下一次调用的
    Next:
    行结束。结果请求(“修复”、“完成”、“落地”、“#42”)会沿着链条持续推进(诊断→修复→测试→就绪检查→合并)直到完成或遇到真正的阻塞。对于范围内的仓库内工作,不要以“你需要我…吗?”结束回合。
  • 仅因真正的阻塞才停止。 仅当没有用户就无法继续时,或在以下操作前才停止并询问:删除数据或未合并的工作、强制推送或历史重写、修改此仓库外的任何内容(GitHub对象、部署、实时数据、生产或付费资源、外部服务),或超出请求范围,除非用户的请求已经明确指定了该操作。对于风险命令,保留运行框架的权限提示。否则继续推进,并将状态说明与下一个操作放在同一条消息中。
  • 一次问一次,问清楚。 对于真正的问题,如果运行框架有结构化提问工具(Claude Code:
    AskUserQuestion
    ;Codex:当前模式支持时用
    request_user_input
    ),则使用该工具并提供具体选项;否则使用带编号选项的纯文本。将答案视为最终结论;除非被要求,否则不要重新讨论之前的结论、计划或答案。
  • 并行工作时采用扇出模式。 对于独立读取任务(仓库调研、证据收集、逐选项研究、分领域审计)和独立验证(未编写变更的评审者),使用子Agent。写入操作按路径集保持单所有者且顺序执行。为每个子Agent明确目标、完成条件、约束、禁止事项和返回格式;在合并前验证每个子Agent的结果。仅当确实需要跨多个子Agent编排时,才使用Claude Code的
    Workflow
    工具;它成本很高。
  • 为每个子Agent选择模型等级;遵循路由配置。 如果运行框架或用户配置已经为子Agent配置了路由(Claude Code的
    CLAUDE_CODE_SUBAGENT_MODEL
    或CLAUDE.md规则;Codex的
    agents.default_subagent_model
    或角色的
    agents.<name>.config_file
    ;Cursor自定义子Agent的
    model:
    前置元数据),则遵循该配置,不要传递模型参数。否则:机械搜索或盘点→快速/低成本(Claude Code
    haiku
    );实现和证据收集→中等(
    sonnet
    );规划、评审、对抗性验证→顶级(
    opus
    或
    fable
    )。在Claude Code中,通过
    Agent
    工具的
    model
    参数或Agent前置元数据的
    model:
    设置;在Codex中,传递生成模型或在角色配置文件中设置
    model
    ;在Cursor中,在
    .cursor/agents/*.md
    中设置
    model:
    (默认
    inherit
    )。如果运行框架无法选择,子Agent继承父模型或由运行框架选择(Cursor内置的Explore/Bash/Browser子Agent会根据子任务选择);在状态说明中说明使用的模型。
  • 长时间运行时保留检查清单。 对于超过约五个步骤或跨技能的工作,在仓库根目录保留
    TASKS.md
    ,完成项目后打勾。除非仓库已经跟踪该文件,否则不要提交它。
  • 每次运行结束时包含三个标题。
    Blocked on me
    (一个真正的问题或阻塞,否则为“none”);
    Changed
    (文件、提交、GitHub对象、部署,否则为“nothing”);
    Found
    (证据、结论和
    Next: <确切的调用命令>
    )。

Commands

命令

CommandWhat it does
slap
Emergency: stop stupid agent behavior and safely drain a dumb/runaway workflow
analyze
Read-only autopsy of agent config, prompts, tools, traces, failure modes
optimize
Improve latency, cost, reliability, tool use, and loop quality — with a measured plan
design
Design an agent (roles, tools, memory, handoffs, evals) before coding
sub
/
sub-agents
Execute work via subagents (parallel/sequential Task agents) with a clear parent brief
help
/
library
List commands
Aliases:
subagents
→
sub
;
drain
/
stop
/
kill-loop
→ prefer
slap
when the situation is emergency thrash.
Target: path to agent config / skill / workflow, run ID, PR/issue, or free-text symptom (“it keeps rewriting the same file”).
命令功能
slap
紧急处理:终止异常Agent行为,安全排空失控/空转工作流
analyze
对Agent配置、提示词、工具、链路追踪、故障模式进行只读深度剖析
optimize
通过可衡量的计划,改善延迟、成本、可靠性、工具使用和循环质量
design
在编码前设计Agent(角色、工具、内存、交接、评估)
sub
/
sub-agents
通过子Agent(并行/顺序任务Agent)执行工作,父Agent提供明确的任务说明
help
/
library
列出所有命令
别名:
subagents
→
sub
;
drain
/
stop
/
kill-loop
→ 当情况为紧急抖动时优先使用
slap
。
目标:Agent配置/技能/工作流的路径、运行ID、PR/issue,或自由文本描述的症状(“它一直在重写同一个文件”)。

Routing

路由规则

  1. No argument: ask intent via the harness's structured question tool (Claude Code:
    AskUserQuestion
    ); options:
    slap
    (something on fire),
    analyze
    ,
    optimize
    ,
    design
    ,
    sub
    ,
    help
    .
  2. First word is a command: run it; remainder is target/context.
  3. Clear intent (“emergency stop this agent”, “design a code-review agent”, “use subagents to explore”): map and proceed.
  4. Active runaway loop / dumb workflow burning tokens: default to
    slap
    even if the user only said “fix the agents”.
Mutating production workflows, killing remote runs, or deleting agent state requires explicit approval unless the user already ordered that exact action. Prefer pause/drain over hard kill when both are possible.
  1. 无参数:通过运行框架的结构化提问工具询问意图(Claude Code:
    AskUserQuestion
    );选项:
    slap
    (紧急情况)、
    analyze
    、
    optimize
    、
    design
    、
    sub
    、
    help
    。
  2. 第一个词是命令:执行该命令;其余部分为目标/上下文。
  3. 意图明确(“紧急停止这个Agent”、“设计一个代码评审Agent”、“使用子Agent进行探索”):映射到对应命令并继续。
  4. 存在失控循环/空转工作流消耗token:即使用户只说“修复Agent”,也默认使用**
    slap
    **。
修改生产工作流、终止远程运行或删除Agent状态需要明确批准,除非用户已经明确要求该操作。如果暂停/排空和强制终止都可行时,优先选择暂停/排空。

slap
— emergency fix + safe drain

slap
— 紧急修复 + 安全排空

Use when an agent is thrashing, looping, spamming tools, rewriting the same files, ignoring instructions, or a durable/workflow run is producing junk. Follow references/slap.md.
Goals, in order:
  1. Stabilize — stop further damage (pause run, cancel queued steps, freeze writes).
  2. Drain — let in-flight safe work finish or abort cleanly; no orphan locks/partial deploys.
  3. Contain — revert or quarantine bad agent edits if they landed.
  4. Slap — name the stupid behavior in one blunt sentence + the smallest durable fix (prompt/guardrail/tool allowlist/max-steps).
  5. Handoff —
    analyze
    for root cause,
    optimize
    /
    design
    for lasting change,
    fix-it
    if product code broke.
Do not start a new mega-agent to “fix” the runaway. Parent stays in charge; subagents only for narrow read-only recon if needed.
当Agent出现抖动、循环、频繁调用工具、重写相同文件、忽略指令,或者持久化/工作流运行产生垃圾输出时使用。遵循references/slap.md。
目标按顺序如下:
  1. 稳定 — 阻止进一步损害(暂停运行、取消排队步骤、冻结写入)。
  2. 排空 — 让进行中的安全工作完成或干净地中止;不留孤儿锁/部分部署。
  3. 遏制 — 如果不良Agent编辑已经落地,则回滚或隔离这些编辑。
  4. slap
    — 用一句直白的话点明异常行为 + 最小的持久化修复方案(提示词/护栏/工具白名单/最大步骤数)。
  5. 交接 — 用
    analyze
    查找根本原因,用
    optimize
    /
    design
    进行持久化改进,如果产品代码损坏则用
    fix-it
    修复。
不要启动一个新的大型Agent来“修复”失控问题。父Agent保持掌控全局;仅在需要时使用子Agent进行有限的只读侦察。

analyze

analyze

Read-only. Produce:
  • Surface — what agent(s), which harness (Cursor Task, Codex, Trigger, custom), entry prompts/skills.
  • Behavior — observed loops, tool misuse, missing context, contradictory instructions.
  • Evidence — logs/traces/transcripts/run IDs; cite concrete steps.
  • Failure modes — ranked: loop, context rot, tool hallucination, scope creep, unsafe writes.
  • Verdict — keep / redesign / slap-then-optimize.
  • Next — exact follow-up (
    agents optimize …
    ,
    agents design …
    ,
    agents slap …
    ).
Details: references/analyze.md.
只读操作。输出内容:
  • 表层信息 — 涉及的Agent、运行框架(Cursor Task、Codex、Trigger、自定义)、入口提示词/技能。
  • 行为表现 — 观察到的循环、工具误用、上下文缺失、矛盾指令。
  • 证据 — 日志/链路追踪/对话记录/运行ID;引用具体步骤。
  • 故障模式 — 按优先级排序:循环、上下文腐烂、工具幻觉、范围蔓延、不安全写入。
  • 结论 — 保留 / 重新设计 / 先slap再优化。
  • 下一步 — 确切的后续操作(
    agents optimize …
    、
    agents design …
    、
    agents slap …
    )。
详情:references/analyze.md

optimize

optimize

Only after you know what is bad (
analyze
first unless the user already provided a sharp diagnosis). Propose a small numbered plan (prompt splits, tool narrowing, caching, evals, step limits, model routing). Implement in-repo prompt and config changes; ask only before production-workflow or paid changes. Prefer measurable wins (fewer steps, fewer retries, clearer success criteria).
Details: references/optimize.md.
仅在你知道问题所在后执行(除非用户已经提供了明确的诊断,否则先执行
analyze
)。提出一个小型的编号计划(提示词拆分、工具范围收窄、缓存、评估、步骤限制、模型路由)。实现仓库内的提示词和配置变更;仅在生产工作流或付费变更前询问。优先选择可衡量的改进(更少的步骤、更少的重试、更清晰的成功标准)。
详情:references/optimize.md

design

design

Architecture before code. Output a short design: goal, inputs/outputs, tools (allow/deny), memory, success criteria, failure/escalation, whether to use
sub
fan-out, eval plan. Scaffolding is a separate step — end with
Next: scaffold <name>
rather than asking. Prefer one sharp agent over a swarm.
Details: references/design.md.
先架构后编码。输出一份简短的设计:目标、输入/输出、工具(允许/拒绝)、内存、成功标准、故障/升级机制、是否使用
sub
扇出、评估计划。脚手架搭建是单独的步骤 — 以
Next: scaffold <name>
结束,而不是询问。优先选择一个精准的Agent,而非一群Agent。
详情:references/design.md

sub
/
sub-agents

sub
/
sub-agents

Parent agent orchestrates; children do bounded work. Follow references/sub.md.
Rules:
  • Write a crisp parent brief: goal, constraints, done-when, tools allowed, what not to do.
  • Prefer parallel explore/research children; keep write/mutate work sequential or single-owned.
  • Never give two subagents overlapping write ownership of the same files.
  • Verify each child’s result before consolidating; do not rubber-stamp contradictory child plans.
  • Aggregate verified results; parent decides.
  • If children thrash →
    slap
    , don’t spawn more.
父Agent编排;子Agent执行有边界的工作。遵循references/sub.md。
规则:
  • 编写清晰的父任务说明:目标、约束、完成条件、允许使用的工具、禁止事项。
  • 优先使用并行的探索/研究子Agent;写入/修改工作保持顺序执行或单所有者。
  • 永远不要给两个子Agent分配相同文件的重叠写入权限。
  • 在合并前验证每个子Agent的结果;不要直接批准相互矛盾的子Agent计划。
  • 汇总验证后的结果;由父Agent决定。
  • 如果子Agent出现抖动 → 执行**
    slap
    **,不要生成更多子Agent。

Output

输出

Close every run with:
Blocked on me: (production/paid change awaiting approval, or "none")
Changed: (files, config changes, GitHub objects, else "nothing")
Found: (analysis verdict, plan, or design). Next: `<exact follow-up invoke>`.
每次运行结束时输出:
Blocked on me: (production/paid change awaiting approval, or "none")
Changed: (files, config changes, GitHub objects, else "nothing")
Found: (analysis verdict, plan, or design). Next: `<exact follow-up invoke>`.

Related skills

相关技能

  • Product/backend bugs:
    diagnose-bug
    /
    troubleshoot-app
    /
    fix-it
    (do not use
    agents
    as the primary cut for deterministic compute or UI data-plane bugs)
  • Tests / evals as success criteria:
    test-it
    (regime C)
  • Traces/scores in prod:
    observe-it
    (Langfuse house default for LLM)
  • Docs for agents/humans:
    document-it
    (surgical)
  • Options before design:
    research-it
  • Repo situational awareness:
    recon
  • 产品/后端bug:
    diagnose-bug
    /
    troubleshoot-app
    /
    fix-it
    (对于确定性计算或UI数据平面bug,不要将
    agents
    作为主要手段)
  • 作为成功标准的测试/评估:
    test-it
    (质量模式C)
  • 生产环境的链路追踪/评分:
    observe-it
    (LLM默认使用Langfuse)
  • Agent/人类文档:
    document-it
    (精准式)
  • 设计前的选项调研:
    research-it
  • 仓库态势感知:
    recon

Grounding

基础依据

This skill’s TTPs are grounded in current engineering baselines (DORA, GitHub Docs, Fowler/Beck, Google SRE & SWE book, OpenTelemetry, OWASP LLM / NIST AI RMF, Diátaxis — see handbook
sources.md
).
Anthropic: keep agents simple and evaluable. OWASP LLM: bound tools/agency; NIST AI RMF: measure before optimize. Use
slap
to drain runaway loops (excessive agency). Parallel explore / sequential mutate for sub-agents. This is quality regime C — design for traces + evals (Langfuse house default), not unit-test theater (
handbook/concepts/11-quality-regimes.md
).
Handbook card:
handbook/practices/design-agents.md
.
本技能的TTP基于当前工程基线(DORA、GitHub Docs、Fowler/Beck、Google SRE与SWE书籍、OpenTelemetry、OWASP LLM / NIST AI RMF、Diátaxis — 参见手册
sources.md
)。
Anthropic原则:保持Agent简单且可评估。OWASP LLM原则:限制工具/代理权限;NIST AI RMF原则:先衡量再优化。使用
slap
排空失控循环(过度代理)。子Agent采用并行探索/顺序修改模式。这属于质量模式C — 为链路追踪+评估设计(默认使用Langfuse),而非单元测试形式主义(
handbook/concepts/11-quality-regimes.md
)。
手册卡片:
handbook/practices/design-agents.md
。