$npx -y skills add tt-a1i/matt-skills-with-to-goal --skill goal-crafterCraft verifiable, tight goal prompts for AI coding agents (Claude Code /goal, Codex Automations, Pi), either from a standalone task interview or from an already-approved to-goal handoff. Use when the user says "给我一个 goal 提示词", "帮我写个 goal", "设置一个自动化任务", "我想让 agent 自动做 X", or asks
| 1 | # Goal Crafter |
| 2 | |
| 3 | Turn a vague task into a **verifiable goal** that an AI agent can run unattended. |
| 4 | |
| 5 | **Leading principle**: A goal without a checkable completion criterion is just a wish. The agent must be able to answer "Am I done?" without asking a human. |
| 6 | |
| 7 | ## Invocation modes |
| 8 | |
| 9 | Choose the mode before following the process: |
| 10 | |
| 11 | - **Standalone mode**: the user brings a vague task or directly asks for a goal. Run Phase 1 and clarify the task one question at a time. |
| 12 | - **Compiled-handoff mode**: an upstream skill such as `to-goal` invokes this skill after `to-spec`, `to-tickets`, or `triage`. The approved spec, selected ticket, tracker evidence, and repository state supply the answers. **Do not interview the user again.** Apply only this skill's verifiability rules and target-harness formatting. |
| 13 | |
| 14 | In compiled-handoff mode, if a required product decision or completion condition is genuinely absent from the sources, report that the source is not agent-ready and name the missing evidence. Do not reopen the planning interview from inside goal compilation. |
| 15 | |
| 16 | ## Process |
| 17 | |
| 18 | ### Phase 1 — Clarify the task |
| 19 | |
| 20 | Run this phase only in standalone mode. In compiled-handoff mode, extract the five answers from the upstream evidence without asking questions. |
| 21 | |
| 22 | Ask the user, **one question at a time**: |
| 23 | |
| 24 | 1. **What exactly should the agent do?** |
| 25 | Get the task in one sentence. If it's vague ("优化代码", "改进 UI"), push for specifics. |
| 26 | |
| 27 | 2. **Where does it run?** |
| 28 | Which project / repo / workspace? Is there a specific branch or file area? |
| 29 | |
| 30 | 3. **What does DONE look like?** |
| 31 | This is the most important question. Push for **observable, machine-checkable** conditions: |
| 32 | |
| 33 | | ❌ Vague (bad) | ✅ Verifiable (good) | |
| 34 | |---|---| |
| 35 | | "代码质量提高" | "`tsc --noEmit` 0 errors + `eslint` 0 warnings" | |
| 36 | | "UI 更好看" | "页面在 375px / 768px / 1440px 三个断点下视觉一致,无溢出" | |
| 37 | | "修复所有 bug" | "`npm test` 全部通过,且 `git diff` 只包含修复相关改动" | |
| 38 | | "写好文档" | "README.md 包含安装/使用/API 三个章节,每个章节有代码示例" | |
| 39 | | "性能优化" | "Lighthouse Performance 分数 ≥ 90,LCP < 2.5s" | |
| 40 | |
| 41 | 4. **Any constraints?** |
| 42 | Don't touch certain files? Must use specific tools? Budget limit? Time limit? |
| 43 | |
| 44 | 5. **What agent / harness?** |
| 45 | Claude Code (`/goal`), Codex (Automations), Pi, or generic? |
| 46 | |
| 47 | **Phase 1 complete when** you have answers to all 5 questions. If the user can't answer #3, help them brainstorm verifiable conditions — this is the most common failure point. |
| 48 | |
| 49 | ### Phase 2 — Draft the goal |
| 50 | |
| 51 | Write the goal in the target agent's format. Follow these rules: |
| 52 | |
| 53 | **For Claude Code `/goal`**: |
| 54 | ``` |
| 55 | Goal: [one-line task description] |
| 56 | |
| 57 | Completion criteria: |
| 58 | - [ ] [checkable condition 1] |
| 59 | - [ ] [checkable condition 2] |
| 60 | - [ ] [checkable condition 3] |
| 61 | |
| 62 | Constraints: |
| 63 | - [file/area restrictions] |
| 64 | - [tool/approach restrictions] |
| 65 | - [budget/time limits] |
| 66 | |
| 67 | Context: |
| 68 | - [key files to read first] |
| 69 | - [relevant docs/specs] |
| 70 | - [related issues/PRs] |
| 71 | ``` |
| 72 | |
| 73 | **For Codex Automations**: |
| 74 | ``` |
| 75 | Task: [one-line description] |
| 76 | Frequency: [once / on push / on schedule] |
| 77 | Verification: [checkable condition] |
| 78 | Workspace: [project path] |
| 79 | ``` |
| 80 | |
| 81 | **For Pi / generic**: |
| 82 | ``` |
| 83 | 任务:[一句话] |
| 84 | 完成标准: |
| 85 | - [ ] [可验证条件 1] |
| 86 | - [ ] [可验证条件 2] |
| 87 | 限制:[约束条件] |
| 88 | ``` |
| 89 | |
| 90 | ### Phase 3 — Verify the goal |
| 91 | |
| 92 | Before presenting the final goal, **self-check**: |
| 93 | |
| 94 | - [ ] Can an agent read the completion criteria and unambiguously decide "done" vs "not done"? |
| 95 | - [ ] Is every criterion **observable** without human judgment? (No "looks good", "feels right") |
| 96 | - [ ] Are the constraints specific enough to prevent scope creep? |
| 97 | - [ ] Is the context sufficient for the agent to start working without asking "where" or "how"? |
| 98 | |
| 99 | If any check fails in standalone mode, go back to Phase 1 and ask the user to clarify that specific point. In compiled-handoff mode, report the source as not agent-ready and name the missing evidence instead of asking a new planning question. |
| 100 | |
| 101 | ### Phase 4 — Deliver |
| 102 | |
| 103 | In standalone mode, present the final goal and end with: |
| 104 | |
| 105 | > "把这个 goal 粘贴到 [agent 名称] 里,它就会自己跑到完成。如果中途卡住,告诉我哪条完成标准没达到,我帮你调。" |
| 106 | |
| 107 | In compiled-handoff mode, the upstream skill owns the delivery wrapper. Return the goal in the requested harness format without adding this standalone closing line. |
| 108 | |
| 109 | --- |
| 110 | |
| 111 | ## Examples |
| 112 | |
| 113 | ### Example 1: Code review automation |
| 114 | |
| 115 | **User**: "帮我写个 goal,自动审查 PR" |
| 116 | |
| 117 | **Clarified**: |
| 118 | - Task: 审查当前分支相对于 main 的所有改动 |
| 119 | - Where: hive-private 仓库 |
| 120 | - Done: 输出一份审查报告,列出所有 P0/P1 问题,每个问题标注文件和行号 |
| 121 | - Constraints: 只读,不改文件 |
| 122 | - Agent: Claude Code |
| 123 | |
| 124 | **Output**: |
| 125 | ``` |
| 126 | Goal: 审查当前分支相对于 origin/main 的 diff |
| 127 | |
| 128 | Completion criteria: |
| 129 | - [ ] 已读取完整的 git diff |
| 130 | - [ ] 已检查安全漏洞(SQL 注入、XSS、密钥泄露) |
| 131 | - [ ] 已检查逻辑错误(空指针、竞态条件、边界条件) |
| 132 | - [ ] 已检查代码规范(命名、结构、重复代 |