@hecer/yoke 1.5.1 → 1.6.1

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 (129) hide show
  1. package/.claude-plugin/plugin.json +13 -13
  2. package/.codex-plugin/plugin.json +7 -7
  3. package/CHANGELOG.md +280 -259
  4. package/README.md +855 -834
  5. package/TODOS.md +5 -5
  6. package/agents/docs.toml +6 -6
  7. package/agents/implementer.toml +6 -6
  8. package/agents/reviewer.toml +6 -6
  9. package/agents/security.toml +6 -6
  10. package/bench/README.md +86 -86
  11. package/bench/RESULTS.md +35 -35
  12. package/bench/output-compaction.mjs +65 -65
  13. package/bench/result-schema.mjs +12 -12
  14. package/bench/results/claude-2026-07-27T18-03-26.json +50 -50
  15. package/bench/results/codex-unavailable-1785175418318.json +15 -15
  16. package/bench/results/gemini-2026-07-27T18-03-44.json +46 -46
  17. package/bench/run-matrix.mjs +26 -26
  18. package/bench/run.mjs +106 -106
  19. package/canon/AGENTS.md +30 -30
  20. package/canon/context/DECISIONS.md +4 -4
  21. package/canon/context/GLOSSARY.md +11 -0
  22. package/canon/context/KNOWLEDGE.md +4 -4
  23. package/canon/context/PROJECT.md +15 -15
  24. package/canon/loop/loop-spec.md +65 -65
  25. package/canon/loop/prd.schema.md +43 -43
  26. package/canon/manifest.yaml +59 -53
  27. package/canon/policy/gates.md +7 -7
  28. package/canon/policy/roles.md +9 -9
  29. package/canon/skills/ATTRIBUTION.md +99 -71
  30. package/canon/skills/authoring-prd/SKILL.md +58 -58
  31. package/canon/skills/brainstorming/SKILL.md +164 -164
  32. package/canon/skills/codebase-design/DEEPENING.md +15 -0
  33. package/canon/skills/codebase-design/DESIGN-IT-TWICE.md +12 -0
  34. package/canon/skills/codebase-design/SKILL.md +39 -0
  35. package/canon/skills/dispatching-parallel-agents/SKILL.md +182 -182
  36. package/canon/skills/document-release/SKILL.md +302 -297
  37. package/canon/skills/domain-modeling/ADR-FORMAT.md +19 -0
  38. package/canon/skills/domain-modeling/CONTEXT-FORMAT.md +39 -0
  39. package/canon/skills/domain-modeling/SKILL.md +35 -0
  40. package/canon/skills/executing-plans/SKILL.md +70 -70
  41. package/canon/skills/finishing-a-development-branch/SKILL.md +200 -200
  42. package/canon/skills/health/SKILL.md +177 -177
  43. package/canon/skills/maintaining-context/SKILL.md +34 -34
  44. package/canon/skills/minimal-code/SKILL.md +21 -21
  45. package/canon/skills/no-ai-slop/SKILL.md +103 -0
  46. package/canon/skills/no-ai-slop/eval.md +43 -0
  47. package/canon/skills/plan-ceo-review/SKILL.md +541 -541
  48. package/canon/skills/plan-eng-review/SKILL.md +362 -362
  49. package/canon/skills/receiving-code-review/SKILL.md +213 -213
  50. package/canon/skills/requesting-code-review/SKILL.md +105 -105
  51. package/canon/skills/resolving-merge-conflicts/SKILL.md +18 -0
  52. package/canon/skills/retro/SKILL.md +397 -397
  53. package/canon/skills/review/SKILL.md +246 -246
  54. package/canon/skills/ship/SKILL.md +691 -691
  55. package/canon/skills/subagent-driven-development/SKILL.md +277 -277
  56. package/canon/skills/systematic-debugging/SKILL.md +296 -296
  57. package/canon/skills/tdd/SKILL.md +371 -371
  58. package/canon/skills/unslop-ui/SKILL.md +34 -34
  59. package/canon/skills/using-git-worktrees/SKILL.md +218 -218
  60. package/canon/skills/verification-before-completion/SKILL.md +139 -139
  61. package/canon/skills/visual-verification/SKILL.md +54 -54
  62. package/canon/skills/workflow/SKILL.md +22 -22
  63. package/canon/skills/writing-for-agents/SKILL-MECHANICS.md +27 -0
  64. package/canon/skills/writing-for-agents/SKILL.md +42 -0
  65. package/canon/skills/writing-plans/SKILL.md +152 -152
  66. package/canon/skills/writing-skills/SKILL.md +655 -655
  67. package/canon/skills/yoke-retrofit/SKILL.md +26 -26
  68. package/canon/skills/yoke-workflow/SKILL.md +20 -20
  69. package/canon/tools/codex-rtk-hook.mjs +35 -35
  70. package/canon/tools/graphify.md +3 -3
  71. package/canon/tools/playwright-mcp.md +3 -3
  72. package/canon/tools/rtk.md +7 -7
  73. package/canon/tools/serena.md +6 -6
  74. package/dist/agents/process.js +3 -0
  75. package/dist/canon/manifest.js +2 -0
  76. package/dist/canon/skill-package.js +113 -0
  77. package/dist/canon/validate.js +16 -1
  78. package/dist/context/command.js +4 -1
  79. package/dist/context/context.js +6 -0
  80. package/dist/loop/dispatcher.js +1 -1
  81. package/dist/loop/loop.js +26 -0
  82. package/dist/loop/parallel-command.js +3 -0
  83. package/dist/loop/run-command.js +11 -0
  84. package/dist/loop/watchdog.js +28 -11
  85. package/dist/loop/worker.js +11 -0
  86. package/dist/prd/command.js +17 -17
  87. package/dist/retrofit/apply.js +22 -7
  88. package/dist/retrofit/command.js +4 -1
  89. package/dist/retrofit/config.js +4 -0
  90. package/dist/retrofit/context-actions.js +1 -1
  91. package/dist/retrofit/detect.js +2 -0
  92. package/dist/retrofit/planners/claude.js +16 -20
  93. package/dist/retrofit/planners/codex.js +3 -7
  94. package/dist/retrofit/planners/gemini.js +11 -1
  95. package/dist/retrofit/preserve.js +2 -2
  96. package/dist/retrofit/report.js +5 -0
  97. package/dist/retrofit/skill-actions.js +66 -0
  98. package/dist/retrofit/ui-detect.js +83 -0
  99. package/dist/scan/gate.js +36 -0
  100. package/docs/MIGRATING-TO-1.0.md +33 -33
  101. package/docs/MIGRATING-TO-1.1.md +27 -27
  102. package/docs/MIGRATING-TO-1.4.md +70 -70
  103. package/docs/PUBLISHING.md +91 -91
  104. package/docs/superpowers/plans/2026-06-28-baustein-e-context-layer.md +981 -981
  105. package/docs/superpowers/plans/2026-06-29-baustein-f-routing.md +258 -258
  106. package/docs/superpowers/plans/2026-06-29-baustein-g-loop-observability.md +1006 -1006
  107. package/docs/superpowers/plans/2026-06-29-baustein-h-loop-robustness.md +374 -374
  108. package/docs/superpowers/plans/2026-06-30-baustein-i-visual-design-verification.md +450 -450
  109. package/docs/superpowers/plans/2026-07-02-baustein-k-zero-to-100-bootstrap.md +1024 -1024
  110. package/docs/superpowers/plans/2026-07-02-baustein-m-flow-smoke-proofs.md +574 -574
  111. package/docs/superpowers/plans/2026-08-13-gauntlet-quality-loop.md +537 -537
  112. package/docs/superpowers/plans/2026-08-16-artifact-backed-output-compaction.md +329 -329
  113. package/docs/superpowers/plans/2026-08-20-automatic-ui-design-gate.md +59 -0
  114. package/docs/superpowers/plans/2026-08-20-capability-skills-and-context.md +51 -0
  115. package/docs/superpowers/plans/2026-08-20-complete-skill-packages-and-invocation.md +59 -0
  116. package/docs/superpowers/plans/2026-08-20-windows-reliability-and-release.md +67 -0
  117. package/docs/superpowers/specs/2026-06-28-baustein-e-context-layer-design.md +146 -146
  118. package/docs/superpowers/specs/2026-06-29-baustein-f-routing-design.md +106 -106
  119. package/docs/superpowers/specs/2026-06-29-baustein-g-loop-observability-design.md +186 -186
  120. package/docs/superpowers/specs/2026-06-29-baustein-h-loop-robustness-design.md +113 -113
  121. package/docs/superpowers/specs/2026-06-30-baustein-i-visual-design-verification-design.md +98 -98
  122. package/docs/superpowers/specs/2026-07-02-baustein-k-zero-to-100-bootstrap-design.md +200 -200
  123. package/docs/superpowers/specs/2026-07-02-baustein-m-flow-smoke-proofs-design.md +155 -155
  124. package/docs/superpowers/specs/2026-08-13-gauntlet-quality-loop-design.md +422 -422
  125. package/docs/superpowers/specs/2026-08-16-artifact-backed-output-compaction-design.md +166 -166
  126. package/docs/superpowers/specs/2026-08-20-skill-capabilities-and-reliability-design.md +391 -0
  127. package/gemini-extension.json +6 -6
  128. package/hooks/hooks.json +19 -19
  129. package/package.json +84 -84
