natureco-cli 5.18.3 → 5.19.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/package.json +1 -1
- package/skills/airunway-aks-setup/SKILL.md +73 -0
- package/skills/algorithmic-art/SKILL.md +405 -0
- package/skills/appinsights-instrumentation/SKILL.md +76 -0
- package/skills/azure-ai/SKILL.md +71 -0
- package/skills/azure-aigateway/SKILL.md +129 -0
- package/skills/azure-cloud-migrate/SKILL.md +52 -0
- package/skills/azure-compliance/SKILL.md +108 -0
- package/skills/azure-compute/SKILL.md +46 -0
- package/skills/azure-cost/SKILL.md +45 -0
- package/skills/azure-deploy/SKILL.md +97 -0
- package/skills/azure-diagnostics/SKILL.md +151 -0
- package/skills/azure-enterprise-infra-planner/SKILL.md +54 -0
- package/skills/azure-hosted-copilot-sdk/SKILL.md +89 -0
- package/skills/azure-kubernetes/SKILL.md +153 -0
- package/skills/azure-kusto/SKILL.md +231 -0
- package/skills/azure-messaging/SKILL.md +57 -0
- package/skills/azure-prepare/SKILL.md +165 -0
- package/skills/azure-quotas/SKILL.md +276 -0
- package/skills/azure-rbac/SKILL.md +17 -0
- package/skills/azure-reliability/SKILL.md +387 -0
- package/skills/azure-resource-lookup/SKILL.md +108 -0
- package/skills/azure-resource-visualizer/SKILL.md +183 -0
- package/skills/azure-storage/SKILL.md +100 -0
- package/skills/azure-upgrade/SKILL.md +91 -0
- package/skills/azure-validate/SKILL.md +72 -0
- package/skills/brainstorming/SKILL.md +159 -0
- package/skills/brand-guidelines/SKILL.md +73 -0
- package/skills/brandkit/SKILL.md +798 -0
- package/skills/brutalist-skill/SKILL.md +92 -0
- package/skills/canvas-design/SKILL.md +130 -0
- package/skills/cavecrew/SKILL.md +82 -0
- package/skills/caveman-commit/SKILL.md +65 -0
- package/skills/caveman-help/SKILL.md +63 -0
- package/skills/caveman-review/SKILL.md +55 -0
- package/skills/caveman-stats/SKILL.md +10 -0
- package/skills/claude-api/SKILL.md +356 -0
- package/skills/composition-patterns/SKILL.md +89 -0
- package/skills/decision-mapping/SKILL.md +84 -0
- package/skills/deploy-to-vercel/SKILL.md +296 -0
- package/skills/design-an-interface/SKILL.md +94 -0
- package/skills/design-doc-mermaid/SKILL.md +498 -0
- package/skills/develop-userscripts/SKILL.md +84 -0
- package/skills/doc-coauthoring/SKILL.md +375 -0
- package/skills/documentation/SKILL.md +109 -0
- package/skills/docx/SKILL.md +590 -0
- package/skills/edit-article/SKILL.md +15 -0
- package/skills/entra-agent-id/SKILL.md +356 -0
- package/skills/entra-app-registration/SKILL.md +191 -0
- package/skills/faceless-explainer/SKILL.md +202 -0
- package/skills/fastify/SKILL.md +75 -0
- package/skills/general-video/SKILL.md +143 -0
- package/skills/git-guardrails-claude-code/SKILL.md +95 -0
- package/skills/github-actions-docs/SKILL.md +98 -0
- package/skills/gpt-tasteskill/SKILL.md +74 -0
- package/skills/grill-me/SKILL.md +7 -0
- package/skills/grilling/SKILL.md +10 -0
- package/skills/handoff/SKILL.md +16 -0
- package/skills/hyperframes/SKILL.md +152 -0
- package/skills/hyperframes-animation/SKILL.md +82 -0
- package/skills/hyperframes-cli/SKILL.md +109 -0
- package/skills/hyperframes-core/SKILL.md +78 -0
- package/skills/hyperframes-creative/SKILL.md +68 -0
- package/skills/hyperframes-media/SKILL.md +97 -0
- package/skills/image-to-code-skill/SKILL.md +1228 -0
- package/skills/imagegen-frontend-mobile/SKILL.md +1465 -0
- package/skills/imagegen-frontend-web/SKILL.md +987 -0
- package/skills/implement/SKILL.md +15 -0
- package/skills/init/SKILL.md +91 -0
- package/skills/internal-comms/SKILL.md +32 -0
- package/skills/lark-approval/SKILL.md +56 -0
- package/skills/lark-base/SKILL.md +157 -0
- package/skills/lark-doc/SKILL.md +81 -0
- package/skills/lark-shared/SKILL.md +168 -0
- package/skills/lark-workflow-meeting-summary/SKILL.md +122 -0
- package/skills/linting-neostandard-eslint9/SKILL.md +64 -0
- package/skills/loop-me/SKILL.md +32 -0
- package/skills/microsoft-foundry/SKILL.md +262 -0
- package/skills/migrate-to-shoehorn/SKILL.md +118 -0
- package/skills/minimalist-skill/SKILL.md +85 -0
- package/skills/motion-graphics/SKILL.md +170 -0
- package/skills/music-to-video/SKILL.md +197 -0
- package/skills/node/SKILL.md +94 -0
- package/skills/nodejs-core/SKILL.md +156 -0
- package/skills/oauth/SKILL.md +186 -0
- package/skills/obsidian-vault/SKILL.md +59 -0
- package/skills/octocat/SKILL.md +93 -0
- package/skills/openclaw-secure-linux-cloud/SKILL.md +157 -0
- package/skills/opensource-guide-coach/SKILL.md +218 -0
- package/skills/output-skill/SKILL.md +49 -0
- package/skills/pdf/SKILL.md +314 -0
- package/skills/pptx/SKILL.md +232 -0
- package/skills/pr-to-video/SKILL.md +235 -0
- package/skills/product-launch-video/SKILL.md +205 -0
- package/skills/python-appservice-deploy/SKILL.md +36 -0
- package/skills/qa/SKILL.md +130 -0
- package/skills/react-best-practices/SKILL.md +149 -0
- package/skills/react-native-skills/SKILL.md +121 -0
- package/skills/react-view-transitions/SKILL.md +320 -0
- package/skills/readme-i18n/SKILL.md +176 -0
- package/skills/redesign-skill/SKILL.md +178 -0
- package/skills/remotion/SKILL.md +364 -0
- package/skills/request-refactor-plan/SKILL.md +68 -0
- package/skills/resolving-merge-conflicts/SKILL.md +14 -0
- package/skills/running-claude-code-via-litellm-copilot/SKILL.md +263 -0
- package/skills/scaffold-exercises/SKILL.md +106 -0
- package/skills/secure-linux-web-hosting/SKILL.md +162 -0
- package/skills/setup-pre-commit/SKILL.md +91 -0
- package/skills/shadcn/SKILL.md +267 -0
- package/skills/simple/SKILL.md +52 -0
- package/skills/skill-creator/SKILL.md +485 -0
- package/skills/skill-optimizer/SKILL.md +47 -0
- package/skills/skills-cli/SKILL.md +281 -0
- package/skills/slack-gif-creator/SKILL.md +254 -0
- package/skills/snipgrapher/SKILL.md +58 -0
- package/skills/soft-skill/SKILL.md +98 -0
- package/skills/stitch-skill/SKILL.md +184 -0
- package/skills/supabase/SKILL.md +135 -0
- package/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/talking-head-recut/SKILL.md +1191 -0
- package/skills/taste-skill/SKILL.md +1206 -0
- package/skills/taste-skill-v1/SKILL.md +226 -0
- package/skills/tdd/SKILL.md +108 -0
- package/skills/teach/SKILL.md +140 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/theme-factory/SKILL.md +59 -0
- package/skills/to-prd/SKILL.md +75 -0
- package/skills/typescript-magician/SKILL.md +117 -0
- package/skills/tzst/SKILL.md +68 -0
- package/skills/ubiquitous-language/SKILL.md +93 -0
- package/skills/use-my-browser/SKILL.md +110 -0
- package/skills/using-superpowers/SKILL.md +121 -0
- package/skills/vercel-cli-with-tokens/SKILL.md +353 -0
- package/skills/vercel-optimize/SKILL.md +322 -0
- package/skills/viral-instagram-reels/SKILL.md +180 -0
- package/skills/viral-short-form/SKILL.md +147 -0
- package/skills/viral-short-form-ideas/SKILL.md +184 -0
- package/skills/viral-tiktok-content/SKILL.md +180 -0
- package/skills/web-artifacts-builder/SKILL.md +74 -0
- package/skills/web-design-guidelines/SKILL.md +39 -0
- package/skills/webapp-testing/SKILL.md +96 -0
- package/skills/website-to-video/SKILL.md +145 -0
- package/skills/writing-beats/SKILL.md +67 -0
- package/skills/writing-fragments/SKILL.md +79 -0
- package/skills/writing-great-skills/SKILL.md +82 -0
- package/skills/writing-guidelines/SKILL.md +39 -0
- package/skills/writing-plans/SKILL.md +174 -0
- package/skills/writing-shape/SKILL.md +79 -0
- package/skills/xdrop/SKILL.md +78 -0
- package/skills/xget/SKILL.md +87 -0
- package/skills/xlsx/SKILL.md +292 -0
- package/src/tools/skills_download.js +217 -0
- package/src/utils/tools.js +2 -2
|
@@ -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](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,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: theme-factory
|
|
3
|
+
description: Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.
|
|
4
|
+
license: Complete terms in LICENSE.txt
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Theme Factory Skill
|
|
9
|
+
|
|
10
|
+
This skill provides a curated collection of professional font and color themes themes, each with carefully selected color palettes and font pairings. Once a theme is chosen, it can be applied to any artifact.
|
|
11
|
+
|
|
12
|
+
## Purpose
|
|
13
|
+
|
|
14
|
+
To apply consistent, professional styling to presentation slide decks, use this skill. Each theme includes:
|
|
15
|
+
- A cohesive color palette with hex codes
|
|
16
|
+
- Complementary font pairings for headers and body text
|
|
17
|
+
- A distinct visual identity suitable for different contexts and audiences
|
|
18
|
+
|
|
19
|
+
## Usage Instructions
|
|
20
|
+
|
|
21
|
+
To apply styling to a slide deck or other artifact:
|
|
22
|
+
|
|
23
|
+
1. **Show the theme showcase**: Display the `theme-showcase.pdf` file to allow users to see all available themes visually. Do not make any modifications to it; simply show the file for viewing.
|
|
24
|
+
2. **Ask for their choice**: Ask which theme to apply to the deck
|
|
25
|
+
3. **Wait for selection**: Get explicit confirmation about the chosen theme
|
|
26
|
+
4. **Apply the theme**: Once a theme has been chosen, apply the selected theme's colors and fonts to the deck/artifact
|
|
27
|
+
|
|
28
|
+
## Themes Available
|
|
29
|
+
|
|
30
|
+
The following 10 themes are available, each showcased in `theme-showcase.pdf`:
|
|
31
|
+
|
|
32
|
+
1. **Ocean Depths** - Professional and calming maritime theme
|
|
33
|
+
2. **Sunset Boulevard** - Warm and vibrant sunset colors
|
|
34
|
+
3. **Forest Canopy** - Natural and grounded earth tones
|
|
35
|
+
4. **Modern Minimalist** - Clean and contemporary grayscale
|
|
36
|
+
5. **Golden Hour** - Rich and warm autumnal palette
|
|
37
|
+
6. **Arctic Frost** - Cool and crisp winter-inspired theme
|
|
38
|
+
7. **Desert Rose** - Soft and sophisticated dusty tones
|
|
39
|
+
8. **Tech Innovation** - Bold and modern tech aesthetic
|
|
40
|
+
9. **Botanical Garden** - Fresh and organic garden colors
|
|
41
|
+
10. **Midnight Galaxy** - Dramatic and cosmic deep tones
|
|
42
|
+
|
|
43
|
+
## Theme Details
|
|
44
|
+
|
|
45
|
+
Each theme is defined in the `themes/` directory with complete specifications including:
|
|
46
|
+
- Cohesive color palette with hex codes
|
|
47
|
+
- Complementary font pairings for headers and body text
|
|
48
|
+
- Distinct visual identity suitable for different contexts and audiences
|
|
49
|
+
|
|
50
|
+
## Application Process
|
|
51
|
+
|
|
52
|
+
After a preferred theme is selected:
|
|
53
|
+
1. Read the corresponding theme file from the `themes/` directory
|
|
54
|
+
2. Apply the specified colors and fonts consistently throughout the deck
|
|
55
|
+
3. Ensure proper contrast and readability
|
|
56
|
+
4. Maintain the theme's visual identity across all slides
|
|
57
|
+
|
|
58
|
+
## Create your Own Theme
|
|
59
|
+
To handle cases where none of the existing themes work for an artifact, create a custom theme. Based on provided inputs, generate a new theme similar to the ones above. Give the theme a similar name describing what the font/color combinations represent. Use any basic description provided to choose appropriate colors/fonts. After generating the theme, show it for review and verification. Following that, apply the theme as described above.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: to-prd
|
|
3
|
+
description: Turn the current conversation into a PRD and publish it to the project issue tracker — no interview, just synthesis of what you've already discussed.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This skill takes the current conversation context and codebase understanding and produces a PRD. Do NOT interview the user — just synthesize what you already know.
|
|
8
|
+
|
|
9
|
+
The issue tracker and triage label vocabulary should have been provided to you — run `/setup-matt-pocock-skills` if not.
|
|
10
|
+
|
|
11
|
+
## Process
|
|
12
|
+
|
|
13
|
+
1. Explore the repo to understand the current state of the codebase, if you haven't already. Use the project's domain glossary vocabulary throughout the PRD, and respect any ADRs in the area you're touching.
|
|
14
|
+
|
|
15
|
+
2. Sketch out the seams at which you're going to test the feature. Existing seams should be preferred to new ones. Use the highest seam possible. If new seams are needed, propose them at the highest point you can. The fewer seams across the codebase, the better - the ideal number is one.
|
|
16
|
+
|
|
17
|
+
Check with the user that these seams match their expectations.
|
|
18
|
+
|
|
19
|
+
3. Write the PRD using the template below, then publish it to the project issue tracker. Apply the `ready-for-agent` triage label - no need for additional triage.
|
|
20
|
+
|
|
21
|
+
<prd-template>
|
|
22
|
+
|
|
23
|
+
## Problem Statement
|
|
24
|
+
|
|
25
|
+
The problem that the user is facing, from the user's perspective.
|
|
26
|
+
|
|
27
|
+
## Solution
|
|
28
|
+
|
|
29
|
+
The solution to the problem, from the user's perspective.
|
|
30
|
+
|
|
31
|
+
## User Stories
|
|
32
|
+
|
|
33
|
+
A LONG, numbered list of user stories. Each user story should be in the format of:
|
|
34
|
+
|
|
35
|
+
1. As an <actor>, I want a <feature>, so that <benefit>
|
|
36
|
+
|
|
37
|
+
<user-story-example>
|
|
38
|
+
1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending
|
|
39
|
+
</user-story-example>
|
|
40
|
+
|
|
41
|
+
This list of user stories should be extremely extensive and cover all aspects of the feature.
|
|
42
|
+
|
|
43
|
+
## Implementation Decisions
|
|
44
|
+
|
|
45
|
+
A list of implementation decisions that were made. This can include:
|
|
46
|
+
|
|
47
|
+
- The modules that will be built/modified
|
|
48
|
+
- The interfaces of those modules that will be modified
|
|
49
|
+
- Technical clarifications from the developer
|
|
50
|
+
- Architectural decisions
|
|
51
|
+
- Schema changes
|
|
52
|
+
- API contracts
|
|
53
|
+
- Specific interactions
|
|
54
|
+
|
|
55
|
+
Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
|
|
56
|
+
|
|
57
|
+
Exception: if a prototype produced a snippet that encodes a decision more precisely than prose can (state machine, reducer, schema, type shape), inline it within the relevant decision and note briefly that it came from a prototype. Trim to the decision-rich parts — not a working demo, just the important bits.
|
|
58
|
+
|
|
59
|
+
## Testing Decisions
|
|
60
|
+
|
|
61
|
+
A list of testing decisions that were made. Include:
|
|
62
|
+
|
|
63
|
+
- A description of what makes a good test (only test external behavior, not implementation details)
|
|
64
|
+
- Which modules will be tested
|
|
65
|
+
- Prior art for the tests (i.e. similar types of tests in the codebase)
|
|
66
|
+
|
|
67
|
+
## Out of Scope
|
|
68
|
+
|
|
69
|
+
A description of the things that are out of scope for this PRD.
|
|
70
|
+
|
|
71
|
+
## Further Notes
|
|
72
|
+
|
|
73
|
+
Any further notes about the feature.
|
|
74
|
+
|
|
75
|
+
</prd-template>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typescript-magician
|
|
3
|
+
description: Designs complex generic types, refactors `any` types to strict alternatives, creates type guards and utility types, and resolves TypeScript compiler errors. Use when the user asks about TypeScript (TS) types, generics, type inference, type guards, removing `any` types, strict typing, type errors, `infer`, `extends`, conditional types, mapped types, template literal types, branded/opaque types, or utility types like `Partial`, `Record`, `ReturnType`, and `Awaited`.
|
|
4
|
+
metadata:
|
|
5
|
+
tags: typescript, types, generics, type-safety, advanced-typescript
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## When to use
|
|
9
|
+
|
|
10
|
+
Use this skill for:
|
|
11
|
+
- TypeScript errors and type challenges
|
|
12
|
+
- Eliminating `any` types from codebases
|
|
13
|
+
- Complex generics and type inference issues
|
|
14
|
+
- When strict typing is needed
|
|
15
|
+
|
|
16
|
+
## Instructions
|
|
17
|
+
|
|
18
|
+
When invoked:
|
|
19
|
+
1. Run `tsc --noEmit` to capture the full error output before making changes
|
|
20
|
+
2. Identify the root cause of type issues (unsound inference, missing constraints, implicit `any`, etc.)
|
|
21
|
+
3. Craft precise, type-safe solutions using advanced TypeScript features
|
|
22
|
+
4. Eliminate all `any` types with proper typing — validate each replacement still satisfies call sites
|
|
23
|
+
5. Confirm the fix compiles cleanly with a second `tsc --noEmit` pass
|
|
24
|
+
|
|
25
|
+
Capabilities include:
|
|
26
|
+
- Advanced generics and conditional types
|
|
27
|
+
- Template literal types and mapped types
|
|
28
|
+
- Utility types and type manipulation
|
|
29
|
+
- Brand types and nominal typing
|
|
30
|
+
- Complex inference patterns
|
|
31
|
+
- Variance and distribution rules
|
|
32
|
+
- Module augmentation and declaration merging
|
|
33
|
+
|
|
34
|
+
For every TypeScript challenge:
|
|
35
|
+
- Explain the type theory behind the problem
|
|
36
|
+
- Provide multiple solution approaches when applicable
|
|
37
|
+
- Show before/after type representations
|
|
38
|
+
- Include comprehensive type tests
|
|
39
|
+
- Ensure full IntelliSense support
|
|
40
|
+
|
|
41
|
+
## Quick Examples
|
|
42
|
+
|
|
43
|
+
### Eliminating `any` with generics
|
|
44
|
+
|
|
45
|
+
**Before**
|
|
46
|
+
```ts
|
|
47
|
+
function getProperty(obj: any, key: string): any {
|
|
48
|
+
return obj[key];
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**After**
|
|
53
|
+
```ts
|
|
54
|
+
function getProperty<T, K extends keyof T>(obj: T, key: K): T[K] {
|
|
55
|
+
return obj[key];
|
|
56
|
+
}
|
|
57
|
+
// getProperty({ name: "Alice" }, "name") → inferred as string ✓
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Narrowing an unknown API response
|
|
61
|
+
|
|
62
|
+
**Before**
|
|
63
|
+
```ts
|
|
64
|
+
async function fetchUser(): Promise<any> {
|
|
65
|
+
const res = await fetch("/api/user");
|
|
66
|
+
return res.json();
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**After**
|
|
71
|
+
```ts
|
|
72
|
+
interface User { id: number; name: string }
|
|
73
|
+
|
|
74
|
+
function isUser(value: unknown): value is User {
|
|
75
|
+
return (
|
|
76
|
+
typeof value === "object" &&
|
|
77
|
+
value !== null &&
|
|
78
|
+
"id" in value &&
|
|
79
|
+
"name" in value
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function fetchUser(): Promise<User> {
|
|
84
|
+
const res = await fetch("/api/user");
|
|
85
|
+
const data: unknown = await res.json();
|
|
86
|
+
if (!isUser(data)) throw new Error("Invalid user shape");
|
|
87
|
+
return data;
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Reference
|
|
92
|
+
|
|
93
|
+
Read individual rule files for detailed explanations and code examples:
|
|
94
|
+
|
|
95
|
+
### Core Patterns
|
|
96
|
+
- [rules/as-const-typeof.md](rules/as-const-typeof.md) - Deriving types from runtime values using `as const` and `typeof`
|
|
97
|
+
- [rules/array-index-access.md](rules/array-index-access.md) - Accessing array element types using `[number]` indexing
|
|
98
|
+
- [rules/utility-types.md](rules/utility-types.md) - Built-in utility types: Parameters, ReturnType, Awaited, Omit, Partial, Record
|
|
99
|
+
|
|
100
|
+
### Advanced Generics
|
|
101
|
+
- [rules/generics-basics.md](rules/generics-basics.md) - Fundamentals of generic types, constraints, and inference
|
|
102
|
+
- [rules/builder-pattern.md](rules/builder-pattern.md) - Type-safe builder pattern with chainable methods
|
|
103
|
+
- [rules/deep-inference.md](rules/deep-inference.md) - Achieving deep type inference with F.Narrow and const type parameters
|
|
104
|
+
|
|
105
|
+
### Type-Level Programming
|
|
106
|
+
- [rules/conditional-types.md](rules/conditional-types.md) - Conditional types for type-level if/else logic
|
|
107
|
+
- [rules/infer-keyword.md](rules/infer-keyword.md) - Using `infer` to extract types within conditional types
|
|
108
|
+
- [rules/template-literal-types.md](rules/template-literal-types.md) - String manipulation at the type level
|
|
109
|
+
- [rules/mapped-types.md](rules/mapped-types.md) - Creating new types by transforming existing type properties
|
|
110
|
+
|
|
111
|
+
### Type Safety Patterns
|
|
112
|
+
- [rules/opaque-types.md](rules/opaque-types.md) - Brand types and opaque types for type-safe identifiers
|
|
113
|
+
- [rules/type-narrowing.md](rules/type-narrowing.md) - Narrowing types through control flow analysis
|
|
114
|
+
- [rules/function-overloads.md](rules/function-overloads.md) - Using function overloads for complex function signatures
|
|
115
|
+
|
|
116
|
+
### Debugging
|
|
117
|
+
- [rules/error-diagnosis.md](rules/error-diagnosis.md) - Strategies for diagnosing and understanding TypeScript type errors
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tzst
|
|
3
|
+
description: Use when the user needs to create, extract, flatten, list, test, install, script, or troubleshoot `tzst` CLI workflows for `.tzst` or `.tar.zst` archives, including compression levels, streaming mode, extraction filters, conflict resolution, JSON output, or standalone binary setup, even if they describe the archive task without naming `tzst`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Use this skill for the `tzst` command-line interface. Default to execution when the user clearly wants a real archive action and the required paths or archive names are already known.
|
|
7
|
+
|
|
8
|
+
This skill is CLI-only. If the user is asking about Python code such as `from tzst import ...`, treat that as a general Python library or API documentation task instead of using this skill as the main guide.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
Use this skill when the user:
|
|
13
|
+
|
|
14
|
+
- mentions `.tzst` or `.tar.zst` archives
|
|
15
|
+
- wants to create, extract, flatten, list, or test a `tzst` archive
|
|
16
|
+
- needs help installing `tzst` or choosing CLI flags
|
|
17
|
+
- wants machine-readable `tzst` output for scripting or automation
|
|
18
|
+
- needs safe conflict handling or extraction filter guidance
|
|
19
|
+
|
|
20
|
+
Do not use this skill for generic `tar`, `zip`, or Python API questions unless `tzst` is actually part of the request.
|
|
21
|
+
|
|
22
|
+
## Preflight
|
|
23
|
+
|
|
24
|
+
1. Check whether `tzst` is available with `tzst --version` or `tzst --help`.
|
|
25
|
+
2. If it is missing, prefer one of these installation paths:
|
|
26
|
+
- `uv tool install tzst`
|
|
27
|
+
- `pip install tzst`
|
|
28
|
+
- a standalone release binary from <https://github.com/xixu-me/tzst/releases/latest> when the user does not want a Python installation
|
|
29
|
+
3. Re-run `tzst --version` or `tzst --help` before doing real work.
|
|
30
|
+
|
|
31
|
+
## Workflow
|
|
32
|
+
|
|
33
|
+
1. Decide whether the request is execution or guidance.
|
|
34
|
+
Requests like "archive these files", "extract this backup", "list what is inside", "test this archive", or "install tzst" are execution intent.
|
|
35
|
+
2. Choose the command that matches the request:
|
|
36
|
+
- `a`, `add`, `create` for archive creation
|
|
37
|
+
- `x`, `extract` for normal extraction with directory structure preserved
|
|
38
|
+
- `e`, `extract-flat` only when the user explicitly wants flattened output
|
|
39
|
+
- `l`, `list` for archive inspection
|
|
40
|
+
- `t`, `test` for integrity checks
|
|
41
|
+
3. If the user wants to extract only a few members and the member names are uncertain, list first.
|
|
42
|
+
4. Load [`references/cli-reference.md`](./references/cli-reference.md) when you need the command matrix, exact flag names, or copy-paste examples.
|
|
43
|
+
|
|
44
|
+
## Safe Defaults
|
|
45
|
+
|
|
46
|
+
- Prefer `x` over `e` unless flattening is explicitly requested.
|
|
47
|
+
- Keep `--filter data` as the default extraction mode.
|
|
48
|
+
- Use `--filter tar` only when the user needs standard tar-style compatibility.
|
|
49
|
+
- Use `--filter fully_trusted` only when the user explicitly says the archive source is completely trusted.
|
|
50
|
+
- Keep atomic archive creation enabled. Only reach for `--no-atomic` when the user explicitly wants it.
|
|
51
|
+
- Prefer `--streaming` for large archives or memory-constrained environments.
|
|
52
|
+
- For automation or pipelines, prefer `tzst --json --no-banner ...`.
|
|
53
|
+
- For automated extraction, require an explicit non-interactive `--conflict-resolution` choice such as `replace_all`, `skip_all`, or `auto_rename_all`.
|
|
54
|
+
- Do not combine `--json` with interactive conflict prompting.
|
|
55
|
+
|
|
56
|
+
## Scripting Notes
|
|
57
|
+
|
|
58
|
+
- Put global flags before the subcommand in examples, such as `tzst --json --no-banner l archive.tzst`.
|
|
59
|
+
- Use exit codes in scripts: `0` for success, `1` for operation errors, `2` for argument parsing errors, and `130` for interruption.
|
|
60
|
+
- When archive naming matters, tell the user that `tzst` may normalize a creation target to `.tzst` or `.tar.zst`.
|
|
61
|
+
|
|
62
|
+
## Common Mistakes
|
|
63
|
+
|
|
64
|
+
- Using `e` when the user expected the original directory structure to be preserved
|
|
65
|
+
- Recommending `fully_trusted` for archives from an unknown or untrusted source
|
|
66
|
+
- Forgetting an explicit conflict strategy for non-interactive extraction
|
|
67
|
+
- Treating a Python API question as a CLI question
|
|
68
|
+
- Guessing flags from `tar` habits instead of checking the bundled reference or the installed CLI help
|