hero-mmt-kit 1.0.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.
- package/CHANGELOG.md +57 -0
- package/LICENSE +21 -0
- package/README.md +158 -0
- package/bin/hero-mmt-kit.js +70 -0
- package/package.json +35 -0
- package/presets/enterprise.json +3 -0
- package/presets/small-team.json +3 -0
- package/presets/solo.json +3 -0
- package/skills.manifest.json +72 -0
- package/src/detect.cjs +43 -0
- package/src/discover.cjs +159 -0
- package/src/doctor.cjs +130 -0
- package/src/init.cjs +114 -0
- package/src/integrations.cjs +93 -0
- package/src/links.cjs +37 -0
- package/src/merge.cjs +61 -0
- package/src/profile-config.cjs +28 -0
- package/src/render.cjs +27 -0
- package/src/skills.cjs +107 -0
- package/src/update.cjs +75 -0
- package/src/util.cjs +56 -0
- package/src/workflow-state.cjs +65 -0
- package/templates/.hero-mmt-kit/session.schema.json +15 -0
- package/templates/AGENTS.md.tmpl +16 -0
- package/templates/CLAUDE.md.tmpl +23 -0
- package/templates/common/.claude/hooks/git-guard.cjs +57 -0
- package/templates/common/.claude/hooks/session-bridge.cjs +43 -0
- package/templates/common/.claude/hooks/stop-reminder.cjs +43 -0
- package/templates/common/.claude/settings.json +27 -0
- package/templates/docs/ACTIVE_STATE.md +41 -0
- package/templates/docs/BROWNFIELD_DISCOVERY.md +45 -0
- package/templates/docs/DESIGN_STANDARDS.md +86 -0
- package/templates/docs/INTERACTION_PATTERNS.md +58 -0
- package/templates/docs/PERFORMANCE_STANDARDS.md +31 -0
- package/templates/docs/SECURITY_STANDARDS.md +38 -0
- package/templates/docs/templates/DESIGN_BRIEF.md +44 -0
- package/templates/docs/templates/PRD_AI_FEATURE.md +87 -0
- package/templates/skills/NOTICE +69 -0
- package/templates/skills/brainstorming/SKILL.md +161 -0
- package/templates/skills/brainstorming/scripts/frame-template.html +214 -0
- package/templates/skills/brainstorming/scripts/helper.js +88 -0
- package/templates/skills/brainstorming/scripts/server.cjs +354 -0
- package/templates/skills/brainstorming/scripts/start-server.sh +148 -0
- package/templates/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/templates/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/templates/skills/brainstorming/visual-companion.md +287 -0
- package/templates/skills/dispatching-parallel-agents/SKILL.md +186 -0
- package/templates/skills/executing-plans/SKILL.md +72 -0
- package/templates/skills/finishing-a-development-branch/SKILL.md +253 -0
- package/templates/skills/hero-coding/SKILL.md +69 -0
- package/templates/skills/hero-planning/SKILL.md +64 -0
- package/templates/skills/hero-reviewing/SKILL.md +66 -0
- package/templates/skills/hero-security/SKILL.md +425 -0
- package/templates/skills/hero-strict/SKILL.md +77 -0
- package/templates/skills/hero-unit-test/SKILL.md +79 -0
- package/templates/skills/receiving-code-review/SKILL.md +213 -0
- package/templates/skills/requesting-code-review/SKILL.md +108 -0
- package/templates/skills/requesting-code-review/code-reviewer.md +168 -0
- package/templates/skills/subagent-driven-development/SKILL.md +269 -0
- package/templates/skills/subagent-driven-development/code-quality-reviewer-prompt.md +34 -0
- package/templates/skills/subagent-driven-development/implementer-prompt.md +121 -0
- package/templates/skills/subagent-driven-development/scripts/review-package.sh +38 -0
- package/templates/skills/subagent-driven-development/scripts/sdd-workspace.sh +25 -0
- package/templates/skills/subagent-driven-development/scripts/task-brief.sh +58 -0
- package/templates/skills/subagent-driven-development/spec-reviewer-prompt.md +76 -0
- package/templates/skills/systematic-debugging/SKILL.md +296 -0
- package/templates/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/templates/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/templates/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/templates/skills/systematic-debugging/find-polluter.sh +63 -0
- package/templates/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/templates/skills/test-driven-development/SKILL.md +371 -0
- package/templates/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/templates/skills/using-git-worktrees/SKILL.md +206 -0
- package/templates/skills/using-hero/SKILL.md +54 -0
- package/templates/skills/using-superpowers/SKILL.md +119 -0
- package/templates/skills/verification-before-completion/SKILL.md +139 -0
- package/templates/skills/writing-plans/SKILL.md +173 -0
- package/templates/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
# Testing Anti-Patterns
|
|
2
|
+
|
|
3
|
+
**Load this reference when:** writing or changing tests, adding mocks, or tempted to add test-only methods to production code.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Tests must verify real behavior, not mock behavior. Mocks are a means to isolate, not the thing being tested.
|
|
8
|
+
|
|
9
|
+
**Core principle:** Test what the code does, not what the mocks do.
|
|
10
|
+
|
|
11
|
+
**Following strict TDD prevents these anti-patterns.**
|
|
12
|
+
|
|
13
|
+
## The Iron Laws
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
1. NEVER test mock behavior
|
|
17
|
+
2. NEVER add test-only methods to production classes
|
|
18
|
+
3. NEVER mock without understanding dependencies
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Anti-Pattern 1: Testing Mock Behavior
|
|
22
|
+
|
|
23
|
+
**The violation:**
|
|
24
|
+
```typescript
|
|
25
|
+
// ❌ BAD: Testing that the mock exists
|
|
26
|
+
test('renders sidebar', () => {
|
|
27
|
+
render(<Page />);
|
|
28
|
+
expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Why this is wrong:**
|
|
33
|
+
- You're verifying the mock works, not that the component works
|
|
34
|
+
- Test passes when mock is present, fails when it's not
|
|
35
|
+
- Tells you nothing about real behavior
|
|
36
|
+
|
|
37
|
+
**your human partner's correction:** "Are we testing the behavior of a mock?"
|
|
38
|
+
|
|
39
|
+
**The fix:**
|
|
40
|
+
```typescript
|
|
41
|
+
// ✅ GOOD: Test real component or don't mock it
|
|
42
|
+
test('renders sidebar', () => {
|
|
43
|
+
render(<Page />); // Don't mock sidebar
|
|
44
|
+
expect(screen.getByRole('navigation')).toBeInTheDocument();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// OR if sidebar must be mocked for isolation:
|
|
48
|
+
// Don't assert on the mock - test Page's behavior with sidebar present
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Gate Function
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
BEFORE asserting on any mock element:
|
|
55
|
+
Ask: "Am I testing real component behavior or just mock existence?"
|
|
56
|
+
|
|
57
|
+
IF testing mock existence:
|
|
58
|
+
STOP - Delete the assertion or unmock the component
|
|
59
|
+
|
|
60
|
+
Test real behavior instead
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Anti-Pattern 2: Test-Only Methods in Production
|
|
64
|
+
|
|
65
|
+
**The violation:**
|
|
66
|
+
```typescript
|
|
67
|
+
// ❌ BAD: destroy() only used in tests
|
|
68
|
+
class Session {
|
|
69
|
+
async destroy() { // Looks like production API!
|
|
70
|
+
await this._workspaceManager?.destroyWorkspace(this.id);
|
|
71
|
+
// ... cleanup
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// In tests
|
|
76
|
+
afterEach(() => session.destroy());
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Why this is wrong:**
|
|
80
|
+
- Production class polluted with test-only code
|
|
81
|
+
- Dangerous if accidentally called in production
|
|
82
|
+
- Violates YAGNI and separation of concerns
|
|
83
|
+
- Confuses object lifecycle with entity lifecycle
|
|
84
|
+
|
|
85
|
+
**The fix:**
|
|
86
|
+
```typescript
|
|
87
|
+
// ✅ GOOD: Test utilities handle test cleanup
|
|
88
|
+
// Session has no destroy() - it's stateless in production
|
|
89
|
+
|
|
90
|
+
// In test-utils/
|
|
91
|
+
export async function cleanupSession(session: Session) {
|
|
92
|
+
const workspace = session.getWorkspaceInfo();
|
|
93
|
+
if (workspace) {
|
|
94
|
+
await workspaceManager.destroyWorkspace(workspace.id);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// In tests
|
|
99
|
+
afterEach(() => cleanupSession(session));
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Gate Function
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
BEFORE adding any method to production class:
|
|
106
|
+
Ask: "Is this only used by tests?"
|
|
107
|
+
|
|
108
|
+
IF yes:
|
|
109
|
+
STOP - Don't add it
|
|
110
|
+
Put it in test utilities instead
|
|
111
|
+
|
|
112
|
+
Ask: "Does this class own this resource's lifecycle?"
|
|
113
|
+
|
|
114
|
+
IF no:
|
|
115
|
+
STOP - Wrong class for this method
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Anti-Pattern 3: Mocking Without Understanding
|
|
119
|
+
|
|
120
|
+
**The violation:**
|
|
121
|
+
```typescript
|
|
122
|
+
// ❌ BAD: Mock breaks test logic
|
|
123
|
+
test('detects duplicate server', () => {
|
|
124
|
+
// Mock prevents config write that test depends on!
|
|
125
|
+
vi.mock('ToolCatalog', () => ({
|
|
126
|
+
discoverAndCacheTools: vi.fn().mockResolvedValue(undefined)
|
|
127
|
+
}));
|
|
128
|
+
|
|
129
|
+
await addServer(config);
|
|
130
|
+
await addServer(config); // Should throw - but won't!
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Why this is wrong:**
|
|
135
|
+
- Mocked method had side effect test depended on (writing config)
|
|
136
|
+
- Over-mocking to "be safe" breaks actual behavior
|
|
137
|
+
- Test passes for wrong reason or fails mysteriously
|
|
138
|
+
|
|
139
|
+
**The fix:**
|
|
140
|
+
```typescript
|
|
141
|
+
// ✅ GOOD: Mock at correct level
|
|
142
|
+
test('detects duplicate server', () => {
|
|
143
|
+
// Mock the slow part, preserve behavior test needs
|
|
144
|
+
vi.mock('MCPServerManager'); // Just mock slow server startup
|
|
145
|
+
|
|
146
|
+
await addServer(config); // Config written
|
|
147
|
+
await addServer(config); // Duplicate detected ✓
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Gate Function
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
BEFORE mocking any method:
|
|
155
|
+
STOP - Don't mock yet
|
|
156
|
+
|
|
157
|
+
1. Ask: "What side effects does the real method have?"
|
|
158
|
+
2. Ask: "Does this test depend on any of those side effects?"
|
|
159
|
+
3. Ask: "Do I fully understand what this test needs?"
|
|
160
|
+
|
|
161
|
+
IF depends on side effects:
|
|
162
|
+
Mock at lower level (the actual slow/external operation)
|
|
163
|
+
OR use test doubles that preserve necessary behavior
|
|
164
|
+
NOT the high-level method the test depends on
|
|
165
|
+
|
|
166
|
+
IF unsure what test depends on:
|
|
167
|
+
Run test with real implementation FIRST
|
|
168
|
+
Observe what actually needs to happen
|
|
169
|
+
THEN add minimal mocking at the right level
|
|
170
|
+
|
|
171
|
+
Red flags:
|
|
172
|
+
- "I'll mock this to be safe"
|
|
173
|
+
- "This might be slow, better mock it"
|
|
174
|
+
- Mocking without understanding the dependency chain
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Anti-Pattern 4: Incomplete Mocks
|
|
178
|
+
|
|
179
|
+
**The violation:**
|
|
180
|
+
```typescript
|
|
181
|
+
// ❌ BAD: Partial mock - only fields you think you need
|
|
182
|
+
const mockResponse = {
|
|
183
|
+
status: 'success',
|
|
184
|
+
data: { userId: '123', name: 'Alice' }
|
|
185
|
+
// Missing: metadata that downstream code uses
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// Later: breaks when code accesses response.metadata.requestId
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Why this is wrong:**
|
|
192
|
+
- **Partial mocks hide structural assumptions** - You only mocked fields you know about
|
|
193
|
+
- **Downstream code may depend on fields you didn't include** - Silent failures
|
|
194
|
+
- **Tests pass but integration fails** - Mock incomplete, real API complete
|
|
195
|
+
- **False confidence** - Test proves nothing about real behavior
|
|
196
|
+
|
|
197
|
+
**The Iron Rule:** Mock the COMPLETE data structure as it exists in reality, not just fields your immediate test uses.
|
|
198
|
+
|
|
199
|
+
**The fix:**
|
|
200
|
+
```typescript
|
|
201
|
+
// ✅ GOOD: Mirror real API completeness
|
|
202
|
+
const mockResponse = {
|
|
203
|
+
status: 'success',
|
|
204
|
+
data: { userId: '123', name: 'Alice' },
|
|
205
|
+
metadata: { requestId: 'req-789', timestamp: 1234567890 }
|
|
206
|
+
// All fields real API returns
|
|
207
|
+
};
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Gate Function
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
BEFORE creating mock responses:
|
|
214
|
+
Check: "What fields does the real API response contain?"
|
|
215
|
+
|
|
216
|
+
Actions:
|
|
217
|
+
1. Examine actual API response from docs/examples
|
|
218
|
+
2. Include ALL fields system might consume downstream
|
|
219
|
+
3. Verify mock matches real response schema completely
|
|
220
|
+
|
|
221
|
+
Critical:
|
|
222
|
+
If you're creating a mock, you must understand the ENTIRE structure
|
|
223
|
+
Partial mocks fail silently when code depends on omitted fields
|
|
224
|
+
|
|
225
|
+
If uncertain: Include all documented fields
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Anti-Pattern 5: Integration Tests as Afterthought
|
|
229
|
+
|
|
230
|
+
**The violation:**
|
|
231
|
+
```
|
|
232
|
+
✅ Implementation complete
|
|
233
|
+
❌ No tests written
|
|
234
|
+
"Ready for testing"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Why this is wrong:**
|
|
238
|
+
- Testing is part of implementation, not optional follow-up
|
|
239
|
+
- TDD would have caught this
|
|
240
|
+
- Can't claim complete without tests
|
|
241
|
+
|
|
242
|
+
**The fix:**
|
|
243
|
+
```
|
|
244
|
+
TDD cycle:
|
|
245
|
+
1. Write failing test
|
|
246
|
+
2. Implement to pass
|
|
247
|
+
3. Refactor
|
|
248
|
+
4. THEN claim complete
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## When Mocks Become Too Complex
|
|
252
|
+
|
|
253
|
+
**Warning signs:**
|
|
254
|
+
- Mock setup longer than test logic
|
|
255
|
+
- Mocking everything to make test pass
|
|
256
|
+
- Mocks missing methods real components have
|
|
257
|
+
- Test breaks when mock changes
|
|
258
|
+
|
|
259
|
+
**your human partner's question:** "Do we need to be using a mock here?"
|
|
260
|
+
|
|
261
|
+
**Consider:** Integration tests with real components often simpler than complex mocks
|
|
262
|
+
|
|
263
|
+
## TDD Prevents These Anti-Patterns
|
|
264
|
+
|
|
265
|
+
**Why TDD helps:**
|
|
266
|
+
1. **Write test first** → Forces you to think about what you're actually testing
|
|
267
|
+
2. **Watch it fail** → Confirms test tests real behavior, not mocks
|
|
268
|
+
3. **Minimal implementation** → No test-only methods creep in
|
|
269
|
+
4. **Real dependencies** → You see what the test actually needs before mocking
|
|
270
|
+
|
|
271
|
+
**If you're testing mock behavior, you violated TDD** - you added mocks without watching test fail against real code first.
|
|
272
|
+
|
|
273
|
+
## Quick Reference
|
|
274
|
+
|
|
275
|
+
| Anti-Pattern | Fix |
|
|
276
|
+
|--------------|-----|
|
|
277
|
+
| Assert on mock elements | Test real component or unmock it |
|
|
278
|
+
| Test-only methods in production | Move to test utilities |
|
|
279
|
+
| Mock without understanding | Understand dependencies first, mock minimally |
|
|
280
|
+
| Incomplete mocks | Mirror real API completely |
|
|
281
|
+
| Tests as afterthought | TDD - tests first |
|
|
282
|
+
| Over-complex mocks | Consider integration tests |
|
|
283
|
+
|
|
284
|
+
## Red Flags
|
|
285
|
+
|
|
286
|
+
- Assertion checks for `*-mock` test IDs
|
|
287
|
+
- Methods only called in test files
|
|
288
|
+
- Mock setup is >50% of test
|
|
289
|
+
- Test fails when you remove mock
|
|
290
|
+
- Can't explain why mock is needed
|
|
291
|
+
- Mocking "just to be safe"
|
|
292
|
+
|
|
293
|
+
## The Bottom Line
|
|
294
|
+
|
|
295
|
+
**Mocks are tools to isolate, not things to test.**
|
|
296
|
+
|
|
297
|
+
If TDD reveals you're testing mock behavior, you've gone wrong.
|
|
298
|
+
|
|
299
|
+
Fix: Test real behavior or question why you're mocking at all.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-git-worktrees
|
|
3
|
+
description: Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using Git Worktrees
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Ensure work happens in an isolated workspace. Prefer your platform's native worktree tools. Fall back to manual git worktrees only when no native tool is available.
|
|
11
|
+
|
|
12
|
+
**Core principle:** Detect existing isolation first. Then use native tools. Then fall back to git. Never fight the harness.
|
|
13
|
+
|
|
14
|
+
**See also:** `finishing-a-development-branch` — when implementation is complete, use that skill to merge/PR/clean up the workspace set up here.
|
|
15
|
+
|
|
16
|
+
**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
|
|
17
|
+
|
|
18
|
+
## Step 0: Detect Existing Isolation
|
|
19
|
+
|
|
20
|
+
**Before creating anything, check if you are already in an isolated workspace.**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
|
|
24
|
+
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
|
|
25
|
+
BRANCH=$(git branch --show-current)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Submodule guard:** `GIT_DIR != GIT_COMMON` is also true inside git submodules. Before concluding "already in a worktree," verify you are not in a submodule:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# If this returns a path, you're in a submodule, not a worktree — treat as normal repo
|
|
32
|
+
git rev-parse --show-superproject-working-tree 2>/dev/null
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**If `GIT_DIR != GIT_COMMON` (and not a submodule):** You are already in a linked worktree. Skip to Step 3 (Project Setup). Do NOT create another worktree.
|
|
36
|
+
|
|
37
|
+
Report with branch state:
|
|
38
|
+
- On a branch: "Already in isolated workspace at `<path>` on branch `<name>`."
|
|
39
|
+
- Detached HEAD: "Already in isolated workspace at `<path>` (detached HEAD, externally managed). Branch creation needed at finish time."
|
|
40
|
+
|
|
41
|
+
**If `GIT_DIR == GIT_COMMON` (or in a submodule):** You are in a normal repo checkout.
|
|
42
|
+
|
|
43
|
+
Has the user already indicated their worktree preference in your instructions? If not, ask for consent before creating a worktree:
|
|
44
|
+
|
|
45
|
+
> "Would you like me to set up an isolated worktree? It protects your current branch from changes."
|
|
46
|
+
|
|
47
|
+
Honor any existing declared preference without asking. If the user declines consent, work in place and skip to Step 3.
|
|
48
|
+
|
|
49
|
+
## Step 1: Create Isolated Workspace
|
|
50
|
+
|
|
51
|
+
**You have two mechanisms. Try them in this order.**
|
|
52
|
+
|
|
53
|
+
### 1a. Native Worktree Tools (preferred)
|
|
54
|
+
|
|
55
|
+
The user has asked for an isolated workspace (Step 0 consent). Do you already have a way to create a worktree? It might be a tool with a name like `EnterWorktree`, `WorktreeCreate`, a `/worktree` command, or a `--worktree` flag. If you do, use it and skip to Step 3.
|
|
56
|
+
|
|
57
|
+
Native tools handle directory placement, branch creation, and cleanup automatically. Using `git worktree add` when you have a native tool creates phantom state your harness can't see or manage.
|
|
58
|
+
|
|
59
|
+
Only proceed to Step 1b if you have no native worktree tool available.
|
|
60
|
+
|
|
61
|
+
### 1b. Git Worktree Fallback
|
|
62
|
+
|
|
63
|
+
**Only use this if Step 1a does not apply** — you have no native worktree tool available. Create a worktree manually using git.
|
|
64
|
+
|
|
65
|
+
#### Directory Selection
|
|
66
|
+
|
|
67
|
+
Follow this priority order. Explicit user preference always beats observed filesystem state.
|
|
68
|
+
|
|
69
|
+
1. **Check your instructions for a declared worktree directory preference.** If the user has already specified one, use it without asking.
|
|
70
|
+
|
|
71
|
+
2. **Check for an existing project-local worktree directory:**
|
|
72
|
+
```bash
|
|
73
|
+
ls -d .worktrees 2>/dev/null # Preferred (hidden)
|
|
74
|
+
ls -d worktrees 2>/dev/null # Alternative
|
|
75
|
+
```
|
|
76
|
+
If found, use it. If both exist, `.worktrees` wins.
|
|
77
|
+
|
|
78
|
+
3. **If there is no other guidance available**, default to `.worktrees/` at the project root.
|
|
79
|
+
|
|
80
|
+
#### Safety Verification (project-local directories only)
|
|
81
|
+
|
|
82
|
+
**MUST verify directory is ignored before creating worktree:**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**If NOT ignored:** Add to .gitignore, commit the change, then proceed.
|
|
89
|
+
|
|
90
|
+
**Why critical:** Prevents accidentally committing worktree contents to repository.
|
|
91
|
+
|
|
92
|
+
#### Create the Worktree
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
project=$(basename "$(git rev-parse --show-toplevel)")
|
|
96
|
+
|
|
97
|
+
# Determine path based on chosen location
|
|
98
|
+
# path="$LOCATION/$BRANCH_NAME"
|
|
99
|
+
|
|
100
|
+
git worktree add "$path" -b "$BRANCH_NAME"
|
|
101
|
+
cd "$path"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Sandbox fallback:** If `git worktree add` fails with a permission error (sandbox denial), tell the user the sandbox blocked worktree creation and you're working in the current directory instead. Then run setup and baseline tests in place.
|
|
105
|
+
|
|
106
|
+
## Step 3: Project Setup
|
|
107
|
+
|
|
108
|
+
Auto-detect and run appropriate setup:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Node.js
|
|
112
|
+
if [ -f package.json ]; then npm install; fi
|
|
113
|
+
|
|
114
|
+
# Rust
|
|
115
|
+
if [ -f Cargo.toml ]; then cargo build; fi
|
|
116
|
+
|
|
117
|
+
# Python
|
|
118
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
119
|
+
if [ -f pyproject.toml ]; then poetry install; fi
|
|
120
|
+
|
|
121
|
+
# Go
|
|
122
|
+
if [ -f go.mod ]; then go mod download; fi
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Step 4: Verify Clean Baseline
|
|
126
|
+
|
|
127
|
+
Run tests to ensure workspace starts clean:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Use project-appropriate command
|
|
131
|
+
npm test / cargo test / pytest / go test ./...
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**If tests fail:** Report failures, ask whether to proceed or investigate.
|
|
135
|
+
|
|
136
|
+
**If tests pass:** Report ready.
|
|
137
|
+
|
|
138
|
+
### Report
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Worktree ready at <full-path>
|
|
142
|
+
Tests passing (<N> tests, 0 failures)
|
|
143
|
+
Ready to implement <feature-name>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Quick Reference
|
|
147
|
+
|
|
148
|
+
| Situation | Action |
|
|
149
|
+
|-----------|--------|
|
|
150
|
+
| Already in linked worktree | Skip creation (Step 0) |
|
|
151
|
+
| In a submodule | Treat as normal repo (Step 0 guard) |
|
|
152
|
+
| Native worktree tool available | Use it (Step 1a) |
|
|
153
|
+
| No native tool | Git worktree fallback (Step 1b) |
|
|
154
|
+
| `.worktrees/` exists | Use it (verify ignored) |
|
|
155
|
+
| `worktrees/` exists | Use it (verify ignored) |
|
|
156
|
+
| Both exist | Use `.worktrees/` |
|
|
157
|
+
| Neither exists | Check instruction file, then default `.worktrees/` |
|
|
158
|
+
| Directory not ignored | Add to .gitignore + commit |
|
|
159
|
+
| Permission error on create | Sandbox fallback, work in place |
|
|
160
|
+
| Tests fail during baseline | Report failures + ask |
|
|
161
|
+
| No package.json/Cargo.toml | Skip dependency install |
|
|
162
|
+
|
|
163
|
+
## Common Mistakes
|
|
164
|
+
|
|
165
|
+
### Fighting the harness
|
|
166
|
+
|
|
167
|
+
- **Problem:** Using `git worktree add` when the platform already provides isolation
|
|
168
|
+
- **Fix:** Step 0 detects existing isolation. Step 1a defers to native tools.
|
|
169
|
+
|
|
170
|
+
### Skipping detection
|
|
171
|
+
|
|
172
|
+
- **Problem:** Creating a nested worktree inside an existing one
|
|
173
|
+
- **Fix:** Always run Step 0 before creating anything
|
|
174
|
+
|
|
175
|
+
### Skipping ignore verification
|
|
176
|
+
|
|
177
|
+
- **Problem:** Worktree contents get tracked, pollute git status
|
|
178
|
+
- **Fix:** Always use `git check-ignore` before creating project-local worktree
|
|
179
|
+
|
|
180
|
+
### Assuming directory location
|
|
181
|
+
|
|
182
|
+
- **Problem:** Creates inconsistency, violates project conventions
|
|
183
|
+
- **Fix:** Follow priority: explicit instructions > existing project-local directory > default
|
|
184
|
+
|
|
185
|
+
### Proceeding with failing tests
|
|
186
|
+
|
|
187
|
+
- **Problem:** Can't distinguish new bugs from pre-existing issues
|
|
188
|
+
- **Fix:** Report failures, get explicit permission to proceed
|
|
189
|
+
|
|
190
|
+
## Red Flags
|
|
191
|
+
|
|
192
|
+
**Never:**
|
|
193
|
+
- Create a worktree when Step 0 detects existing isolation
|
|
194
|
+
- Use `git worktree add` when you have a native worktree tool (e.g., `EnterWorktree`). This is the #1 mistake — if you have it, use it.
|
|
195
|
+
- Skip Step 1a by jumping straight to Step 1b's git commands
|
|
196
|
+
- Create worktree without verifying it's ignored (project-local)
|
|
197
|
+
- Skip baseline test verification
|
|
198
|
+
- Proceed with failing tests without asking
|
|
199
|
+
|
|
200
|
+
**Always:**
|
|
201
|
+
- Run Step 0 detection first
|
|
202
|
+
- Prefer native tools over git fallback
|
|
203
|
+
- Follow directory priority: explicit instructions > existing project-local directory > default
|
|
204
|
+
- Verify directory is ignored for project-local
|
|
205
|
+
- Auto-detect and run project setup
|
|
206
|
+
- Verify clean test baseline
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-hero
|
|
3
|
+
description: Use when starting any coding-assistant task in this project — routes to the right hero-* skill for the current stage of work and explains how session state carries across sessions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using Hero
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
hero-mmt-kit is a human-led workflow: the developer decides what to work on and which skill to invoke next. There is no router doc and no automatic phase gate — this skill is the map, not a controller. Invoke `using-hero` whenever it's unclear which skill applies next.
|
|
11
|
+
|
|
12
|
+
## The core skills
|
|
13
|
+
|
|
14
|
+
| Skill | Use when | Output artifact |
|
|
15
|
+
|---|---|---|
|
|
16
|
+
| `hero-planning` | Starting new work — a feature, bugfix, or refactor that needs a plan before code changes. | `docs/plans/YYYY-MM-DD-slug.md` |
|
|
17
|
+
| `hero-coding` | Implementing an approved plan (or a small change that doesn't need one). | `docs/coding-reports/YYYY-MM-DD-slug.md` |
|
|
18
|
+
| `hero-reviewing` | Fresh-eyes check of an implementation against its plan, before merge. | `docs/reviews/YYYY-MM-DD-slug.md` |
|
|
19
|
+
| `hero-unit-test` | Verifying implementation correctness — TDD-first or post-implementation. | `docs/test-reports/YYYY-MM-DD-slug.md` |
|
|
20
|
+
| `hero-security` | You want an independent OWASP + AI/LLM security review of a sensitive surface. | `docs/security-reports/YYYY-MM-DD-slug.md` |
|
|
21
|
+
| `hero-strict` | Extra rigor is wanted before a "done" claim — a full verification pass. | n/a — appends to the current report. |
|
|
22
|
+
|
|
23
|
+
A typical flow is `hero-planning` → `hero-coding` → `hero-unit-test` and/or `hero-reviewing` → done. Invoke `hero-security` separately when you want a dedicated security pass. Skip stages that don't fit the size of the change — a one-line typo fix doesn't need a plan artifact.
|
|
24
|
+
|
|
25
|
+
## Session state
|
|
26
|
+
|
|
27
|
+
`.hero-mmt-kit/session.json` is a small resume pointer: `currentSkill`, `lastCheckpoint`, `resumePath`, `nextAction`, `updatedAt`. Each hero-* skill's Definition of Done includes writing this file plus updating `docs/ACTIVE_STATE.md`.
|
|
28
|
+
|
|
29
|
+
Resuming work in a fresh session:
|
|
30
|
+
1. Read `.hero-mmt-kit/session.json` (~100 tokens) → `currentSkill`, `resumePath`, `nextAction`.
|
|
31
|
+
2. Read the artifact at `resumePath` for concrete next steps.
|
|
32
|
+
3. If session.json is blank/stale, read `docs/ACTIVE_STATE.md`'s Active Features table instead.
|
|
33
|
+
|
|
34
|
+
## Related vendored skills
|
|
35
|
+
|
|
36
|
+
The hero-* skills wrap general-purpose technique skills rather than duplicate them: `brainstorming`, `writing-plans`, `executing-plans`, `test-driven-development`, `systematic-debugging`, `verification-before-completion`, `requesting-code-review`, `receiving-code-review`, `dispatching-parallel-agents`, `subagent-driven-development`, `using-git-worktrees`, `finishing-a-development-branch`. `hero-security` is the standalone security review skill rather than a wrapper.
|
|
37
|
+
|
|
38
|
+
## Output Style
|
|
39
|
+
|
|
40
|
+
Hero workflow artifacts should be concise by default: compress prose scaffolding, keep every technical fact.
|
|
41
|
+
|
|
42
|
+
Use this rule for chat summaries and generated artifacts:
|
|
43
|
+
- Drop filler, pleasantries, and self-reference.
|
|
44
|
+
- Prefer tight bullets over long explanation.
|
|
45
|
+
- Keep code, commands, API names, error strings, file paths, and numbers verbatim.
|
|
46
|
+
- Preserve the user's language.
|
|
47
|
+
- Do not compress safety-critical content: security warnings, irreversible/destructive actions, production changes, or ambiguous multi-step instructions need full clarity.
|
|
48
|
+
|
|
49
|
+
## Rules
|
|
50
|
+
|
|
51
|
+
- Don't run heavy ceremony for small tasks — a Tiny fix (typo, trivial config) can go straight to `hero-coding` with no plan artifact.
|
|
52
|
+
- Don't claim work is done without the relevant skill's Definition of Done being met.
|
|
53
|
+
- Keep `docs/ACTIVE_STATE.md` as the durable index — link to artifacts, don't duplicate their content there.
|
|
54
|
+
- Write artifact updates in concise-output style: short prose, full evidence, no lost technical detail.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-superpowers
|
|
3
|
+
description: Use when starting any conversation - establishes how to find and use skills, requiring Skill tool invocation before ANY response including clarifying questions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<SUBAGENT-STOP>
|
|
7
|
+
If you were dispatched as a subagent to execute a specific task, skip this skill.
|
|
8
|
+
</SUBAGENT-STOP>
|
|
9
|
+
|
|
10
|
+
<EXTREMELY-IMPORTANT>
|
|
11
|
+
If you think there is even a 1% chance a skill might apply to what you are doing, you ABSOLUTELY MUST invoke the skill.
|
|
12
|
+
|
|
13
|
+
IF A SKILL APPLIES TO YOUR TASK, YOU DO NOT HAVE A CHOICE. YOU MUST USE IT.
|
|
14
|
+
|
|
15
|
+
This is not negotiable. This is not optional. You cannot rationalize your way out of this.
|
|
16
|
+
</EXTREMELY-IMPORTANT>
|
|
17
|
+
|
|
18
|
+
## Instruction Priority
|
|
19
|
+
|
|
20
|
+
Superpowers skills override default system prompt behavior, but **user instructions always take precedence**:
|
|
21
|
+
|
|
22
|
+
1. **User's explicit instructions** (CLAUDE.md, GEMINI.md, AGENTS.md, direct requests) — highest priority
|
|
23
|
+
2. **Superpowers skills** — override default system behavior where they conflict
|
|
24
|
+
3. **Default system prompt** — lowest priority
|
|
25
|
+
|
|
26
|
+
If CLAUDE.md, GEMINI.md, or AGENTS.md says "don't use TDD" and a skill says "always use TDD," follow the user's instructions. The user is in control. Only skip skill workflows or instructions when your human partner has explicitly told you to.
|
|
27
|
+
|
|
28
|
+
## How to Access Skills
|
|
29
|
+
|
|
30
|
+
**In Claude Code:** Use the `Skill` tool. When you invoke a skill, its content is loaded and presented to you—follow it directly. Never use the Read tool on skill files.
|
|
31
|
+
|
|
32
|
+
**In Cursor:** Skills are auto-discovered from `.cursor/skills/`. Read the relevant `SKILL.md` when a skill applies; do not load unrelated skill files.
|
|
33
|
+
|
|
34
|
+
**In Copilot CLI:** Use the `skill` tool. Skills are auto-discovered from installed plugins. The `skill` tool works the same as Claude Code's `Skill` tool.
|
|
35
|
+
|
|
36
|
+
**In Gemini CLI:** Skills activate via the `activate_skill` tool. Gemini loads skill metadata at session start and activates the full content on demand.
|
|
37
|
+
|
|
38
|
+
**In other environments:** Check your platform's documentation for how skills are loaded.
|
|
39
|
+
|
|
40
|
+
## Platform Adaptation
|
|
41
|
+
|
|
42
|
+
Skills use Claude Code tool names; this vendored copy targets Claude Code. For other platforms, map the tool names to your environment's equivalents.
|
|
43
|
+
|
|
44
|
+
# Using Skills
|
|
45
|
+
|
|
46
|
+
## The Rule
|
|
47
|
+
|
|
48
|
+
**Invoke relevant or requested skills BEFORE any response or action.** Even a 1% chance a skill might apply means that you should invoke the skill to check. If an invoked skill turns out to be wrong for the situation, you don't need to use it.
|
|
49
|
+
|
|
50
|
+
```dot
|
|
51
|
+
digraph skill_flow {
|
|
52
|
+
"User message received" [shape=doublecircle];
|
|
53
|
+
"About to EnterPlanMode?" [shape=doublecircle];
|
|
54
|
+
"Already brainstormed?" [shape=diamond];
|
|
55
|
+
"Invoke brainstorming skill" [shape=box];
|
|
56
|
+
"Might any skill apply?" [shape=diamond];
|
|
57
|
+
"Invoke Skill tool" [shape=box];
|
|
58
|
+
"Announce: 'Using [skill] to [purpose]'" [shape=box];
|
|
59
|
+
"Has checklist?" [shape=diamond];
|
|
60
|
+
"Create TodoWrite todo per item" [shape=box];
|
|
61
|
+
"Follow skill exactly" [shape=box];
|
|
62
|
+
"Respond (including clarifications)" [shape=doublecircle];
|
|
63
|
+
|
|
64
|
+
"About to EnterPlanMode?" -> "Already brainstormed?";
|
|
65
|
+
"Already brainstormed?" -> "Invoke brainstorming skill" [label="no"];
|
|
66
|
+
"Already brainstormed?" -> "Might any skill apply?" [label="yes"];
|
|
67
|
+
"Invoke brainstorming skill" -> "Might any skill apply?";
|
|
68
|
+
|
|
69
|
+
"User message received" -> "Might any skill apply?";
|
|
70
|
+
"Might any skill apply?" -> "Invoke Skill tool" [label="yes, even 1%"];
|
|
71
|
+
"Might any skill apply?" -> "Respond (including clarifications)" [label="definitely not"];
|
|
72
|
+
"Invoke Skill tool" -> "Announce: 'Using [skill] to [purpose]'";
|
|
73
|
+
"Announce: 'Using [skill] to [purpose]'" -> "Has checklist?";
|
|
74
|
+
"Has checklist?" -> "Create TodoWrite todo per item" [label="yes"];
|
|
75
|
+
"Has checklist?" -> "Follow skill exactly" [label="no"];
|
|
76
|
+
"Create TodoWrite todo per item" -> "Follow skill exactly";
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Red Flags
|
|
81
|
+
|
|
82
|
+
These thoughts mean STOP—you're rationalizing:
|
|
83
|
+
|
|
84
|
+
| Thought | Reality |
|
|
85
|
+
|---------|---------|
|
|
86
|
+
| "This is just a simple question" | Questions are tasks. Check for skills. |
|
|
87
|
+
| "I need more context first" | Skill check comes BEFORE clarifying questions. |
|
|
88
|
+
| "Let me explore the codebase first" | Skills tell you HOW to explore. Check first. |
|
|
89
|
+
| "I can check git/files quickly" | Files lack conversation context. Check for skills. |
|
|
90
|
+
| "Let me gather information first" | Skills tell you HOW to gather information. |
|
|
91
|
+
| "This doesn't need a formal skill" | If a skill exists, use it. |
|
|
92
|
+
| "I remember this skill" | Skills evolve. Read current version. |
|
|
93
|
+
| "This doesn't count as a task" | Action = task. Check for skills. |
|
|
94
|
+
| "The skill is overkill" | Simple things become complex. Use it. |
|
|
95
|
+
| "I'll just do this one thing first" | Check BEFORE doing anything. |
|
|
96
|
+
| "This feels productive" | Undisciplined action wastes time. Skills prevent this. |
|
|
97
|
+
| "I know what that means" | Knowing the concept ≠ using the skill. Invoke it. |
|
|
98
|
+
|
|
99
|
+
## Skill Priority
|
|
100
|
+
|
|
101
|
+
When multiple skills could apply, use this order:
|
|
102
|
+
|
|
103
|
+
1. **Process skills first** (brainstorming, debugging) - these determine HOW to approach the task
|
|
104
|
+
2. **Implementation skills second** (frontend-design, mcp-builder) - these guide execution
|
|
105
|
+
|
|
106
|
+
"Let's build X" → brainstorming first, then implementation skills.
|
|
107
|
+
"Fix this bug" → debugging first, then domain-specific skills.
|
|
108
|
+
|
|
109
|
+
## Skill Types
|
|
110
|
+
|
|
111
|
+
**Rigid** (TDD, debugging): Follow exactly. Don't adapt away discipline.
|
|
112
|
+
|
|
113
|
+
**Flexible** (patterns): Adapt principles to context.
|
|
114
|
+
|
|
115
|
+
The skill itself tells you which.
|
|
116
|
+
|
|
117
|
+
## User Instructions
|
|
118
|
+
|
|
119
|
+
Instructions say WHAT, not HOW. "Add X" or "Fix Y" doesn't mean skip workflows.
|