@@ -0,0 +1,39 @@
1
+ # Glossary and context-map format
2
+
3
+ ## GLOSSARY.md
4
+
5
+ ```md
6
+ # Glossary
7
+
8
+ ## Ordering
9
+
10
+ **Order**
11
+ : A customer's confirmed request for one or more products.
12
+ _Avoid_: Purchase, transaction
13
+
14
+ **Cancellation**
15
+ : The reversal of an entire Order before fulfillment begins.
16
+ _Avoid_: Refund, deletion
17
+ ```
18
+
19
+ Keep each definition to one or two sentences. Define what the term is, name aliases to avoid, and
20
+ include only concepts specific to this project's domain. Group terms when natural clusters emerge.
21
+
22
+ ## CONTEXT-MAP.md
23
+
24
+ Create this optional file only for multiple domain contexts:
25
+
26
+ ```md
27
+ # Context Map
28
+
29
+ ## Contexts
30
+
31
+ - **Ordering**: receives and tracks customer orders
32
+ - **Billing**: issues invoices and processes payments
33
+
34
+ ## Relationships
35
+
36
+ - **Ordering -> Billing**: Ordering emits `OrderConfirmed`; Billing creates an invoice.
37
+ ```
38
+
39
+ Name ownership and the observable relationship. Do not turn the map into an implementation dump.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: domain-modeling
3
+ description: Build or sharpen a project's domain language and durable decisions. Use when terminology is fuzzy or contradictory, relationships need scenario testing, the code disagrees with the stated model, or a glossary or ADR-class decision must be updated; do not trigger merely to read existing context.
4
+ ---
5
+
6
+ # Domain modeling
7
+
8
+ Build the model actively: challenge terms, test relationships with concrete scenarios, compare the
9
+ stated behavior with code, and record a term when it becomes settled.
10
+
11
+ Yoke stores durable context under `.yoke/context/`:
12
+
13
+ - `GLOSSARY.md` is the canonical language for a single domain context.
14
+ - `CONTEXT-MAP.md` is optional and maps multiple domain contexts plus their relationships.
15
+ - `DECISIONS.md` records durable outcomes and ADR-class trade-offs.
16
+
17
+ Read the existing files before proposing vocabulary. Merely consuming their terms is a normal
18
+ context habit, not a reason to run this skill.
19
+
20
+ ## Workflow
21
+
22
+ 1. Identify overloaded, vague, conflicting, or missing terms in the request and current glossary.
23
+ 2. Propose one canonical term and name avoidable aliases. Ask when the distinction changes behavior.
24
+ 3. Stress-test relationships with specific scenarios, especially partial, repeated, failed, and
25
+ cross-context cases.
26
+ 4. Compare the model with public interfaces, persistence shapes, and relevant tests. Surface a
27
+ contradiction instead of silently choosing one side.
28
+ 5. When a term is settled, update `GLOSSARY.md` immediately using
29
+ [CONTEXT-FORMAT.md](CONTEXT-FORMAT.md). Preserve unrelated entries.
30
+ 6. Update `CONTEXT-MAP.md` only when the repository contains more than one genuine domain context.
31
+ 7. Record an ADR-class decision only when all three thresholds in
32
+ [ADR-FORMAT.md](ADR-FORMAT.md) pass.
33
+
34
+ Glossary definitions describe the domain, not its implementation. General programming concepts do
35
+ not belong there.
@@ -1,70 +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
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
@@ -1,200 +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
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