@hecer/yoke 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +494 -0
- package/canon/AGENTS.md +28 -0
- package/canon/context/DECISIONS.md +4 -0
- package/canon/context/KNOWLEDGE.md +4 -0
- package/canon/context/PROJECT.md +15 -0
- package/canon/loop/loop-spec.md +30 -0
- package/canon/loop/prd.schema.md +14 -0
- package/canon/manifest.yaml +47 -0
- package/canon/policy/gates.md +7 -0
- package/canon/policy/roles.md +9 -0
- package/canon/skills/ATTRIBUTION.md +71 -0
- package/canon/skills/authoring-prd/SKILL.md +44 -0
- package/canon/skills/brainstorming/SKILL.md +164 -0
- package/canon/skills/dispatching-parallel-agents/SKILL.md +182 -0
- package/canon/skills/document-release/SKILL.md +297 -0
- package/canon/skills/executing-plans/SKILL.md +70 -0
- package/canon/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/canon/skills/health/SKILL.md +177 -0
- package/canon/skills/maintaining-context/SKILL.md +34 -0
- package/canon/skills/minimal-code/SKILL.md +21 -0
- package/canon/skills/plan-ceo-review/SKILL.md +541 -0
- package/canon/skills/plan-eng-review/SKILL.md +362 -0
- package/canon/skills/receiving-code-review/SKILL.md +213 -0
- package/canon/skills/requesting-code-review/SKILL.md +105 -0
- package/canon/skills/retro/SKILL.md +397 -0
- package/canon/skills/review/SKILL.md +246 -0
- package/canon/skills/ship/SKILL.md +696 -0
- package/canon/skills/subagent-driven-development/SKILL.md +277 -0
- package/canon/skills/systematic-debugging/SKILL.md +296 -0
- package/canon/skills/tdd/SKILL.md +371 -0
- package/canon/skills/unslop-ui/SKILL.md +34 -0
- package/canon/skills/using-git-worktrees/SKILL.md +218 -0
- package/canon/skills/verification-before-completion/SKILL.md +139 -0
- package/canon/skills/visual-verification/SKILL.md +54 -0
- package/canon/skills/workflow/SKILL.md +18 -0
- package/canon/skills/writing-plans/SKILL.md +152 -0
- package/canon/skills/writing-skills/SKILL.md +655 -0
- package/canon/skills/yoke-retrofit/SKILL.md +18 -0
- package/canon/tools/graphify.md +3 -0
- package/canon/tools/playwright-mcp.md +3 -0
- package/canon/tools/rtk.md +7 -0
- package/canon/tools/serena.md +7 -0
- package/dist/canon/frontmatter.js +10 -0
- package/dist/canon/manifest.js +26 -0
- package/dist/canon/validate.js +73 -0
- package/dist/cli.js +244 -0
- package/dist/context/command.js +33 -0
- package/dist/context/context.js +57 -0
- package/dist/loop/cleanup.js +42 -0
- package/dist/loop/gates.js +12 -0
- package/dist/loop/git.js +25 -0
- package/dist/loop/lock.js +45 -0
- package/dist/loop/loop.js +190 -0
- package/dist/loop/prd.js +29 -0
- package/dist/loop/reporter.js +91 -0
- package/dist/loop/run-command.js +134 -0
- package/dist/loop/runner.js +157 -0
- package/dist/loop/verify.js +38 -0
- package/dist/loop/watchdog.js +86 -0
- package/dist/new/command.js +53 -0
- package/dist/prd/command.js +129 -0
- package/dist/retrofit/apply.js +54 -0
- package/dist/retrofit/canon-dir.js +22 -0
- package/dist/retrofit/command.js +37 -0
- package/dist/retrofit/config.js +53 -0
- package/dist/retrofit/context-actions.js +21 -0
- package/dist/retrofit/detect.js +17 -0
- package/dist/retrofit/gitignore.js +26 -0
- package/dist/retrofit/gstack.js +19 -0
- package/dist/retrofit/merge-json.js +38 -0
- package/dist/retrofit/plan.js +29 -0
- package/dist/retrofit/planners/claude.js +67 -0
- package/dist/retrofit/planners/codex.js +36 -0
- package/dist/retrofit/planners/gemini.js +54 -0
- package/dist/retrofit/report.js +14 -0
- package/dist/retrofit/tools.js +23 -0
- package/dist/retrofit/wsl.js +15 -0
- package/dist/review/command.js +43 -0
- package/dist/scan/design.js +79 -0
- package/dist/smoke/command.js +141 -0
- package/package.json +61 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-driven-development
|
|
3
|
+
description: Use when implementing any feature or bugfix, before writing implementation code
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test-Driven Development (TDD)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Write the test first. Watch it fail. Write minimal code to pass.
|
|
11
|
+
|
|
12
|
+
**Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
|
|
13
|
+
|
|
14
|
+
**Violating the letter of the rules is violating the spirit of the rules.**
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
**Always:**
|
|
19
|
+
- New features
|
|
20
|
+
- Bug fixes
|
|
21
|
+
- Refactoring
|
|
22
|
+
- Behavior changes
|
|
23
|
+
|
|
24
|
+
**Exceptions (ask your human partner):**
|
|
25
|
+
- Throwaway prototypes
|
|
26
|
+
- Generated code
|
|
27
|
+
- Configuration files
|
|
28
|
+
|
|
29
|
+
Thinking "skip TDD just this once"? Stop. That's rationalization.
|
|
30
|
+
|
|
31
|
+
## The Iron Law
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Write code before the test? Delete it. Start over.
|
|
38
|
+
|
|
39
|
+
**No exceptions:**
|
|
40
|
+
- Don't keep it as "reference"
|
|
41
|
+
- Don't "adapt" it while writing tests
|
|
42
|
+
- Don't look at it
|
|
43
|
+
- Delete means delete
|
|
44
|
+
|
|
45
|
+
Implement fresh from tests. Period.
|
|
46
|
+
|
|
47
|
+
## Red-Green-Refactor
|
|
48
|
+
|
|
49
|
+
```dot
|
|
50
|
+
digraph tdd_cycle {
|
|
51
|
+
rankdir=LR;
|
|
52
|
+
red [label="RED\nWrite failing test", shape=box, style=filled, fillcolor="#ffcccc"];
|
|
53
|
+
verify_red [label="Verify fails\ncorrectly", shape=diamond];
|
|
54
|
+
green [label="GREEN\nMinimal code", shape=box, style=filled, fillcolor="#ccffcc"];
|
|
55
|
+
verify_green [label="Verify passes\nAll green", shape=diamond];
|
|
56
|
+
refactor [label="REFACTOR\nClean up", shape=box, style=filled, fillcolor="#ccccff"];
|
|
57
|
+
next [label="Next", shape=ellipse];
|
|
58
|
+
|
|
59
|
+
red -> verify_red;
|
|
60
|
+
verify_red -> green [label="yes"];
|
|
61
|
+
verify_red -> red [label="wrong\nfailure"];
|
|
62
|
+
green -> verify_green;
|
|
63
|
+
verify_green -> refactor [label="yes"];
|
|
64
|
+
verify_green -> green [label="no"];
|
|
65
|
+
refactor -> verify_green [label="stay\ngreen"];
|
|
66
|
+
verify_green -> next;
|
|
67
|
+
next -> red;
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### RED - Write Failing Test
|
|
72
|
+
|
|
73
|
+
Write one minimal test showing what should happen.
|
|
74
|
+
|
|
75
|
+
<Good>
|
|
76
|
+
```typescript
|
|
77
|
+
test('retries failed operations 3 times', async () => {
|
|
78
|
+
let attempts = 0;
|
|
79
|
+
const operation = () => {
|
|
80
|
+
attempts++;
|
|
81
|
+
if (attempts < 3) throw new Error('fail');
|
|
82
|
+
return 'success';
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const result = await retryOperation(operation);
|
|
86
|
+
|
|
87
|
+
expect(result).toBe('success');
|
|
88
|
+
expect(attempts).toBe(3);
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
Clear name, tests real behavior, one thing
|
|
92
|
+
</Good>
|
|
93
|
+
|
|
94
|
+
<Bad>
|
|
95
|
+
```typescript
|
|
96
|
+
test('retry works', async () => {
|
|
97
|
+
const mock = jest.fn()
|
|
98
|
+
.mockRejectedValueOnce(new Error())
|
|
99
|
+
.mockRejectedValueOnce(new Error())
|
|
100
|
+
.mockResolvedValueOnce('success');
|
|
101
|
+
await retryOperation(mock);
|
|
102
|
+
expect(mock).toHaveBeenCalledTimes(3);
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
Vague name, tests mock not code
|
|
106
|
+
</Bad>
|
|
107
|
+
|
|
108
|
+
**Requirements:**
|
|
109
|
+
- One behavior
|
|
110
|
+
- Clear name
|
|
111
|
+
- Real code (no mocks unless unavoidable)
|
|
112
|
+
|
|
113
|
+
### Verify RED - Watch It Fail
|
|
114
|
+
|
|
115
|
+
**MANDATORY. Never skip.**
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm test path/to/test.test.ts
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Confirm:
|
|
122
|
+
- Test fails (not errors)
|
|
123
|
+
- Failure message is expected
|
|
124
|
+
- Fails because feature missing (not typos)
|
|
125
|
+
|
|
126
|
+
**Test passes?** You're testing existing behavior. Fix test.
|
|
127
|
+
|
|
128
|
+
**Test errors?** Fix error, re-run until it fails correctly.
|
|
129
|
+
|
|
130
|
+
### GREEN - Minimal Code
|
|
131
|
+
|
|
132
|
+
Write simplest code to pass the test.
|
|
133
|
+
|
|
134
|
+
<Good>
|
|
135
|
+
```typescript
|
|
136
|
+
async function retryOperation<T>(fn: () => Promise<T>): Promise<T> {
|
|
137
|
+
for (let i = 0; i < 3; i++) {
|
|
138
|
+
try {
|
|
139
|
+
return await fn();
|
|
140
|
+
} catch (e) {
|
|
141
|
+
if (i === 2) throw e;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
throw new Error('unreachable');
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
Just enough to pass
|
|
148
|
+
</Good>
|
|
149
|
+
|
|
150
|
+
<Bad>
|
|
151
|
+
```typescript
|
|
152
|
+
async function retryOperation<T>(
|
|
153
|
+
fn: () => Promise<T>,
|
|
154
|
+
options?: {
|
|
155
|
+
maxRetries?: number;
|
|
156
|
+
backoff?: 'linear' | 'exponential';
|
|
157
|
+
onRetry?: (attempt: number) => void;
|
|
158
|
+
}
|
|
159
|
+
): Promise<T> {
|
|
160
|
+
// YAGNI
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
Over-engineered
|
|
164
|
+
</Bad>
|
|
165
|
+
|
|
166
|
+
Don't add features, refactor other code, or "improve" beyond the test.
|
|
167
|
+
|
|
168
|
+
### Verify GREEN - Watch It Pass
|
|
169
|
+
|
|
170
|
+
**MANDATORY.**
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npm test path/to/test.test.ts
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Confirm:
|
|
177
|
+
- Test passes
|
|
178
|
+
- Other tests still pass
|
|
179
|
+
- Output pristine (no errors, warnings)
|
|
180
|
+
|
|
181
|
+
**Test fails?** Fix code, not test.
|
|
182
|
+
|
|
183
|
+
**Other tests fail?** Fix now.
|
|
184
|
+
|
|
185
|
+
### REFACTOR - Clean Up
|
|
186
|
+
|
|
187
|
+
After green only:
|
|
188
|
+
- Remove duplication
|
|
189
|
+
- Improve names
|
|
190
|
+
- Extract helpers
|
|
191
|
+
|
|
192
|
+
Keep tests green. Don't add behavior.
|
|
193
|
+
|
|
194
|
+
### Repeat
|
|
195
|
+
|
|
196
|
+
Next failing test for next feature.
|
|
197
|
+
|
|
198
|
+
## Good Tests
|
|
199
|
+
|
|
200
|
+
| Quality | Good | Bad |
|
|
201
|
+
|---------|------|-----|
|
|
202
|
+
| **Minimal** | One thing. "and" in name? Split it. | `test('validates email and domain and whitespace')` |
|
|
203
|
+
| **Clear** | Name describes behavior | `test('test1')` |
|
|
204
|
+
| **Shows intent** | Demonstrates desired API | Obscures what code should do |
|
|
205
|
+
|
|
206
|
+
## Why Order Matters
|
|
207
|
+
|
|
208
|
+
**"I'll write tests after to verify it works"**
|
|
209
|
+
|
|
210
|
+
Tests written after code pass immediately. Passing immediately proves nothing:
|
|
211
|
+
- Might test wrong thing
|
|
212
|
+
- Might test implementation, not behavior
|
|
213
|
+
- Might miss edge cases you forgot
|
|
214
|
+
- You never saw it catch the bug
|
|
215
|
+
|
|
216
|
+
Test-first forces you to see the test fail, proving it actually tests something.
|
|
217
|
+
|
|
218
|
+
**"I already manually tested all the edge cases"**
|
|
219
|
+
|
|
220
|
+
Manual testing is ad-hoc. You think you tested everything but:
|
|
221
|
+
- No record of what you tested
|
|
222
|
+
- Can't re-run when code changes
|
|
223
|
+
- Easy to forget cases under pressure
|
|
224
|
+
- "It worked when I tried it" ≠ comprehensive
|
|
225
|
+
|
|
226
|
+
Automated tests are systematic. They run the same way every time.
|
|
227
|
+
|
|
228
|
+
**"Deleting X hours of work is wasteful"**
|
|
229
|
+
|
|
230
|
+
Sunk cost fallacy. The time is already gone. Your choice now:
|
|
231
|
+
- Delete and rewrite with TDD (X more hours, high confidence)
|
|
232
|
+
- Keep it and add tests after (30 min, low confidence, likely bugs)
|
|
233
|
+
|
|
234
|
+
The "waste" is keeping code you can't trust. Working code without real tests is technical debt.
|
|
235
|
+
|
|
236
|
+
**"TDD is dogmatic, being pragmatic means adapting"**
|
|
237
|
+
|
|
238
|
+
TDD IS pragmatic:
|
|
239
|
+
- Finds bugs before commit (faster than debugging after)
|
|
240
|
+
- Prevents regressions (tests catch breaks immediately)
|
|
241
|
+
- Documents behavior (tests show how to use code)
|
|
242
|
+
- Enables refactoring (change freely, tests catch breaks)
|
|
243
|
+
|
|
244
|
+
"Pragmatic" shortcuts = debugging in production = slower.
|
|
245
|
+
|
|
246
|
+
**"Tests after achieve the same goals - it's spirit not ritual"**
|
|
247
|
+
|
|
248
|
+
No. Tests-after answer "What does this do?" Tests-first answer "What should this do?"
|
|
249
|
+
|
|
250
|
+
Tests-after are biased by your implementation. You test what you built, not what's required. You verify remembered edge cases, not discovered ones.
|
|
251
|
+
|
|
252
|
+
Tests-first force edge case discovery before implementing. Tests-after verify you remembered everything (you didn't).
|
|
253
|
+
|
|
254
|
+
30 minutes of tests after ≠ TDD. You get coverage, lose proof tests work.
|
|
255
|
+
|
|
256
|
+
## Common Rationalizations
|
|
257
|
+
|
|
258
|
+
| Excuse | Reality |
|
|
259
|
+
|--------|---------|
|
|
260
|
+
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
|
|
261
|
+
| "I'll test after" | Tests passing immediately prove nothing. |
|
|
262
|
+
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
|
|
263
|
+
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
|
|
264
|
+
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
|
|
265
|
+
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
|
|
266
|
+
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
|
|
267
|
+
| "Test hard = design unclear" | Listen to test. Hard to test = hard to use. |
|
|
268
|
+
| "TDD will slow me down" | TDD faster than debugging. Pragmatic = test-first. |
|
|
269
|
+
| "Manual test faster" | Manual doesn't prove edge cases. You'll re-test every change. |
|
|
270
|
+
| "Existing code has no tests" | You're improving it. Add tests for existing code. |
|
|
271
|
+
|
|
272
|
+
## Red Flags - STOP and Start Over
|
|
273
|
+
|
|
274
|
+
- Code before test
|
|
275
|
+
- Test after implementation
|
|
276
|
+
- Test passes immediately
|
|
277
|
+
- Can't explain why test failed
|
|
278
|
+
- Tests added "later"
|
|
279
|
+
- Rationalizing "just this once"
|
|
280
|
+
- "I already manually tested it"
|
|
281
|
+
- "Tests after achieve the same purpose"
|
|
282
|
+
- "It's about spirit not ritual"
|
|
283
|
+
- "Keep as reference" or "adapt existing code"
|
|
284
|
+
- "Already spent X hours, deleting is wasteful"
|
|
285
|
+
- "TDD is dogmatic, I'm being pragmatic"
|
|
286
|
+
- "This is different because..."
|
|
287
|
+
|
|
288
|
+
**All of these mean: Delete code. Start over with TDD.**
|
|
289
|
+
|
|
290
|
+
## Example: Bug Fix
|
|
291
|
+
|
|
292
|
+
**Bug:** Empty email accepted
|
|
293
|
+
|
|
294
|
+
**RED**
|
|
295
|
+
```typescript
|
|
296
|
+
test('rejects empty email', async () => {
|
|
297
|
+
const result = await submitForm({ email: '' });
|
|
298
|
+
expect(result.error).toBe('Email required');
|
|
299
|
+
});
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Verify RED**
|
|
303
|
+
```bash
|
|
304
|
+
$ npm test
|
|
305
|
+
FAIL: expected 'Email required', got undefined
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**GREEN**
|
|
309
|
+
```typescript
|
|
310
|
+
function submitForm(data: FormData) {
|
|
311
|
+
if (!data.email?.trim()) {
|
|
312
|
+
return { error: 'Email required' };
|
|
313
|
+
}
|
|
314
|
+
// ...
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**Verify GREEN**
|
|
319
|
+
```bash
|
|
320
|
+
$ npm test
|
|
321
|
+
PASS
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**REFACTOR**
|
|
325
|
+
Extract validation for multiple fields if needed.
|
|
326
|
+
|
|
327
|
+
## Verification Checklist
|
|
328
|
+
|
|
329
|
+
Before marking work complete:
|
|
330
|
+
|
|
331
|
+
- [ ] Every new function/method has a test
|
|
332
|
+
- [ ] Watched each test fail before implementing
|
|
333
|
+
- [ ] Each test failed for expected reason (feature missing, not typo)
|
|
334
|
+
- [ ] Wrote minimal code to pass each test
|
|
335
|
+
- [ ] All tests pass
|
|
336
|
+
- [ ] Output pristine (no errors, warnings)
|
|
337
|
+
- [ ] Tests use real code (mocks only if unavoidable)
|
|
338
|
+
- [ ] Edge cases and errors covered
|
|
339
|
+
|
|
340
|
+
Can't check all boxes? You skipped TDD. Start over.
|
|
341
|
+
|
|
342
|
+
## When Stuck
|
|
343
|
+
|
|
344
|
+
| Problem | Solution |
|
|
345
|
+
|---------|----------|
|
|
346
|
+
| Don't know how to test | Write wished-for API. Write assertion first. Ask your human partner. |
|
|
347
|
+
| Test too complicated | Design too complicated. Simplify interface. |
|
|
348
|
+
| Must mock everything | Code too coupled. Use dependency injection. |
|
|
349
|
+
| Test setup huge | Extract helpers. Still complex? Simplify design. |
|
|
350
|
+
|
|
351
|
+
## Debugging Integration
|
|
352
|
+
|
|
353
|
+
Bug found? Write failing test reproducing it. Follow TDD cycle. Test proves fix and prevents regression.
|
|
354
|
+
|
|
355
|
+
Never fix bugs without a test.
|
|
356
|
+
|
|
357
|
+
## Testing Anti-Patterns
|
|
358
|
+
|
|
359
|
+
When adding mocks or test utilities, read @testing-anti-patterns.md to avoid common pitfalls:
|
|
360
|
+
- Testing mock behavior instead of real behavior
|
|
361
|
+
- Adding test-only methods to production classes
|
|
362
|
+
- Mocking without understanding dependencies
|
|
363
|
+
|
|
364
|
+
## Final Rule
|
|
365
|
+
|
|
366
|
+
```
|
|
367
|
+
Production code → test exists and failed first
|
|
368
|
+
Otherwise → not TDD
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
No exceptions without your human partner's permission.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: unslop-ui
|
|
3
|
+
description: Use when building or reviewing any UI — detect and remove the visual "tells" of AI-generated/vibecoded design (AI-purple gradients, gradient hero text, neon glow, emoji-as-icons, untouched shadcn defaults, centered-hero-plus-three-cards) so the result looks deliberately designed, not machine-default.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Un-slop the UI
|
|
7
|
+
|
|
8
|
+
AI-built UIs are "recognizable on sight" — a homogeneous look from a handful of default choices.
|
|
9
|
+
Before finishing UI work, remove these tells. Run `yoke design-scan .` for the statically
|
|
10
|
+
detectable ones, then apply judgement for the structural ones the scanner can't see.
|
|
11
|
+
|
|
12
|
+
## The ranked tells (and the fix)
|
|
13
|
+
|
|
14
|
+
- **AI-purple gradients** (the #1 tell) — purple/violet gradients and `#6c5ce7`-family accents.
|
|
15
|
+
→ Choose one real brand color with intent; avoid purple-by-default.
|
|
16
|
+
- **Gradient hero text** — `bg-clip-text text-transparent` rainbow headings.
|
|
17
|
+
→ Solid color + type weight/scale for emphasis.
|
|
18
|
+
- **Neon glow** — `0 0 Npx` colored box-shadows / `shadow-[0_0_...]`.
|
|
19
|
+
→ Subtle, neutral elevation (small offset, low blur, low opacity).
|
|
20
|
+
- **Emoji-as-icons** — 🚀✨🔥 in buttons/nav/feature lists.
|
|
21
|
+
→ A real icon set (lucide, etc.), consistent stroke + size.
|
|
22
|
+
- **Untouched shadcn/Tailwind defaults** — default radius, default slate everywhere.
|
|
23
|
+
→ Set deliberate tokens (radius, spacing scale, one accent) so it doesn't look boilerplate.
|
|
24
|
+
- **Centered hero + three feature cards** — the canonical AI landing layout.
|
|
25
|
+
→ Vary rhythm: asymmetry, a real product shot, content density that fits the product.
|
|
26
|
+
- **Homogeneous spacing / no hierarchy** — everything the same size and gap.
|
|
27
|
+
→ Establish a type scale and spacing rhythm; make the primary action obviously primary.
|
|
28
|
+
|
|
29
|
+
## Rule
|
|
30
|
+
|
|
31
|
+
Treat `yoke design-scan .` as a gate (it exits non-zero over budget). Fix findings, then
|
|
32
|
+
eyeball the structural tells above. Distinctive, intentional > generic-but-safe.
|
|
33
|
+
|
|
34
|
+
*Rubric informed by the MIT-licensed research in [vibecoded-design-tells](https://github.com/JCarterJohnson/vibecoded-design-tells) (© Carter Johnson). Yoke implements the idea natively; no code/data copied.*
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: using-git-worktrees
|
|
3
|
+
description: Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Using Git Worktrees
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.
|
|
11
|
+
|
|
12
|
+
**Core principle:** Systematic directory selection + safety verification = reliable isolation.
|
|
13
|
+
|
|
14
|
+
**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
|
|
15
|
+
|
|
16
|
+
## Directory Selection Process
|
|
17
|
+
|
|
18
|
+
Follow this priority order:
|
|
19
|
+
|
|
20
|
+
### 1. Check Existing Directories
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Check in priority order
|
|
24
|
+
ls -d .worktrees 2>/dev/null # Preferred (hidden)
|
|
25
|
+
ls -d worktrees 2>/dev/null # Alternative
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**If found:** Use that directory. If both exist, `.worktrees` wins.
|
|
29
|
+
|
|
30
|
+
### 2. Check CLAUDE.md
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
grep -i "worktree.*director" CLAUDE.md 2>/dev/null
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**If preference specified:** Use it without asking.
|
|
37
|
+
|
|
38
|
+
### 3. Ask User
|
|
39
|
+
|
|
40
|
+
If no directory exists and no CLAUDE.md preference:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
No worktree directory found. Where should I create worktrees?
|
|
44
|
+
|
|
45
|
+
1. .worktrees/ (project-local, hidden)
|
|
46
|
+
2. ~/.config/superpowers/worktrees/<project-name>/ (global location)
|
|
47
|
+
|
|
48
|
+
Which would you prefer?
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Safety Verification
|
|
52
|
+
|
|
53
|
+
### For Project-Local Directories (.worktrees or worktrees)
|
|
54
|
+
|
|
55
|
+
**MUST verify directory is ignored before creating worktree:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Check if directory is ignored (respects local, global, and system gitignore)
|
|
59
|
+
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**If NOT ignored:**
|
|
63
|
+
|
|
64
|
+
Per Jesse's rule "Fix broken things immediately":
|
|
65
|
+
1. Add appropriate line to .gitignore
|
|
66
|
+
2. Commit the change
|
|
67
|
+
3. Proceed with worktree creation
|
|
68
|
+
|
|
69
|
+
**Why critical:** Prevents accidentally committing worktree contents to repository.
|
|
70
|
+
|
|
71
|
+
### For Global Directory (~/.config/superpowers/worktrees)
|
|
72
|
+
|
|
73
|
+
No .gitignore verification needed - outside project entirely.
|
|
74
|
+
|
|
75
|
+
## Creation Steps
|
|
76
|
+
|
|
77
|
+
### 1. Detect Project Name
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
project=$(basename "$(git rev-parse --show-toplevel)")
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 2. Create Worktree
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Determine full path
|
|
87
|
+
case $LOCATION in
|
|
88
|
+
.worktrees|worktrees)
|
|
89
|
+
path="$LOCATION/$BRANCH_NAME"
|
|
90
|
+
;;
|
|
91
|
+
~/.config/superpowers/worktrees/*)
|
|
92
|
+
path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
|
|
93
|
+
;;
|
|
94
|
+
esac
|
|
95
|
+
|
|
96
|
+
# Create worktree with new branch
|
|
97
|
+
git worktree add "$path" -b "$BRANCH_NAME"
|
|
98
|
+
cd "$path"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 3. Run Project Setup
|
|
102
|
+
|
|
103
|
+
Auto-detect and run appropriate setup:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Node.js
|
|
107
|
+
if [ -f package.json ]; then npm install; fi
|
|
108
|
+
|
|
109
|
+
# Rust
|
|
110
|
+
if [ -f Cargo.toml ]; then cargo build; fi
|
|
111
|
+
|
|
112
|
+
# Python
|
|
113
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
114
|
+
if [ -f pyproject.toml ]; then poetry install; fi
|
|
115
|
+
|
|
116
|
+
# Go
|
|
117
|
+
if [ -f go.mod ]; then go mod download; fi
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 4. Verify Clean Baseline
|
|
121
|
+
|
|
122
|
+
Run tests to ensure worktree starts clean:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Examples - use project-appropriate command
|
|
126
|
+
npm test
|
|
127
|
+
cargo test
|
|
128
|
+
pytest
|
|
129
|
+
go test ./...
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**If tests fail:** Report failures, ask whether to proceed or investigate.
|
|
133
|
+
|
|
134
|
+
**If tests pass:** Report ready.
|
|
135
|
+
|
|
136
|
+
### 5. Report Location
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
Worktree ready at <full-path>
|
|
140
|
+
Tests passing (<N> tests, 0 failures)
|
|
141
|
+
Ready to implement <feature-name>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Quick Reference
|
|
145
|
+
|
|
146
|
+
| Situation | Action |
|
|
147
|
+
|-----------|--------|
|
|
148
|
+
| `.worktrees/` exists | Use it (verify ignored) |
|
|
149
|
+
| `worktrees/` exists | Use it (verify ignored) |
|
|
150
|
+
| Both exist | Use `.worktrees/` |
|
|
151
|
+
| Neither exists | Check CLAUDE.md → Ask user |
|
|
152
|
+
| Directory not ignored | Add to .gitignore + commit |
|
|
153
|
+
| Tests fail during baseline | Report failures + ask |
|
|
154
|
+
| No package.json/Cargo.toml | Skip dependency install |
|
|
155
|
+
|
|
156
|
+
## Common Mistakes
|
|
157
|
+
|
|
158
|
+
### Skipping ignore verification
|
|
159
|
+
|
|
160
|
+
- **Problem:** Worktree contents get tracked, pollute git status
|
|
161
|
+
- **Fix:** Always use `git check-ignore` before creating project-local worktree
|
|
162
|
+
|
|
163
|
+
### Assuming directory location
|
|
164
|
+
|
|
165
|
+
- **Problem:** Creates inconsistency, violates project conventions
|
|
166
|
+
- **Fix:** Follow priority: existing > CLAUDE.md > ask
|
|
167
|
+
|
|
168
|
+
### Proceeding with failing tests
|
|
169
|
+
|
|
170
|
+
- **Problem:** Can't distinguish new bugs from pre-existing issues
|
|
171
|
+
- **Fix:** Report failures, get explicit permission to proceed
|
|
172
|
+
|
|
173
|
+
### Hardcoding setup commands
|
|
174
|
+
|
|
175
|
+
- **Problem:** Breaks on projects using different tools
|
|
176
|
+
- **Fix:** Auto-detect from project files (package.json, etc.)
|
|
177
|
+
|
|
178
|
+
## Example Workflow
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
You: I'm using the using-git-worktrees skill to set up an isolated workspace.
|
|
182
|
+
|
|
183
|
+
[Check .worktrees/ - exists]
|
|
184
|
+
[Verify ignored - git check-ignore confirms .worktrees/ is ignored]
|
|
185
|
+
[Create worktree: git worktree add .worktrees/auth -b feature/auth]
|
|
186
|
+
[Run npm install]
|
|
187
|
+
[Run npm test - 47 passing]
|
|
188
|
+
|
|
189
|
+
Worktree ready at /Users/jesse/myproject/.worktrees/auth
|
|
190
|
+
Tests passing (47 tests, 0 failures)
|
|
191
|
+
Ready to implement auth feature
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Red Flags
|
|
195
|
+
|
|
196
|
+
**Never:**
|
|
197
|
+
- Create worktree without verifying it's ignored (project-local)
|
|
198
|
+
- Skip baseline test verification
|
|
199
|
+
- Proceed with failing tests without asking
|
|
200
|
+
- Assume directory location when ambiguous
|
|
201
|
+
- Skip CLAUDE.md check
|
|
202
|
+
|
|
203
|
+
**Always:**
|
|
204
|
+
- Follow directory priority: existing > CLAUDE.md > ask
|
|
205
|
+
- Verify directory is ignored for project-local
|
|
206
|
+
- Auto-detect and run project setup
|
|
207
|
+
- Verify clean test baseline
|
|
208
|
+
|
|
209
|
+
## Integration
|
|
210
|
+
|
|
211
|
+
**Called by:**
|
|
212
|
+
- **brainstorming** (Phase 4) - REQUIRED when design is approved and implementation follows
|
|
213
|
+
- **subagent-driven-development** - REQUIRED before executing any tasks
|
|
214
|
+
- **executing-plans** - REQUIRED before executing any tasks
|
|
215
|
+
- Any skill needing isolated workspace
|
|
216
|
+
|
|
217
|
+
**Pairs with:**
|
|
218
|
+
- **finishing-a-development-branch** - REQUIRED for cleanup after work complete
|