@hecer/yoke 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +494 -0
  3. package/canon/AGENTS.md +28 -0
  4. package/canon/context/DECISIONS.md +4 -0
  5. package/canon/context/KNOWLEDGE.md +4 -0
  6. package/canon/context/PROJECT.md +15 -0
  7. package/canon/loop/loop-spec.md +30 -0
  8. package/canon/loop/prd.schema.md +14 -0
  9. package/canon/manifest.yaml +47 -0
  10. package/canon/policy/gates.md +7 -0
  11. package/canon/policy/roles.md +9 -0
  12. package/canon/skills/ATTRIBUTION.md +71 -0
  13. package/canon/skills/authoring-prd/SKILL.md +44 -0
  14. package/canon/skills/brainstorming/SKILL.md +164 -0
  15. package/canon/skills/dispatching-parallel-agents/SKILL.md +182 -0
  16. package/canon/skills/document-release/SKILL.md +297 -0
  17. package/canon/skills/executing-plans/SKILL.md +70 -0
  18. package/canon/skills/finishing-a-development-branch/SKILL.md +200 -0
  19. package/canon/skills/health/SKILL.md +177 -0
  20. package/canon/skills/maintaining-context/SKILL.md +34 -0
  21. package/canon/skills/minimal-code/SKILL.md +21 -0
  22. package/canon/skills/plan-ceo-review/SKILL.md +541 -0
  23. package/canon/skills/plan-eng-review/SKILL.md +362 -0
  24. package/canon/skills/receiving-code-review/SKILL.md +213 -0
  25. package/canon/skills/requesting-code-review/SKILL.md +105 -0
  26. package/canon/skills/retro/SKILL.md +397 -0
  27. package/canon/skills/review/SKILL.md +246 -0
  28. package/canon/skills/ship/SKILL.md +696 -0
  29. package/canon/skills/subagent-driven-development/SKILL.md +277 -0
  30. package/canon/skills/systematic-debugging/SKILL.md +296 -0
  31. package/canon/skills/tdd/SKILL.md +371 -0
  32. package/canon/skills/unslop-ui/SKILL.md +34 -0
  33. package/canon/skills/using-git-worktrees/SKILL.md +218 -0
  34. package/canon/skills/verification-before-completion/SKILL.md +139 -0
  35. package/canon/skills/visual-verification/SKILL.md +54 -0
  36. package/canon/skills/workflow/SKILL.md +18 -0
  37. package/canon/skills/writing-plans/SKILL.md +152 -0
  38. package/canon/skills/writing-skills/SKILL.md +655 -0
  39. package/canon/skills/yoke-retrofit/SKILL.md +18 -0
  40. package/canon/tools/graphify.md +3 -0
  41. package/canon/tools/playwright-mcp.md +3 -0
  42. package/canon/tools/rtk.md +7 -0
  43. package/canon/tools/serena.md +7 -0
  44. package/dist/canon/frontmatter.js +10 -0
  45. package/dist/canon/manifest.js +26 -0
  46. package/dist/canon/validate.js +73 -0
  47. package/dist/cli.js +244 -0
  48. package/dist/context/command.js +33 -0
  49. package/dist/context/context.js +57 -0
  50. package/dist/loop/cleanup.js +42 -0
  51. package/dist/loop/gates.js +12 -0
  52. package/dist/loop/git.js +25 -0
  53. package/dist/loop/lock.js +45 -0
  54. package/dist/loop/loop.js +190 -0
  55. package/dist/loop/prd.js +29 -0
  56. package/dist/loop/reporter.js +91 -0
  57. package/dist/loop/run-command.js +134 -0
  58. package/dist/loop/runner.js +157 -0
  59. package/dist/loop/verify.js +38 -0
  60. package/dist/loop/watchdog.js +86 -0
  61. package/dist/new/command.js +53 -0
  62. package/dist/prd/command.js +129 -0
  63. package/dist/retrofit/apply.js +54 -0
  64. package/dist/retrofit/canon-dir.js +22 -0
  65. package/dist/retrofit/command.js +37 -0
  66. package/dist/retrofit/config.js +53 -0
  67. package/dist/retrofit/context-actions.js +21 -0
  68. package/dist/retrofit/detect.js +17 -0
  69. package/dist/retrofit/gitignore.js +26 -0
  70. package/dist/retrofit/gstack.js +19 -0
  71. package/dist/retrofit/merge-json.js +38 -0
  72. package/dist/retrofit/plan.js +29 -0
  73. package/dist/retrofit/planners/claude.js +67 -0
  74. package/dist/retrofit/planners/codex.js +36 -0
  75. package/dist/retrofit/planners/gemini.js +54 -0
  76. package/dist/retrofit/report.js +14 -0
  77. package/dist/retrofit/tools.js +23 -0
  78. package/dist/retrofit/wsl.js +15 -0
  79. package/dist/review/command.js +43 -0
  80. package/dist/scan/design.js +79 -0
  81. package/dist/smoke/command.js +141 -0
  82. package/package.json +61 -0
