mcpField
W
write-goal

write-goal

github.com/petekpAgent 工作流4892 次安装2 天前更新
代码仓库

关于 write-goal

write-goal 会将用户请求整理为简洁、可验证的 Codex Goal,适用于持续多步任务。它明确结果、证据、约束、范围和迭代方式,除非用户要求,否则不启动 Goal。

主要功能

  1. 01判断任务是否适合设定 Goal
  2. 02起草可验证的 Codex Goal
  3. 03明确证据要求与范围约束
  4. 04提供审查及受阻时的停止规则

适用场景

  1. 01为多步编码工作设定完成标准
  2. 02为调试任务明确验证方式
  3. 03限定研究或审计任务的范围
  4. 04将模糊请求转为边界明确的目标

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/petekp/claude-code-setup --skill write-goal

安装后在 Claude Code 中输入/write-goal确认已加载。

附带文件agents/openai.yaml

详细介绍

编写 Goal

概述

将用户的请求转化为简洁的 Codex Goal,以便在证据表明工作完成之前持续推进。起草 Goal;除非用户明确要求开始或设置 Goal,否则不要激活它。

工作流

  1. 从触发此技能的提示中提取实际任务。忽略技能本身的提及。
  2. 判断是否适合使用 Goal。对于有明确可审计完成标准的长期、多步骤工作,使用 Goal。对于单行编辑、简单说明,或没有可验证终态的宽泛改进请求,说明普通提示更合适,并提供最贴近需求的精简提示。
  3. 起草一个 Goal,其中包含:
    • 结果:完成时必须满足的条件
    • 验证依据:能够证明结果的测试、命令、产物、日志、基准测试、源代码证据或审查结果
    • 约束:必须保持不变的行为、范围、公共 API、文件、风格、预算或安全限制
    • 边界:允许使用的仓库、文件、工具、数据和资源
    • 迭代策略:Codex 应如何根据每次结果选择下一步行动
    • 受阻时的停止条件:何时停止,以及需要报告哪些证据、尝试过的路径、阻碍和所需输入
  4. 在满足证据要求的前提下尽量精简。优先采用一段简洁文字。如果句子已经涵盖所有要点,就不要逐项列出。
  5. 默认加入对抗性审查循环,除非用户明确选择退出。
  6. 如果缺少必要细节,直接补充保守假设。仅当缺失信息会导致 Goal 不安全或无法验证时才提问。

任务适配

  • 编码或重构:说明目标行为或代码状态、相关测试或构建命令、范围边界,以及不得回归的内容。
  • 调试或不稳定测试:包含复现证据、重点验证、回归检查,以及缺少哪些证据会构成阻碍。
  • 研究或审计:要求列出主张清单、证据映射、置信度标签,并在最终报告中区分已确认、有依据但未确认、受阻和不确定的主张。
  • 文档或内容:说明产物、读者应获得的结果、事实来源核验、构建或链接检查,以及术语约束。
  • 宽泛请求:如果存在合理的证据依据,则通过明确假设缩小任务范围。如果没有,则提供经过精简的普通提示,而不是 Goal。
  • 一次性任务:不要勉强使用 Goal。说明普通提示更合适,并提供该提示。

审查循环

除非用户选择退出,否则默认采用:

Before completion, adversarially review the result against this Goal and classify findings by severity. Block completion only on critical and high findings, and resolve all of those. Run at most two review rounds: one to surface issues, one to verify the fixes. Complete when the load-bearing conclusion survives a round unchanged, even if detail-level findings remain. Batch any medium findings into a single final pass with no re-run, and report the rest as residuals rather than looping. Do not restart the round count on a fresh medium in supporting detail.

按对 Goal 的影响评估严重程度:

  • 严重或高:目标未达成、证据虚假或缺失、范围不安全,或结果可能违反明示约束。
  • 中:结果表面上可能通过,但在证据、范围、可维护性或面向用户的质量方面仍存在有意义的缺口。在最后一轮中解决中等问题;单凭中等问题不会阻止完成,也不会重新启动审查轮次。
  • 低:润色、措辞或不影响完成的可选改进。

Goal 格式

优先采用以下格式:

/goal <desired end state>, verified by <specific evidence>, while preserving <constraints>. Use <allowed inputs, tools, files, and boundaries>. Between iterations, <how to inspect results and choose the next best action>. Before completion, adversarially review the result against this Goal and resolve all critical and high findings; run at most two review rounds and complete once the core conclusion survives a round unchanged, reporting remaining medium and low findings as residuals rather than looping. If blocked or no defensible path remains, stop with the attempted paths, evidence gathered, unresolved findings, blocker, and next input needed.

Goal 应足够具体,便于审计,同时也要足够宽泛,让 Codex 自行选择下一步行动。除非用户已经指定,否则不要规定每一个实施步骤。

输出

返回:

  1. Recommended Goal:一个可直接使用的 /goal ... 代码块。
  2. Assumptions:仅在你补充了重要缺失信息时提供。
  3. Why This Works:仅在有用或用户要求时提供;用一两条简短要点说明证据依据和审查循环。

如果不适合使用 Goal,则返回:

  1. Better As A Prompt:一条精简的普通提示。
  2. Why Not A Goal:用一句话说明缺少持久目标或验证依据。

保持简洁。用户需要的是 Goal,而不是关于 Goal 的长篇说明。

示例

用户提示词:

Use $write-goal to turn this into a Goal: keep working on this flaky checkout test until it is fixed or we know exactly why it cannot be fixed.

输出:

推荐目标:

/goal Make the flaky checkout test pass reliably on the current branch, verified by reproducing the failure when possible and then passing the focused checkout test repeatedly plus the relevant correctness suite, while preserving public checkout behavior and existing test coverage. Use the checkout code, related fixtures, test logs, and local test commands. Between iterations, inspect the latest failure evidence, make the smallest defensible change, rerun focused verification, and update the hypothesis. Before completion, adversarially review the result against this Goal and resolve all critical and high findings; run at most two review rounds and complete once the fix is stable, reporting remaining medium and low findings as residuals rather than looping. If the failure cannot be reproduced or no valid path remains, stop with attempted reproductions, evidence gathered, unresolved findings, blocker, and the next input needed.

用户提示词:

Use $write-goal: improve the docs for Goals.

输出:

推荐目标:

/goal Produce a clearer Goals documentation page that explains when to use Goals, the command lifecycle, and two realistic examples, verified by the local docs build and by checking that every referenced command matches current Codex behavior, while preserving existing terminology and avoiding unrelated documentation churn. Use the existing docs, current CLI behavior, and related tests or build commands. Between iterations, compare the page against the intended reader workflow, patch the highest-impact gap, and rerun relevant verification. Before completion, adversarially review the result against this Goal and resolve all critical and high findings; run at most two review rounds and complete once the core conclusion survives a round unchanged, reporting remaining medium and low findings as residuals rather than looping. If verification cannot run or command behavior cannot be confirmed, stop with attempted checks, evidence gathered, unresolved findings, blocker, and the next input needed.

用户提示词:

Use $write-goal: explain this error message.

输出:

更适合作为提示词:

Explain this error message in plain English, identify the likely cause, and suggest the next command or file to inspect.

为什么不适合作为目标:这是一次性的解释请求,没有需要持续推进的长期目标。

评论

支持 Markdown