@kurokeita/add-skill 1.17.2 → 1.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.
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: write-prd
3
+ description: >
4
+ Create a developer-focused PRD through user interview, codebase exploration, and module design, then save it
5
+ under .prd/{prd-name}/ in the current workspace. Use when the user wants to write a PRD, create a product
6
+ requirements document, plan a new feature, spec out work, or define requirements for implementation. Also
7
+ trigger when the user says things like "let's plan this feature", "I need a spec for...", "write requirements
8
+ for...", or "create a PRD for...". Do NOT trigger for: reviewing existing PRDs, creating child tasks from a PRD,
9
+ or general project management outside the local PRD directory.
10
+ argument-hint: "[prd-name]"
11
+ ---
12
+
13
+ # Write a PRD
14
+
15
+ Create a developer-focused Product Requirements Document and save it to the local workspace instead of a remote tracker.
16
+ The PRD captures the *what* and *why* of a feature, not line-level implementation details.
17
+
18
+ During the interview phase, explicitly use the `grill-me` skill if it is available in the current workspace. Treat
19
+ that skill as the driver for the questioning loop, while this skill remains responsible for codebase exploration,
20
+ module design, PRD drafting, and filesystem output.
21
+
22
+ Output location:
23
+
24
+ - Directory: `.prd/{prd-name}/`
25
+ - Primary document: `.prd/{prd-name}/prd.md`
26
+ - Optional notes captured during planning: `.prd/{prd-name}/notes.md`
27
+
28
+ `{prd-name}` should be a filesystem-safe kebab-case slug. If the user provides a title with spaces or punctuation,
29
+ normalize it to kebab-case and tell the user which slug you used.
30
+
31
+ You may skip steps if they are clearly unnecessary, but do not rush. The value of this skill is in forcing clarity.
32
+
33
+ ## Step 1: Establish the PRD target
34
+
35
+ If the user provided `$ARGUMENTS`, treat that as the intended PRD name and normalize it to a slug.
36
+
37
+ If not, ask for the PRD name before writing files.
38
+
39
+ Before creating files:
40
+
41
+ - Check whether `.prd/{prd-name}/` already exists
42
+ - If it exists, read `prd.md` if present and summarize the current state
43
+ - Ask whether the user wants to overwrite the PRD, revise it in place, or create a new slug
44
+
45
+ ## Step 2: Get the problem description
46
+
47
+ Ask the user for a long, detailed description of the problem they want to solve and any candidate solutions they already
48
+ have in mind.
49
+
50
+ If an existing `.prd/{prd-name}/prd.md` exists, summarize it first so the user can correct or extend it instead of repeating
51
+ context.
52
+
53
+ ## Step 3: Explore the codebase
54
+
55
+ Before interviewing, ground yourself in the actual codebase:
56
+
57
+ 1. Read the top-level `README.md`, `AGENTS.md`, or other architectural guidance if present
58
+ 2. Search broadly for relevant terms, domain concepts, and adjacent implementations
59
+ 3. Read area-specific guidance files when relevant
60
+ 4. Look for similar features, patterns, and existing terminology
61
+
62
+ Do not try to read everything. Use search-driven exploration to understand the current state well enough to ask informed
63
+ questions and write an accurate PRD.
64
+
65
+ ## Step 4: Interview relentlessly
66
+
67
+ Invoke the `grill-me` skill for this phase if available, then interview the user until you reach shared understanding.
68
+ Walk down each branch of the design tree and resolve dependencies one by one.
69
+
70
+ Ask one question at a time. Keep going until ambiguity is removed.
71
+
72
+ Ask about:
73
+
74
+ - Edge cases and failure scenarios
75
+ - Existing behavior that must be preserved
76
+ - What success looks like from the user's perspective
77
+ - Who the end users are
78
+ - Constraints from architecture, rollout, compatibility, or operations
79
+
80
+ Continue exploring the codebase while interviewing. If a question can be answered by inspecting code, inspect code instead
81
+ of asking the user.
82
+
83
+ ### Scope check
84
+
85
+ If it becomes clear the work is too large for one PRD, tell the user and ask whether to narrow the scope or continue with
86
+ a larger document that will later be split into multiple execution tracks.
87
+
88
+ ## Step 5: Sketch module design
89
+
90
+ Sketch the major conceptual modules to build or modify. Look for opportunities to define **deep modules**:
91
+
92
+ - Interfaces simpler than the implementation they hide
93
+ - Testable in isolation
94
+ - Internals can change without rippling outward
95
+
96
+ Check that these modules match the user's expectations and ask which ones need stronger test coverage.
97
+
98
+ ## Step 6: Draft the PRD and get approval
99
+
100
+ Write the PRD and show it to the user for approval before saving or overwriting `prd.md`.
101
+
102
+ The PRD should be durable:
103
+
104
+ - Do describe conceptual modules, responsibilities, interfaces, and data flow
105
+ - Do describe architectural patterns and decisions
106
+ - Do not reference specific file paths, class names, or step-by-step implementation procedures
107
+ - Do not include code snippets unless the user explicitly asks for them
108
+
109
+ Use this structure:
110
+
111
+ ```md
112
+ # {Human-readable PRD title}
113
+
114
+ ## Problem Statement
115
+
116
+ ## Solution
117
+
118
+ ## User Stories
119
+ 1. As a ...
120
+
121
+ ## Module Design
122
+ ### {Module name}
123
+ - Responsibility:
124
+ - Interface:
125
+ - Status: new | existing
126
+ - Depth: deep | shallow
127
+
128
+ ## Implementation Decisions
129
+
130
+ ## Testing Decisions
131
+
132
+ ## Out of Scope
133
+
134
+ ## Open Questions
135
+ ```
136
+
137
+ Omit `Open Questions` if none remain.
138
+
139
+ ## Step 7: Save to the filesystem
140
+
141
+ Only save after the user approves the PRD.
142
+
143
+ Create `.prd/{prd-name}/` if it does not exist.
144
+
145
+ Write:
146
+
147
+ - `.prd/{prd-name}/prd.md`: the approved PRD
148
+
149
+ Optionally write:
150
+
151
+ - `.prd/{prd-name}/notes.md`: short working notes, unresolved investigation points, or source references gathered during
152
+ discovery. Keep this concise and operational, not user-facing.
153
+
154
+ Do not create extra files unless they add real value.
155
+
156
+ ## After saving
157
+
158
+ Tell the user:
159
+
160
+ - The slug used
161
+ - The files created or updated
162
+ - Whether this was a new PRD or a revision of an existing directory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kurokeita/add-skill",
3
- "version": "1.17.2",
3
+ "version": "1.19.0",
4
4
  "description": "CLI to install AI agent skills to various platforms",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,316 +0,0 @@
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
-
25
- ```typescript
26
- // ❌ BAD: Testing that the mock exists
27
- test('renders sidebar', () => {
28
- render(<Page />);
29
- expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
30
- });
31
- ```
32
-
33
- **Why this is wrong:**
34
-
35
- - You're verifying the mock works, not that the component works
36
- - Test passes when mock is present, fails when it's not
37
- - Tells you nothing about real behavior
38
-
39
- **your human partner's correction:** "Are we testing the behavior of a mock?"
40
-
41
- **The fix:**
42
-
43
- ```typescript
44
- // ✅ GOOD: Test real component or don't mock it
45
- test('renders sidebar', () => {
46
- render(<Page />); // Don't mock sidebar
47
- expect(screen.getByRole('navigation')).toBeInTheDocument();
48
- });
49
-
50
- // OR if sidebar must be mocked for isolation:
51
- // Don't assert on the mock - test Page's behavior with sidebar present
52
- ```
53
-
54
- ### Gate Function
55
-
56
- ```
57
- BEFORE asserting on any mock element:
58
- Ask: "Am I testing real component behavior or just mock existence?"
59
-
60
- IF testing mock existence:
61
- STOP - Delete the assertion or unmock the component
62
-
63
- Test real behavior instead
64
- ```
65
-
66
- ## Anti-Pattern 2: Test-Only Methods in Production
67
-
68
- **The violation:**
69
-
70
- ```typescript
71
- // ❌ BAD: destroy() only used in tests
72
- class Session {
73
- async destroy() { // Looks like production API!
74
- await this._workspaceManager?.destroyWorkspace(this.id);
75
- // ... cleanup
76
- }
77
- }
78
-
79
- // In tests
80
- afterEach(() => session.destroy());
81
- ```
82
-
83
- **Why this is wrong:**
84
-
85
- - Production class polluted with test-only code
86
- - Dangerous if accidentally called in production
87
- - Violates YAGNI and separation of concerns
88
- - Confuses object lifecycle with entity lifecycle
89
-
90
- **The fix:**
91
-
92
- ```typescript
93
- // ✅ GOOD: Test utilities handle test cleanup
94
- // Session has no destroy() - it's stateless in production
95
-
96
- // In test-utils/
97
- export async function cleanupSession(session: Session) {
98
- const workspace = session.getWorkspaceInfo();
99
- if (workspace) {
100
- await workspaceManager.destroyWorkspace(workspace.id);
101
- }
102
- }
103
-
104
- // In tests
105
- afterEach(() => cleanupSession(session));
106
- ```
107
-
108
- ### Gate Function
109
-
110
- ```
111
- BEFORE adding any method to production class:
112
- Ask: "Is this only used by tests?"
113
-
114
- IF yes:
115
- STOP - Don't add it
116
- Put it in test utilities instead
117
-
118
- Ask: "Does this class own this resource's lifecycle?"
119
-
120
- IF no:
121
- STOP - Wrong class for this method
122
- ```
123
-
124
- ## Anti-Pattern 3: Mocking Without Understanding
125
-
126
- **The violation:**
127
-
128
- ```typescript
129
- // ❌ BAD: Mock breaks test logic
130
- test('detects duplicate server', () => {
131
- // Mock prevents config write that test depends on!
132
- vi.mock('ToolCatalog', () => ({
133
- discoverAndCacheTools: vi.fn().mockResolvedValue(undefined)
134
- }));
135
-
136
- await addServer(config);
137
- await addServer(config); // Should throw - but won't!
138
- });
139
- ```
140
-
141
- **Why this is wrong:**
142
-
143
- - Mocked method had side effect test depended on (writing config)
144
- - Over-mocking to "be safe" breaks actual behavior
145
- - Test passes for wrong reason or fails mysteriously
146
-
147
- **The fix:**
148
-
149
- ```typescript
150
- // ✅ GOOD: Mock at correct level
151
- test('detects duplicate server', () => {
152
- // Mock the slow part, preserve behavior test needs
153
- vi.mock('MCPServerManager'); // Just mock slow server startup
154
-
155
- await addServer(config); // Config written
156
- await addServer(config); // Duplicate detected ✓
157
- });
158
- ```
159
-
160
- ### Gate Function
161
-
162
- ```
163
- BEFORE mocking any method:
164
- STOP - Don't mock yet
165
-
166
- 1. Ask: "What side effects does the real method have?"
167
- 2. Ask: "Does this test depend on any of those side effects?"
168
- 3. Ask: "Do I fully understand what this test needs?"
169
-
170
- IF depends on side effects:
171
- Mock at lower level (the actual slow/external operation)
172
- OR use test doubles that preserve necessary behavior
173
- NOT the high-level method the test depends on
174
-
175
- IF unsure what test depends on:
176
- Run test with real implementation FIRST
177
- Observe what actually needs to happen
178
- THEN add minimal mocking at the right level
179
-
180
- Red flags:
181
- - "I'll mock this to be safe"
182
- - "This might be slow, better mock it"
183
- - Mocking without understanding the dependency chain
184
- ```
185
-
186
- ## Anti-Pattern 4: Incomplete Mocks
187
-
188
- **The violation:**
189
-
190
- ```typescript
191
- // ❌ BAD: Partial mock - only fields you think you need
192
- const mockResponse = {
193
- status: 'success',
194
- data: { userId: '123', name: 'Alice' }
195
- // Missing: metadata that downstream code uses
196
- };
197
-
198
- // Later: breaks when code accesses response.metadata.requestId
199
- ```
200
-
201
- **Why this is wrong:**
202
-
203
- - **Partial mocks hide structural assumptions** - You only mocked fields you know about
204
- - **Downstream code may depend on fields you didn't include** - Silent failures
205
- - **Tests pass but integration fails** - Mock incomplete, real API complete
206
- - **False confidence** - Test proves nothing about real behavior
207
-
208
- **The Iron Rule:** Mock the COMPLETE data structure as it exists in reality, not just fields your immediate test uses.
209
-
210
- **The fix:**
211
-
212
- ```typescript
213
- // ✅ GOOD: Mirror real API completeness
214
- const mockResponse = {
215
- status: 'success',
216
- data: { userId: '123', name: 'Alice' },
217
- metadata: { requestId: 'req-789', timestamp: 1234567890 }
218
- // All fields real API returns
219
- };
220
- ```
221
-
222
- ### Gate Function
223
-
224
- ```
225
- BEFORE creating mock responses:
226
- Check: "What fields does the real API response contain?"
227
-
228
- Actions:
229
- 1. Examine actual API response from docs/examples
230
- 2. Include ALL fields system might consume downstream
231
- 3. Verify mock matches real response schema completely
232
-
233
- Critical:
234
- If you're creating a mock, you must understand the ENTIRE structure
235
- Partial mocks fail silently when code depends on omitted fields
236
-
237
- If uncertain: Include all documented fields
238
- ```
239
-
240
- ## Anti-Pattern 5: Integration Tests as Afterthought
241
-
242
- **The violation:**
243
-
244
- ```
245
- ✅ Implementation complete
246
- ❌ No tests written
247
- "Ready for testing"
248
- ```
249
-
250
- **Why this is wrong:**
251
-
252
- - Testing is part of implementation, not optional follow-up
253
- - TDD would have caught this
254
- - Can't claim complete without tests
255
-
256
- **The fix:**
257
-
258
- ```
259
- TDD cycle:
260
- 1. Write failing test
261
- 2. Implement to pass
262
- 3. Refactor
263
- 4. THEN claim complete
264
- ```
265
-
266
- ## When Mocks Become Too Complex
267
-
268
- **Warning signs:**
269
-
270
- - Mock setup longer than test logic
271
- - Mocking everything to make test pass
272
- - Mocks missing methods real components have
273
- - Test breaks when mock changes
274
-
275
- **your human partner's question:** "Do we need to be using a mock here?"
276
-
277
- **Consider:** Integration tests with real components often simpler than complex mocks
278
-
279
- ## TDD Prevents These Anti-Patterns
280
-
281
- **Why TDD helps:**
282
-
283
- 1. **Write test first** → Forces you to think about what you're actually testing
284
- 2. **Watch it fail** → Confirms test tests real behavior, not mocks
285
- 3. **Minimal implementation** → No test-only methods creep in
286
- 4. **Real dependencies** → You see what the test actually needs before mocking
287
-
288
- **If you're testing mock behavior, you violated TDD** - you added mocks without watching test fail against real code first.
289
-
290
- ## Quick Reference
291
-
292
- | Anti-Pattern | Fix |
293
- |--------------|-----|
294
- | Assert on mock elements | Test real component or unmock it |
295
- | Test-only methods in production | Move to test utilities |
296
- | Mock without understanding | Understand dependencies first, mock minimally |
297
- | Incomplete mocks | Mirror real API completely |
298
- | Tests as afterthought | TDD - tests first |
299
- | Over-complex mocks | Consider integration tests |
300
-
301
- ## Red Flags
302
-
303
- - Assertion checks for `*-mock` test IDs
304
- - Methods only called in test files
305
- - Mock setup is >50% of test
306
- - Test fails when you remove mock
307
- - Can't explain why mock is needed
308
- - Mocking "just to be safe"
309
-
310
- ## The Bottom Line
311
-
312
- **Mocks are tools to isolate, not things to test.**
313
-
314
- If TDD reveals you're testing mock behavior, you've gone wrong.
315
-
316
- Fix: Test real behavior or question why you're mocking at all.