@@ -0,0 +1,297 @@
1
+ ---
2
+ name: document-release
3
+ description: |
4
+ Post-ship documentation update. Runs after ship (code committed, PR exists) but before
5
+ the PR merges. Updates every documentation file to reflect the changes in the diff:
6
+ README, CHANGELOG, ARCHITECTURE, CONTRIBUTING, TODOS.md, VERSION.
7
+ Use when asked to "update docs", "document the release", or "update the changelog".
8
+ triggers:
9
+ - update docs
10
+ - document the release
11
+ - update the changelog
12
+ - document-release
13
+ ---
14
+
15
+ # Document Release: Post-Ship Documentation Update
16
+
17
+ You are running the `document-release` workflow. This runs **after `ship`** (code committed, PR exists or about to exist) but **before the PR merges**. Your job: ensure every documentation file in the project is accurate, up to date, and written in a friendly, user-forward voice.
18
+
19
+ You are mostly automated. Make obvious factual updates directly. Stop and ask only for risky or subjective decisions.
20
+
21
+ **Only stop for:**
22
+ - Risky/questionable doc changes (narrative, philosophy, security, removals, large rewrites)
23
+ - VERSION bump decision (if not already bumped)
24
+ - New TODOS items to add
25
+ - Cross-doc contradictions that are narrative (not factual)
26
+
27
+ **Never stop for:**
28
+ - Factual corrections clearly from the diff
29
+ - Adding items to tables/lists
30
+ - Updating paths, counts, version numbers
31
+ - Fixing stale cross-references
32
+ - CHANGELOG voice polish (minor wording adjustments)
33
+ - Marking TODOS complete
34
+ - Cross-doc factual inconsistencies (e.g., version number mismatch)
35
+
36
+ **NEVER do:**
37
+ - Overwrite, replace, or regenerate CHANGELOG entries — polish wording only, preserve all content
38
+ - Bump VERSION without asking — always use AskUserQuestion for version changes
39
+ - Use `Write` tool on CHANGELOG.md — always use `Edit` with exact `old_string` matches
40
+
41
+ ---
42
+
43
+ ## Step 0: Detect platform and base branch
44
+
45
+ Detect the git hosting platform from the remote URL:
46
+
47
+ ```bash
48
+ git remote get-url origin 2>/dev/null
49
+ ```
50
+
51
+ - URL contains "github.com" → platform is **GitHub**
52
+ - URL contains "gitlab" → platform is **GitLab**
53
+ - Otherwise check: `gh auth status 2>/dev/null` → GitHub; `glab auth status 2>/dev/null` → GitLab
54
+
55
+ Determine the base branch (target of the PR, or the repo's default):
56
+
57
+ - GitHub: `gh pr view --json baseRefName -q .baseRefName` or `gh repo view --json defaultBranchRef -q .defaultBranchRef.name`
58
+ - GitLab: `glab mr view -F json 2>/dev/null` → extract `target_branch`
59
+ - Fallback: `git symbolic-ref refs/remotes/origin/HEAD`, then `main`, then `master`
60
+
61
+ Use it as `<base>` in all subsequent commands.
62
+
63
+ ---
64
+
65
+ ## Step 1: Pre-flight & Diff Analysis
66
+
67
+ 1. Check the current branch. If on the base branch, **abort**: "You're on the base branch. Run from a feature branch."
68
+
69
+ 2. Gather context about what changed:
70
+
71
+ ```bash
72
+ git diff <base>...HEAD --stat
73
+ git log <base>..HEAD --oneline
74
+ git diff <base>...HEAD --name-only
75
+ ```
76
+
77
+ 3. Discover all documentation files in the repo:
78
+
79
+ ```bash
80
+ find . -maxdepth 2 -name "*.md" -not -path "./.git/*" -not -path "./node_modules/*" -not -path "./.context/*" | sort
81
+ ```
82
+
83
+ 4. Classify the changes into categories relevant to documentation:
84
+ - **New features** — new files, new commands, new skills, new capabilities
85
+ - **Changed behavior** — modified services, updated APIs, config changes
86
+ - **Removed functionality** — deleted files, removed commands
87
+ - **Infrastructure** — build system, test infrastructure, CI
88
+
89
+ 5. Output a brief summary: "Analyzing N files changed across M commits. Found K documentation files to review."
90
+
91
+ ---
92
+
93
+ ## Step 2: Per-File Documentation Audit
94
+
95
+ Read each documentation file and cross-reference it against the diff:
96
+
97
+ **README.md:**
98
+ - Does it describe all features and capabilities visible in the diff?
99
+ - Are install/setup instructions consistent with the changes?
100
+ - Are examples, demos, and usage descriptions still valid?
101
+ - Are troubleshooting steps still accurate?
102
+
103
+ **ARCHITECTURE.md:**
104
+ - Do ASCII diagrams and component descriptions match the current code?
105
+ - Are design decisions and "why" explanations still accurate?
106
+ - Be conservative — only update things clearly contradicted by the diff. Architecture docs describe things unlikely to change frequently.
107
+
108
+ **CONTRIBUTING.md — New contributor smoke test:**
109
+ - Walk through the setup instructions as if you are a brand new contributor.
110
+ - Are the listed commands accurate? Would each step succeed?
111
+ - Do test tier descriptions match the current test infrastructure?
112
+ - Are workflow descriptions (dev setup, build steps, etc.) current?
113
+ - Flag anything that would fail or confuse a first-time contributor.
114
+
115
+ **CLAUDE.md / project instructions:**
116
+ - Does the project structure section match the actual file tree?
117
+ - Are listed commands and scripts accurate?
118
+ - Do build/test instructions match what's in package.json (or equivalent)?
119
+
120
+ **Any other .md files:**
121
+ - Read the file, determine its purpose and audience.
122
+ - Cross-reference against the diff to check if it contradicts anything the file says.
123
+
124
+ For each file, classify needed updates as:
125
+
126
+ - **Auto-update** — Factual corrections clearly warranted by the diff: adding an item to a table, updating a file path, fixing a count, updating a project structure tree.
127
+ - **Ask user** — Narrative changes, section removal, security model changes, large rewrites (more than ~10 lines in one section), ambiguous relevance, adding entirely new sections.
128
+
129
+ ---
130
+
131
+ ## Step 3: Apply Auto-Updates
132
+
133
+ Make all clear, factual updates directly using the Edit tool.
134
+
135
+ For each file modified, output a one-line summary describing **what specifically changed** — not just "Updated README.md" but "README.md: added /new-skill to skills table, updated skill count from 9 to 10."
136
+
137
+ **Never auto-update:**
138
+ - README introduction or project positioning
139
+ - ARCHITECTURE philosophy or design rationale
140
+ - Security model descriptions
141
+ - Do not remove entire sections from any document
142
+
143
+ ---
144
+
145
+ ## Step 4: Ask About Risky/Questionable Changes
146
+
147
+ For each risky or questionable update identified in Step 2, use AskUserQuestion with:
148
+ - Context: project name, branch, which doc file, what we're reviewing
149
+ - The specific documentation decision
150
+ - `RECOMMENDATION: Choose [X] because [one-line reason]`
151
+ - Options including C) Skip — leave as-is
152
+
153
+ Apply approved changes immediately after each answer.
154
+
155
+ ---
156
+
157
+ ## Step 5: CHANGELOG Voice Polish
158
+
159
+ **CRITICAL — NEVER CLOBBER CHANGELOG ENTRIES.**
160
+
161
+ This step polishes voice. It does NOT rewrite, replace, or regenerate CHANGELOG content.
162
+
163
+ **Rules:**
164
+ 1. Read the entire CHANGELOG.md first. Understand what is already there.
165
+ 2. Only modify wording within existing entries. Never delete, reorder, or replace entries.
166
+ 3. Never regenerate a CHANGELOG entry from scratch. The entry was written by `ship` from the actual diff and commit history. It is the source of truth. You are polishing prose, not rewriting history.
167
+ 4. If an entry looks wrong or incomplete, use AskUserQuestion — do NOT silently fix it.
168
+ 5. Use Edit tool with exact `old_string` matches — never use Write to overwrite CHANGELOG.md.
169
+
170
+ **If CHANGELOG was not modified in this branch:** skip this step.
171
+
172
+ **If CHANGELOG was modified in this branch**, review the entry for voice:
173
+
174
+ - **Sell test:** Would a user reading each bullet think "oh nice, I want to try that"? If not, rewrite the wording (not the content).
175
+ - Lead with what the user can now **do** — not implementation details.
176
+ - "You can now..." not "Refactored the..."
177
+ - Flag and rewrite any entry that reads like a commit message.
178
+ - Internal/contributor changes belong in a separate "### For contributors" subsection.
179
+ - Auto-fix minor voice adjustments. Use AskUserQuestion if a rewrite would alter meaning.
180
+
181
+ ---
182
+
183
+ ## Step 6: Cross-Doc Consistency & Discoverability Check
184
+
185
+ After auditing each file individually, do a cross-doc consistency pass:
186
+
187
+ 1. Does the README's feature/capability list match what CLAUDE.md (or project instructions) describes?
188
+ 2. Does ARCHITECTURE's component list match CONTRIBUTING's project structure description?
189
+ 3. Does CHANGELOG's latest version match the VERSION file?
190
+ 4. **Discoverability:** Is every documentation file reachable from README.md or CLAUDE.md? If ARCHITECTURE.md exists but neither README nor CLAUDE.md links to it, flag it.
191
+ 5. Flag any contradictions between documents. Auto-fix clear factual inconsistencies (e.g., a version mismatch). Use AskUserQuestion for narrative contradictions.
192
+
193
+ ---
194
+
195
+ ## Step 7: TODOS.md Cleanup
196
+
197
+ If TODOS.md does not exist, skip this step.
198
+
199
+ 1. **Completed items not yet marked:** Cross-reference the diff against open TODO items. If a TODO is clearly completed by the changes in this branch, move it to the Completed section with `**Completed:** vX.Y.Z (YYYY-MM-DD)`. Be conservative — only mark items with clear evidence in the diff.
200
+
201
+ 2. **Items needing description updates:** If a TODO references files or components that were significantly changed, its description may be stale. Use AskUserQuestion to confirm whether the TODO should be updated, completed, or left as-is.
202
+
203
+ 3. **New deferred work:** Check the diff for `TODO`, `FIXME`, `HACK`, and `XXX` comments. For each one that represents meaningful deferred work (not a trivial inline note), use AskUserQuestion to ask whether it should be captured in TODOS.md.
204
+
205
+ ---
206
+
207
+ ## Step 8: VERSION Bump Question
208
+
209
+ **CRITICAL — NEVER BUMP VERSION WITHOUT ASKING.**
210
+
211
+ 1. **If VERSION does not exist:** Skip silently.
212
+
213
+ 2. Check if VERSION was already modified on this branch:
214
+
215
+ ```bash
216
+ git diff <base>...HEAD -- VERSION
217
+ ```
218
+
219
+ 3. **If VERSION was NOT bumped:** Use AskUserQuestion:
220
+ - RECOMMENDATION: Choose C (Skip) because docs-only changes rarely warrant a version bump
221
+ - A) Bump PATCH (X.Y.Z+1) — if doc changes ship alongside code changes
222
+ - B) Bump MINOR (X.Y+1.0) — if this is a significant standalone release
223
+ - C) Skip — no version bump needed
224
+
225
+ 4. **If VERSION was already bumped:** Check whether the bump still covers the full scope of changes on this branch:
226
+ a. Read the CHANGELOG entry for the current VERSION. What features does it describe?
227
+ b. Read the full diff. Are there significant changes NOT mentioned in the CHANGELOG entry for the current version?
228
+ c. **If the CHANGELOG entry covers everything:** Skip — output "VERSION: Already bumped to vX.Y.Z, covers all changes."
229
+ d. **If there are significant uncovered changes:** Use AskUserQuestion explaining what the current version covers vs what's new, and ask whether to bump to next patch or add changes to the existing entry.
230
+
231
+ ---
232
+
233
+ ## Step 9: Commit & Output
234
+
235
+ **Empty check first:** Run `git status` (never use `-uall`). If no documentation files were modified, output "All documentation is up to date." and exit without committing.
236
+
237
+ **Commit:**
238
+
239
+ 1. Stage modified documentation files by name (never `git add -A` or `git add .`).
240
+ 2. Create a single commit:
241
+
242
+ ```bash
243
+ git commit -m "docs: update project documentation for vX.Y.Z"
244
+ ```
245
+
246
+ 3. Push to the current branch:
247
+
248
+ ```bash
249
+ git push
250
+ ```
251
+
252
+ **PR/MR body update (idempotent, race-safe):**
253
+
254
+ 1. Read the existing PR/MR body (use the platform detected in Step 0):
255
+ - GitHub: `gh pr view --json body -q .body`
256
+ - GitLab: `glab mr view -F json | python3 -c "import sys,json; print(json.load(sys.stdin).get('description',''))"`
257
+
258
+ 2. If the body already contains a `## Documentation` section, replace that section with updated content. If not, append a `## Documentation` section at the end.
259
+
260
+ 3. The Documentation section should include a **doc diff preview** — for each file modified, describe what specifically changed.
261
+
262
+ 4. Write the updated body back:
263
+ - GitHub: `gh pr edit --body "..."`
264
+ - GitLab: `glab mr update -d "..."`
265
+
266
+ 5. If no PR/MR exists: skip with message "No PR/MR found — skipping body update."
267
+
268
+ **Structured doc health summary (final output):**
269
+
270
+ ```
271
+ Documentation health:
272
+ README.md [status] ([details])
273
+ ARCHITECTURE.md [status] ([details])
274
+ CONTRIBUTING.md [status] ([details])
275
+ CHANGELOG.md [status] ([details])
276
+ TODOS.md [status] ([details])
277
+ VERSION [status] ([details])
278
+ ```
279
+
280
+ Where status is one of:
281
+ - Updated — with description of what changed
282
+ - Current — no changes needed
283
+ - Voice polished — wording adjusted
284
+ - Not bumped — user chose to skip
285
+ - Already bumped — version was set by ship
286
+ - Skipped — file does not exist
287
+
288
+ ---
289
+
290
+ ## Important Rules
291
+
292
+ - **Read before editing.** Always read the full content of a file before modifying it.
293
+ - **Never clobber CHANGELOG.** Polish wording only. Never delete, replace, or regenerate entries.
294
+ - **Never bump VERSION silently.** Always ask.
295
+ - **Be explicit about what changed.** Every edit gets a one-line summary.
296
+ - **Discoverability matters.** Every doc file should be reachable from README or CLAUDE.md.
297
+ - **Voice: friendly, user-forward.** Write like you're explaining to a smart person who hasn't seen the code.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: executing-plans
3
+ description: Use when you have a written implementation plan to execute in a separate session with review checkpoints
4
+ ---
5
+
6
+ # Executing Plans
7
+
8
+ ## Overview
9
+
10
+ Load plan, review critically, execute all tasks, report when complete.
11
+
12
+ **Announce at start:** "I'm using the executing-plans skill to implement this plan."
13
+
14
+ **Note:** Tell your human partner that Superpowers works much better with access to subagents. The quality of its work will be significantly higher if run on a platform with subagent support (such as Claude Code or Codex). If subagents are available, use superpowers:subagent-driven-development instead of this skill.
15
+
16
+ ## The Process
17
+
18
+ ### Step 1: Load and Review Plan
19
+ 1. Read plan file
20
+ 2. Review critically - identify any questions or concerns about the plan
21
+ 3. If concerns: Raise them with your human partner before starting
22
+ 4. If no concerns: Create TodoWrite and proceed
23
+
24
+ ### Step 2: Execute Tasks
25
+
26
+ For each task:
27
+ 1. Mark as in_progress
28
+ 2. Follow each step exactly (plan has bite-sized steps)
29
+ 3. Run verifications as specified
30
+ 4. Mark as completed
31
+
32
+ ### Step 3: Complete Development
33
+
34
+ After all tasks complete and verified:
35
+ - Announce: "I'm using the finishing-a-development-branch skill to complete this work."
36
+ - **REQUIRED SUB-SKILL:** Use superpowers:finishing-a-development-branch
37
+ - Follow that skill to verify tests, present options, execute choice
38
+
39
+ ## When to Stop and Ask for Help
40
+
41
+ **STOP executing immediately when:**
42
+ - Hit a blocker (missing dependency, test fails, instruction unclear)
43
+ - Plan has critical gaps preventing starting
44
+ - You don't understand an instruction
45
+ - Verification fails repeatedly
46
+
47
+ **Ask for clarification rather than guessing.**
48
+
49
+ ## When to Revisit Earlier Steps
50
+
51
+ **Return to Review (Step 1) when:**
52
+ - Partner updates the plan based on your feedback
53
+ - Fundamental approach needs rethinking
54
+
55
+ **Don't force through blockers** - stop and ask.
56
+
57
+ ## Remember
58
+ - Review plan critically first
59
+ - Follow plan steps exactly
60
+ - Don't skip verifications
61
+ - Reference skills when plan says to
62
+ - Stop when blocked, don't guess
63
+ - Never start implementation on main/master branch without explicit user consent
64
+
65
+ ## Integration
66
+
67
+ **Required workflow skills:**
68
+ - **superpowers:using-git-worktrees** - REQUIRED: Set up isolated workspace before starting
69
+ - **superpowers:writing-plans** - Creates the plan this skill executes
70
+ - **superpowers:finishing-a-development-branch** - Complete development after all tasks
@@ -0,0 +1,200 @@
1
+ ---
2
+ name: finishing-a-development-branch
3
+ description: Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
4
+ ---
5
+
6
+ # Finishing a Development Branch
7
+
8
+ ## Overview
9
+
10
+ Guide completion of development work by presenting clear options and handling chosen workflow.
11
+
12
+ **Core principle:** Verify tests → Present options → Execute choice → Clean up.
13
+
14
+ **Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work."
15
+
16
+ ## The Process
17
+
18
+ ### Step 1: Verify Tests
19
+
20
+ **Before presenting options, verify tests pass:**
21
+
22
+ ```bash
23
+ # Run project's test suite
24
+ npm test / cargo test / pytest / go test ./...
25
+ ```
26
+
27
+ **If tests fail:**
28
+ ```
29
+ Tests failing (<N> failures). Must fix before completing:
30
+
31
+ [Show failures]
32
+
33
+ Cannot proceed with merge/PR until tests pass.
34
+ ```
35
+
36
+ Stop. Don't proceed to Step 2.
37
+
38
+ **If tests pass:** Continue to Step 2.
39
+
40
+ ### Step 2: Determine Base Branch
41
+
42
+ ```bash
43
+ # Try common base branches
44
+ git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
45
+ ```
46
+
47
+ Or ask: "This branch split from main - is that correct?"
48
+
49
+ ### Step 3: Present Options
50
+
51
+ Present exactly these 4 options:
52
+
53
+ ```
54
+ Implementation complete. What would you like to do?
55
+
56
+ 1. Merge back to <base-branch> locally
57
+ 2. Push and create a Pull Request
58
+ 3. Keep the branch as-is (I'll handle it later)
59
+ 4. Discard this work
60
+
61
+ Which option?
62
+ ```
63
+
64
+ **Don't add explanation** - keep options concise.
65
+
66
+ ### Step 4: Execute Choice
67
+
68
+ #### Option 1: Merge Locally
69
+
70
+ ```bash
71
+ # Switch to base branch
72
+ git checkout <base-branch>
73
+
74
+ # Pull latest
75
+ git pull
76
+
77
+ # Merge feature branch
78
+ git merge <feature-branch>
79
+
80
+ # Verify tests on merged result
81
+ <test command>
82
+
83
+ # If tests pass
84
+ git branch -d <feature-branch>
85
+ ```
86
+
87
+ Then: Cleanup worktree (Step 5)
88
+
89
+ #### Option 2: Push and Create PR
90
+
91
+ ```bash
92
+ # Push branch
93
+ git push -u origin <feature-branch>
94
+
95
+ # Create PR
96
+ gh pr create --title "<title>" --body "$(cat <<'EOF'
97
+ ## Summary
98
+ <2-3 bullets of what changed>
99
+
100
+ ## Test Plan
101
+ - [ ] <verification steps>
102
+ EOF
103
+ )"
104
+ ```
105
+
106
+ Then: Cleanup worktree (Step 5)
107
+
108
+ #### Option 3: Keep As-Is
109
+
110
+ Report: "Keeping branch <name>. Worktree preserved at <path>."
111
+
112
+ **Don't cleanup worktree.**
113
+
114
+ #### Option 4: Discard
115
+
116
+ **Confirm first:**
117
+ ```
118
+ This will permanently delete:
119
+ - Branch <name>
120
+ - All commits: <commit-list>
121
+ - Worktree at <path>
122
+
123
+ Type 'discard' to confirm.
124
+ ```
125
+
126
+ Wait for exact confirmation.
127
+
128
+ If confirmed:
129
+ ```bash
130
+ git checkout <base-branch>
131
+ git branch -D <feature-branch>
132
+ ```
133
+
134
+ Then: Cleanup worktree (Step 5)
135
+
136
+ ### Step 5: Cleanup Worktree
137
+
138
+ **For Options 1, 2, 4:**
139
+
140
+ Check if in worktree:
141
+ ```bash
142
+ git worktree list | grep $(git branch --show-current)
143
+ ```
144
+
145
+ If yes:
146
+ ```bash
147
+ git worktree remove <worktree-path>
148
+ ```
149
+
150
+ **For Option 3:** Keep worktree.
151
+
152
+ ## Quick Reference
153
+
154
+ | Option | Merge | Push | Keep Worktree | Cleanup Branch |
155
+ |--------|-------|------|---------------|----------------|
156
+ | 1. Merge locally | ✓ | - | - | ✓ |
157
+ | 2. Create PR | - | ✓ | ✓ | - |
158
+ | 3. Keep as-is | - | - | ✓ | - |
159
+ | 4. Discard | - | - | - | ✓ (force) |
160
+
161
+ ## Common Mistakes
162
+
163
+ **Skipping test verification**
164
+ - **Problem:** Merge broken code, create failing PR
165
+ - **Fix:** Always verify tests before offering options
166
+
167
+ **Open-ended questions**
168
+ - **Problem:** "What should I do next?" → ambiguous
169
+ - **Fix:** Present exactly 4 structured options
170
+
171
+ **Automatic worktree cleanup**
172
+ - **Problem:** Remove worktree when might need it (Option 2, 3)
173
+ - **Fix:** Only cleanup for Options 1 and 4
174
+
175
+ **No confirmation for discard**
176
+ - **Problem:** Accidentally delete work
177
+ - **Fix:** Require typed "discard" confirmation
178
+
179
+ ## Red Flags
180
+
181
+ **Never:**
182
+ - Proceed with failing tests
183
+ - Merge without verifying tests on result
184
+ - Delete work without confirmation
185
+ - Force-push without explicit request
186
+
187
+ **Always:**
188
+ - Verify tests before offering options
189
+ - Present exactly 4 options
190
+ - Get typed confirmation for Option 4
191
+ - Clean up worktree for Options 1 & 4 only
192
+
193
+ ## Integration
194
+
195
+ **Called by:**
196
+ - **subagent-driven-development** (Step 7) - After all tasks complete
197
+ - **executing-plans** (Step 5) - After all batches complete
198
+
199
+ **Pairs with:**
200
+ - **using-git-worktrees** - Cleans up worktree created by that skill