opencodekit 0.0.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 (123) hide show
  1. package/README.md +258 -0
  2. package/dist/index.js +3391 -0
  3. package/dist/template/.opencode/.env.example +193 -0
  4. package/dist/template/.opencode/AGENTS.md +214 -0
  5. package/dist/template/.opencode/README.md +269 -0
  6. package/dist/template/.opencode/agent/build.md +75 -0
  7. package/dist/template/.opencode/agent/explore.md +66 -0
  8. package/dist/template/.opencode/agent/planner.md +83 -0
  9. package/dist/template/.opencode/agent/review.md +90 -0
  10. package/dist/template/.opencode/agent/rush.md +85 -0
  11. package/dist/template/.opencode/agent/scout.md +93 -0
  12. package/dist/template/.opencode/command/analyze-project.md +39 -0
  13. package/dist/template/.opencode/command/brainstorm.md +11 -0
  14. package/dist/template/.opencode/command/commit.md +11 -0
  15. package/dist/template/.opencode/command/create.md +118 -0
  16. package/dist/template/.opencode/command/design.md +15 -0
  17. package/dist/template/.opencode/command/finish.md +233 -0
  18. package/dist/template/.opencode/command/fix-ci.md +20 -0
  19. package/dist/template/.opencode/command/fix-types.md +10 -0
  20. package/dist/template/.opencode/command/fix-ui.md +22 -0
  21. package/dist/template/.opencode/command/fix.md +22 -0
  22. package/dist/template/.opencode/command/handoff.md +146 -0
  23. package/dist/template/.opencode/command/implement.md +167 -0
  24. package/dist/template/.opencode/command/import-plan.md +188 -0
  25. package/dist/template/.opencode/command/integration-test.md +36 -0
  26. package/dist/template/.opencode/command/issue.md +41 -0
  27. package/dist/template/.opencode/command/plan.md +158 -0
  28. package/dist/template/.opencode/command/pr.md +36 -0
  29. package/dist/template/.opencode/command/quick-build.md +13 -0
  30. package/dist/template/.opencode/command/research-and-implement.md +21 -0
  31. package/dist/template/.opencode/command/research-ui.md +32 -0
  32. package/dist/template/.opencode/command/research.md +153 -0
  33. package/dist/template/.opencode/command/resume.md +127 -0
  34. package/dist/template/.opencode/command/review-codebase.md +13 -0
  35. package/dist/template/.opencode/command/skill-create.md +29 -0
  36. package/dist/template/.opencode/command/skill-optimize.md +28 -0
  37. package/dist/template/.opencode/command/status.md +109 -0
  38. package/dist/template/.opencode/command/ui-review.md +28 -0
  39. package/dist/template/.opencode/dcp.jsonc +34 -0
  40. package/dist/template/.opencode/memory/README.md +128 -0
  41. package/dist/template/.opencode/memory/_templates/handoff.md +33 -0
  42. package/dist/template/.opencode/memory/_templates/research.md +29 -0
  43. package/dist/template/.opencode/memory/_templates/task-prd.md +43 -0
  44. package/dist/template/.opencode/memory/_templates/task-review.md +73 -0
  45. package/dist/template/.opencode/memory/_templates/task-spec.md +71 -0
  46. package/dist/template/.opencode/memory/design-guidelines.md +281 -0
  47. package/dist/template/.opencode/memory/handoffs/README.md +83 -0
  48. package/dist/template/.opencode/opencode.json +469 -0
  49. package/dist/template/.opencode/package.json +23 -0
  50. package/dist/template/.opencode/pickle-thinker.jsonc +11 -0
  51. package/dist/template/.opencode/plugin/README.md +162 -0
  52. package/dist/template/.opencode/plugin/notification.ts +88 -0
  53. package/dist/template/.opencode/plugin/sessions.ts +434 -0
  54. package/dist/template/.opencode/plugin/superpowers.ts +332 -0
  55. package/dist/template/.opencode/plugin/tsconfig.json +15 -0
  56. package/dist/template/.opencode/superpowers/.claude/settings.local.json +141 -0
  57. package/dist/template/.opencode/superpowers/.claude-plugin/marketplace.json +20 -0
  58. package/dist/template/.opencode/superpowers/.claude-plugin/plugin.json +13 -0
  59. package/dist/template/.opencode/superpowers/.codex/INSTALL.md +35 -0
  60. package/dist/template/.opencode/superpowers/.codex/superpowers-bootstrap.md +33 -0
  61. package/dist/template/.opencode/superpowers/.codex/superpowers-codex +267 -0
  62. package/dist/template/.opencode/superpowers/.github/FUNDING.yml +3 -0
  63. package/dist/template/.opencode/superpowers/.opencode/INSTALL.md +135 -0
  64. package/dist/template/.opencode/superpowers/.opencode/plugin/superpowers.js +215 -0
  65. package/dist/template/.opencode/superpowers/LICENSE +21 -0
  66. package/dist/template/.opencode/superpowers/README.md +165 -0
  67. package/dist/template/.opencode/superpowers/RELEASE-NOTES.md +493 -0
  68. package/dist/template/.opencode/superpowers/agents/code-reviewer.md +48 -0
  69. package/dist/template/.opencode/superpowers/commands/brainstorm.md +5 -0
  70. package/dist/template/.opencode/superpowers/commands/execute-plan.md +5 -0
  71. package/dist/template/.opencode/superpowers/commands/write-plan.md +5 -0
  72. package/dist/template/.opencode/superpowers/docs/README.codex.md +153 -0
  73. package/dist/template/.opencode/superpowers/docs/README.opencode.md +234 -0
  74. package/dist/template/.opencode/superpowers/docs/plans/2025-11-22-opencode-support-design.md +294 -0
  75. package/dist/template/.opencode/superpowers/docs/plans/2025-11-22-opencode-support-implementation.md +1095 -0
  76. package/dist/template/.opencode/superpowers/hooks/hooks.json +15 -0
  77. package/dist/template/.opencode/superpowers/hooks/session-start.sh +34 -0
  78. package/dist/template/.opencode/superpowers/lib/skills-core.js +208 -0
  79. package/dist/template/.opencode/superpowers/skills/brainstorming/SKILL.md +54 -0
  80. package/dist/template/.opencode/superpowers/skills/condition-based-waiting/SKILL.md +120 -0
  81. package/dist/template/.opencode/superpowers/skills/condition-based-waiting/example.ts +158 -0
  82. package/dist/template/.opencode/superpowers/skills/defense-in-depth/SKILL.md +127 -0
  83. package/dist/template/.opencode/superpowers/skills/dispatching-parallel-agents/SKILL.md +180 -0
  84. package/dist/template/.opencode/superpowers/skills/executing-plans/SKILL.md +76 -0
  85. package/dist/template/.opencode/superpowers/skills/finishing-a-development-branch/SKILL.md +200 -0
  86. package/dist/template/.opencode/superpowers/skills/frontend-aesthetics/SKILL.md +137 -0
  87. package/dist/template/.opencode/superpowers/skills/gemini-large-context/SKILL.md +205 -0
  88. package/dist/template/.opencode/superpowers/skills/receiving-code-review/SKILL.md +209 -0
  89. package/dist/template/.opencode/superpowers/skills/requesting-code-review/SKILL.md +105 -0
  90. package/dist/template/.opencode/superpowers/skills/requesting-code-review/code-reviewer.md +146 -0
  91. package/dist/template/.opencode/superpowers/skills/root-cause-tracing/SKILL.md +174 -0
  92. package/dist/template/.opencode/superpowers/skills/root-cause-tracing/find-polluter.sh +63 -0
  93. package/dist/template/.opencode/superpowers/skills/sharing-skills/SKILL.md +194 -0
  94. package/dist/template/.opencode/superpowers/skills/subagent-driven-development/SKILL.md +189 -0
  95. package/dist/template/.opencode/superpowers/skills/systematic-debugging/CREATION-LOG.md +119 -0
  96. package/dist/template/.opencode/superpowers/skills/systematic-debugging/SKILL.md +295 -0
  97. package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-academic.md +14 -0
  98. package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-pressure-1.md +58 -0
  99. package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-pressure-2.md +68 -0
  100. package/dist/template/.opencode/superpowers/skills/systematic-debugging/test-pressure-3.md +69 -0
  101. package/dist/template/.opencode/superpowers/skills/test-driven-development/SKILL.md +364 -0
  102. package/dist/template/.opencode/superpowers/skills/testing-anti-patterns/SKILL.md +302 -0
  103. package/dist/template/.opencode/superpowers/skills/testing-skills-with-subagents/SKILL.md +387 -0
  104. package/dist/template/.opencode/superpowers/skills/testing-skills-with-subagents/examples/CLAUDE_MD_TESTING.md +189 -0
  105. package/dist/template/.opencode/superpowers/skills/ui-ux-research/SKILL.md +191 -0
  106. package/dist/template/.opencode/superpowers/skills/using-git-worktrees/SKILL.md +213 -0
  107. package/dist/template/.opencode/superpowers/skills/using-superpowers/SKILL.md +101 -0
  108. package/dist/template/.opencode/superpowers/skills/verification-before-completion/SKILL.md +139 -0
  109. package/dist/template/.opencode/superpowers/skills/writing-plans/SKILL.md +116 -0
  110. package/dist/template/.opencode/superpowers/skills/writing-skills/SKILL.md +622 -0
  111. package/dist/template/.opencode/superpowers/skills/writing-skills/anthropic-best-practices.md +1150 -0
  112. package/dist/template/.opencode/superpowers/skills/writing-skills/graphviz-conventions.dot +172 -0
  113. package/dist/template/.opencode/superpowers/skills/writing-skills/persuasion-principles.md +187 -0
  114. package/dist/template/.opencode/superpowers/tests/opencode/run-tests.sh +165 -0
  115. package/dist/template/.opencode/superpowers/tests/opencode/setup.sh +73 -0
  116. package/dist/template/.opencode/superpowers/tests/opencode/test-plugin-loading.sh +81 -0
  117. package/dist/template/.opencode/superpowers/tests/opencode/test-priority.sh +198 -0
  118. package/dist/template/.opencode/superpowers/tests/opencode/test-skills-core.sh +440 -0
  119. package/dist/template/.opencode/superpowers/tests/opencode/test-tools.sh +104 -0
  120. package/dist/template/.opencode/tool/memory-read.ts +66 -0
  121. package/dist/template/.opencode/tool/memory-update.ts +61 -0
  122. package/dist/template/.opencode/tsconfig.json +21 -0
  123. package/package.json +52 -0
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: defense-in-depth
3
+ description: Use when invalid data causes failures deep in execution, requiring validation at multiple system layers - validates at every layer data passes through to make bugs structurally impossible
4
+ ---
5
+
6
+ # Defense-in-Depth Validation
7
+
8
+ ## Overview
9
+
10
+ When you fix a bug caused by invalid data, adding validation at one place feels sufficient. But that single check can be bypassed by different code paths, refactoring, or mocks.
11
+
12
+ **Core principle:** Validate at EVERY layer data passes through. Make the bug structurally impossible.
13
+
14
+ ## Why Multiple Layers
15
+
16
+ Single validation: "We fixed the bug"
17
+ Multiple layers: "We made the bug impossible"
18
+
19
+ Different layers catch different cases:
20
+ - Entry validation catches most bugs
21
+ - Business logic catches edge cases
22
+ - Environment guards prevent context-specific dangers
23
+ - Debug logging helps when other layers fail
24
+
25
+ ## The Four Layers
26
+
27
+ ### Layer 1: Entry Point Validation
28
+ **Purpose:** Reject obviously invalid input at API boundary
29
+
30
+ ```typescript
31
+ function createProject(name: string, workingDirectory: string) {
32
+ if (!workingDirectory || workingDirectory.trim() === '') {
33
+ throw new Error('workingDirectory cannot be empty');
34
+ }
35
+ if (!existsSync(workingDirectory)) {
36
+ throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
37
+ }
38
+ if (!statSync(workingDirectory).isDirectory()) {
39
+ throw new Error(`workingDirectory is not a directory: ${workingDirectory}`);
40
+ }
41
+ // ... proceed
42
+ }
43
+ ```
44
+
45
+ ### Layer 2: Business Logic Validation
46
+ **Purpose:** Ensure data makes sense for this operation
47
+
48
+ ```typescript
49
+ function initializeWorkspace(projectDir: string, sessionId: string) {
50
+ if (!projectDir) {
51
+ throw new Error('projectDir required for workspace initialization');
52
+ }
53
+ // ... proceed
54
+ }
55
+ ```
56
+
57
+ ### Layer 3: Environment Guards
58
+ **Purpose:** Prevent dangerous operations in specific contexts
59
+
60
+ ```typescript
61
+ async function gitInit(directory: string) {
62
+ // In tests, refuse git init outside temp directories
63
+ if (process.env.NODE_ENV === 'test') {
64
+ const normalized = normalize(resolve(directory));
65
+ const tmpDir = normalize(resolve(tmpdir()));
66
+
67
+ if (!normalized.startsWith(tmpDir)) {
68
+ throw new Error(
69
+ `Refusing git init outside temp dir during tests: ${directory}`
70
+ );
71
+ }
72
+ }
73
+ // ... proceed
74
+ }
75
+ ```
76
+
77
+ ### Layer 4: Debug Instrumentation
78
+ **Purpose:** Capture context for forensics
79
+
80
+ ```typescript
81
+ async function gitInit(directory: string) {
82
+ const stack = new Error().stack;
83
+ logger.debug('About to git init', {
84
+ directory,
85
+ cwd: process.cwd(),
86
+ stack,
87
+ });
88
+ // ... proceed
89
+ }
90
+ ```
91
+
92
+ ## Applying the Pattern
93
+
94
+ When you find a bug:
95
+
96
+ 1. **Trace the data flow** - Where does bad value originate? Where used?
97
+ 2. **Map all checkpoints** - List every point data passes through
98
+ 3. **Add validation at each layer** - Entry, business, environment, debug
99
+ 4. **Test each layer** - Try to bypass layer 1, verify layer 2 catches it
100
+
101
+ ## Example from Session
102
+
103
+ Bug: Empty `projectDir` caused `git init` in source code
104
+
105
+ **Data flow:**
106
+ 1. Test setup → empty string
107
+ 2. `Project.create(name, '')`
108
+ 3. `WorkspaceManager.createWorkspace('')`
109
+ 4. `git init` runs in `process.cwd()`
110
+
111
+ **Four layers added:**
112
+ - Layer 1: `Project.create()` validates not empty/exists/writable
113
+ - Layer 2: `WorkspaceManager` validates projectDir not empty
114
+ - Layer 3: `WorktreeManager` refuses git init outside tmpdir in tests
115
+ - Layer 4: Stack trace logging before git init
116
+
117
+ **Result:** All 1847 tests passed, bug impossible to reproduce
118
+
119
+ ## Key Insight
120
+
121
+ All four layers were necessary. During testing, each layer caught bugs the others missed:
122
+ - Different code paths bypassed entry validation
123
+ - Mocks bypassed business logic checks
124
+ - Edge cases on different platforms needed environment guards
125
+ - Debug logging identified structural misuse
126
+
127
+ **Don't stop at one validation point.** Add checks at every layer.
@@ -0,0 +1,180 @@
1
+ ---
2
+ name: dispatching-parallel-agents
3
+ description: Use when facing 3+ independent failures that can be investigated without shared state or dependencies - dispatches multiple Claude agents to investigate and fix independent problems concurrently
4
+ ---
5
+
6
+ # Dispatching Parallel Agents
7
+
8
+ ## Overview
9
+
10
+ When you have multiple unrelated failures (different test files, different subsystems, different bugs), investigating them sequentially wastes time. Each investigation is independent and can happen in parallel.
11
+
12
+ **Core principle:** Dispatch one agent per independent problem domain. Let them work concurrently.
13
+
14
+ ## When to Use
15
+
16
+ ```dot
17
+ digraph when_to_use {
18
+ "Multiple failures?" [shape=diamond];
19
+ "Are they independent?" [shape=diamond];
20
+ "Single agent investigates all" [shape=box];
21
+ "One agent per problem domain" [shape=box];
22
+ "Can they work in parallel?" [shape=diamond];
23
+ "Sequential agents" [shape=box];
24
+ "Parallel dispatch" [shape=box];
25
+
26
+ "Multiple failures?" -> "Are they independent?" [label="yes"];
27
+ "Are they independent?" -> "Single agent investigates all" [label="no - related"];
28
+ "Are they independent?" -> "Can they work in parallel?" [label="yes"];
29
+ "Can they work in parallel?" -> "Parallel dispatch" [label="yes"];
30
+ "Can they work in parallel?" -> "Sequential agents" [label="no - shared state"];
31
+ }
32
+ ```
33
+
34
+ **Use when:**
35
+ - 3+ test files failing with different root causes
36
+ - Multiple subsystems broken independently
37
+ - Each problem can be understood without context from others
38
+ - No shared state between investigations
39
+
40
+ **Don't use when:**
41
+ - Failures are related (fix one might fix others)
42
+ - Need to understand full system state
43
+ - Agents would interfere with each other
44
+
45
+ ## The Pattern
46
+
47
+ ### 1. Identify Independent Domains
48
+
49
+ Group failures by what's broken:
50
+ - File A tests: Tool approval flow
51
+ - File B tests: Batch completion behavior
52
+ - File C tests: Abort functionality
53
+
54
+ Each domain is independent - fixing tool approval doesn't affect abort tests.
55
+
56
+ ### 2. Create Focused Agent Tasks
57
+
58
+ Each agent gets:
59
+ - **Specific scope:** One test file or subsystem
60
+ - **Clear goal:** Make these tests pass
61
+ - **Constraints:** Don't change other code
62
+ - **Expected output:** Summary of what you found and fixed
63
+
64
+ ### 3. Dispatch in Parallel
65
+
66
+ ```typescript
67
+ // In Claude Code / AI environment
68
+ Task("Fix agent-tool-abort.test.ts failures")
69
+ Task("Fix batch-completion-behavior.test.ts failures")
70
+ Task("Fix tool-approval-race-conditions.test.ts failures")
71
+ // All three run concurrently
72
+ ```
73
+
74
+ ### 4. Review and Integrate
75
+
76
+ When agents return:
77
+ - Read each summary
78
+ - Verify fixes don't conflict
79
+ - Run full test suite
80
+ - Integrate all changes
81
+
82
+ ## Agent Prompt Structure
83
+
84
+ Good agent prompts are:
85
+ 1. **Focused** - One clear problem domain
86
+ 2. **Self-contained** - All context needed to understand the problem
87
+ 3. **Specific about output** - What should the agent return?
88
+
89
+ ```markdown
90
+ Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
91
+
92
+ 1. "should abort tool with partial output capture" - expects 'interrupted at' in message
93
+ 2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
94
+ 3. "should properly track pendingToolCount" - expects 3 results but gets 0
95
+
96
+ These are timing/race condition issues. Your task:
97
+
98
+ 1. Read the test file and understand what each test verifies
99
+ 2. Identify root cause - timing issues or actual bugs?
100
+ 3. Fix by:
101
+ - Replacing arbitrary timeouts with event-based waiting
102
+ - Fixing bugs in abort implementation if found
103
+ - Adjusting test expectations if testing changed behavior
104
+
105
+ Do NOT just increase timeouts - find the real issue.
106
+
107
+ Return: Summary of what you found and what you fixed.
108
+ ```
109
+
110
+ ## Common Mistakes
111
+
112
+ **❌ Too broad:** "Fix all the tests" - agent gets lost
113
+ **✅ Specific:** "Fix agent-tool-abort.test.ts" - focused scope
114
+
115
+ **❌ No context:** "Fix the race condition" - agent doesn't know where
116
+ **✅ Context:** Paste the error messages and test names
117
+
118
+ **❌ No constraints:** Agent might refactor everything
119
+ **✅ Constraints:** "Do NOT change production code" or "Fix tests only"
120
+
121
+ **❌ Vague output:** "Fix it" - you don't know what changed
122
+ **✅ Specific:** "Return summary of root cause and changes"
123
+
124
+ ## When NOT to Use
125
+
126
+ **Related failures:** Fixing one might fix others - investigate together first
127
+ **Need full context:** Understanding requires seeing entire system
128
+ **Exploratory debugging:** You don't know what's broken yet
129
+ **Shared state:** Agents would interfere (editing same files, using same resources)
130
+
131
+ ## Real Example from Session
132
+
133
+ **Scenario:** 6 test failures across 3 files after major refactoring
134
+
135
+ **Failures:**
136
+ - agent-tool-abort.test.ts: 3 failures (timing issues)
137
+ - batch-completion-behavior.test.ts: 2 failures (tools not executing)
138
+ - tool-approval-race-conditions.test.ts: 1 failure (execution count = 0)
139
+
140
+ **Decision:** Independent domains - abort logic separate from batch completion separate from race conditions
141
+
142
+ **Dispatch:**
143
+ ```
144
+ Agent 1 → Fix agent-tool-abort.test.ts
145
+ Agent 2 → Fix batch-completion-behavior.test.ts
146
+ Agent 3 → Fix tool-approval-race-conditions.test.ts
147
+ ```
148
+
149
+ **Results:**
150
+ - Agent 1: Replaced timeouts with event-based waiting
151
+ - Agent 2: Fixed event structure bug (threadId in wrong place)
152
+ - Agent 3: Added wait for async tool execution to complete
153
+
154
+ **Integration:** All fixes independent, no conflicts, full suite green
155
+
156
+ **Time saved:** 3 problems solved in parallel vs sequentially
157
+
158
+ ## Key Benefits
159
+
160
+ 1. **Parallelization** - Multiple investigations happen simultaneously
161
+ 2. **Focus** - Each agent has narrow scope, less context to track
162
+ 3. **Independence** - Agents don't interfere with each other
163
+ 4. **Speed** - 3 problems solved in time of 1
164
+
165
+ ## Verification
166
+
167
+ After agents return:
168
+ 1. **Review each summary** - Understand what changed
169
+ 2. **Check for conflicts** - Did agents edit same code?
170
+ 3. **Run full suite** - Verify all fixes work together
171
+ 4. **Spot check** - Agents can make systematic errors
172
+
173
+ ## Real-World Impact
174
+
175
+ From debugging session (2025-10-03):
176
+ - 6 failures across 3 files
177
+ - 3 agents dispatched in parallel
178
+ - All investigations completed concurrently
179
+ - All fixes integrated successfully
180
+ - Zero conflicts between agent changes
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: executing-plans
3
+ description: Use when partner provides a complete implementation plan to execute in controlled batches with review checkpoints - loads plan, reviews critically, executes tasks in batches, reports for review between batches
4
+ ---
5
+
6
+ # Executing Plans
7
+
8
+ ## Overview
9
+
10
+ Load plan, review critically, execute tasks in batches, report for review between batches.
11
+
12
+ **Core principle:** Batch execution with checkpoints for architect review.
13
+
14
+ **Announce at start:** "I'm using the executing-plans skill to implement this plan."
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 Batch
25
+ **Default: First 3 tasks**
26
+
27
+ For each task:
28
+ 1. Mark as in_progress
29
+ 2. Follow each step exactly (plan has bite-sized steps)
30
+ 3. Run verifications as specified
31
+ 4. Mark as completed
32
+
33
+ ### Step 3: Report
34
+ When batch complete:
35
+ - Show what was implemented
36
+ - Show verification output
37
+ - Say: "Ready for feedback."
38
+
39
+ ### Step 4: Continue
40
+ Based on feedback:
41
+ - Apply changes if needed
42
+ - Execute next batch
43
+ - Repeat until complete
44
+
45
+ ### Step 5: Complete Development
46
+
47
+ After all tasks complete and verified:
48
+ - Announce: "I'm using the finishing-a-development-branch skill to complete this work."
49
+ - **REQUIRED SUB-SKILL:** Use superpowers:finishing-a-development-branch
50
+ - Follow that skill to verify tests, present options, execute choice
51
+
52
+ ## When to Stop and Ask for Help
53
+
54
+ **STOP executing immediately when:**
55
+ - Hit a blocker mid-batch (missing dependency, test fails, instruction unclear)
56
+ - Plan has critical gaps preventing starting
57
+ - You don't understand an instruction
58
+ - Verification fails repeatedly
59
+
60
+ **Ask for clarification rather than guessing.**
61
+
62
+ ## When to Revisit Earlier Steps
63
+
64
+ **Return to Review (Step 1) when:**
65
+ - Partner updates the plan based on your feedback
66
+ - Fundamental approach needs rethinking
67
+
68
+ **Don't force through blockers** - stop and ask.
69
+
70
+ ## Remember
71
+ - Review plan critically first
72
+ - Follow plan steps exactly
73
+ - Don't skip verifications
74
+ - Reference skills when plan says to
75
+ - Between batches: just report and wait
76
+ - Stop when blocked, don't guess
@@ -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