@ngockhoale/ukit 1.6.8 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/manifests/platform.full.yaml +24 -0
  3. package/package.json +2 -1
  4. package/scripts/skill/audit-skill.mjs +39 -0
  5. package/src/cli/commands/doctor.js +22 -2
  6. package/src/cli/commands/memory.js +76 -1
  7. package/src/core/memory/store.js +125 -1
  8. package/src/core/skillProfile.js +45 -0
  9. package/src/skill/auditSkill.js +99 -0
  10. package/templates/.claude/agents/code-reviewer.md +51 -7
  11. package/templates/.claude/agents/handoff-planner.md +18 -2
  12. package/templates/.claude/skills/canvas-design/SKILL.md +2 -20
  13. package/templates/.claude/skills/canvas-design/philosophy-examples.md +23 -0
  14. package/templates/.claude/skills/debugging-toolkit/SKILL.md +2 -30
  15. package/templates/.claude/skills/debugging-toolkit/reference-tables.md +33 -0
  16. package/templates/.claude/skills/docs-manager/SKILL.md +7 -249
  17. package/templates/.claude/skills/docs-manager/conventions-and-examples.md +221 -0
  18. package/templates/.claude/skills/docx/SKILL.md +3 -34
  19. package/templates/.claude/skills/docx/redlining-reference.md +34 -0
  20. package/templates/.claude/skills/duraone/SKILL.md +12 -16
  21. package/templates/.claude/skills/executing-plans/SKILL.md +31 -19
  22. package/templates/.claude/skills/file-organizer/SKILL.md +2 -170
  23. package/templates/.claude/skills/file-organizer/examples-and-practices.md +173 -0
  24. package/templates/.claude/skills/pdf/SKILL.md +1 -62
  25. package/templates/.claude/skills/pdf/reference.md +65 -0
  26. package/templates/.claude/skills/pdf-processing-pro/SKILL.md +2 -73
  27. package/templates/.claude/skills/pdf-processing-pro/workflows-and-troubleshooting.md +80 -0
  28. package/templates/.claude/skills/pptx/SKILL.md +14 -286
  29. package/templates/.claude/skills/pptx/design-references.md +81 -0
  30. package/templates/.claude/skills/pptx/template-replacement-reference.md +150 -0
  31. package/templates/.claude/skills/pptx/utilities.md +62 -0
  32. package/templates/.claude/skills/project-learning/SKILL.md +32 -0
  33. package/templates/.claude/skills/root-cause-tracing/SKILL.md +2 -35
  34. package/templates/.claude/skills/root-cause-tracing/diagrams.md +44 -0
  35. package/templates/.claude/skills/sharing-skills/SKILL.md +1 -41
  36. package/templates/.claude/skills/sharing-skills/complete-example.md +41 -0
  37. package/templates/.claude/skills/skill-quality/SKILL.md +37 -0
  38. package/templates/.claude/skills/skill-quality/pressure-scenario-template.md +20 -0
  39. package/templates/.claude/skills/skill-quality/rationalization-table-template.md +15 -0
  40. package/templates/.claude/skills/skill-quality/trigger-accuracy-template.md +32 -0
  41. package/templates/.claude/skills/sql-optimization-patterns/SKILL.md +13 -440
  42. package/templates/.claude/skills/sql-optimization-patterns/references/advanced-techniques.md +128 -0
  43. package/templates/.claude/skills/sql-optimization-patterns/references/core-concepts.md +112 -0
  44. package/templates/.claude/skills/sql-optimization-patterns/references/query-patterns.md +204 -0
  45. package/templates/.claude/skills/subagent-driven-development/SKILL.md +4 -51
  46. package/templates/.claude/skills/subagent-driven-development/example-workflow.md +40 -0
  47. package/templates/.claude/skills/systematic-debugging/SKILL.md +2 -28
  48. package/templates/.claude/skills/systematic-debugging/reference-tables.md +33 -0
  49. package/templates/.claude/skills/test-driven-development/SKILL.md +2 -51
  50. package/templates/.claude/skills/test-driven-development/reference-tables.md +56 -0
  51. package/templates/.claude/skills/testing-anti-patterns/SKILL.md +1 -10
  52. package/templates/.claude/skills/testing-anti-patterns/reference-tables.md +14 -0
  53. package/templates/.claude/skills/verification-before-completion/SKILL.md +1 -31
  54. package/templates/.claude/skills/verification-before-completion/key-patterns.md +33 -0
  55. package/templates/CLAUDE.md +4 -0
  56. package/src/core/memory/index.js +0 -2
  57. package/src/core/router/index.js +0 -2
  58. package/src/core/validation/index.js +0 -2
@@ -0,0 +1,204 @@
1
+ # SQL Query Optimization Patterns (Detailed Examples)
2
+
3
+ Full before/after code for each pattern summarized in the main skill.
4
+
5
+ ## Pattern 1: Eliminate N+1 Queries
6
+
7
+ **Problem: N+1 Query Anti-Pattern**
8
+ ```python
9
+ # Bad: Executes N+1 queries
10
+ users = db.query("SELECT * FROM users LIMIT 10")
11
+ for user in users:
12
+ orders = db.query("SELECT * FROM orders WHERE user_id = ?", user.id)
13
+ # Process orders
14
+ ```
15
+
16
+ **Solution: Use JOINs or Batch Loading**
17
+ ```sql
18
+ -- Solution 1: JOIN
19
+ SELECT
20
+ u.id, u.name,
21
+ o.id as order_id, o.total
22
+ FROM users u
23
+ LEFT JOIN orders o ON u.id = o.user_id
24
+ WHERE u.id IN (1, 2, 3, 4, 5);
25
+
26
+ -- Solution 2: Batch query
27
+ SELECT * FROM orders
28
+ WHERE user_id IN (1, 2, 3, 4, 5);
29
+ ```
30
+
31
+ ```python
32
+ # Good: Single query with JOIN or batch load
33
+ # Using JOIN
34
+ results = db.query("""
35
+ SELECT u.id, u.name, o.id as order_id, o.total
36
+ FROM users u
37
+ LEFT JOIN orders o ON u.id = o.user_id
38
+ WHERE u.id IN (1, 2, 3, 4, 5)
39
+ """)
40
+
41
+ # Or batch load
42
+ users = db.query("SELECT * FROM users LIMIT 10")
43
+ user_ids = [u.id for u in users]
44
+ orders = db.query(
45
+ "SELECT * FROM orders WHERE user_id IN (?)",
46
+ user_ids
47
+ )
48
+ # Group orders by user_id
49
+ orders_by_user = {}
50
+ for order in orders:
51
+ orders_by_user.setdefault(order.user_id, []).append(order)
52
+ ```
53
+
54
+ ## Pattern 2: Optimize Pagination
55
+
56
+ **Bad: OFFSET on Large Tables**
57
+ ```sql
58
+ -- Slow for large offsets
59
+ SELECT * FROM users
60
+ ORDER BY created_at DESC
61
+ LIMIT 20 OFFSET 100000; -- Very slow!
62
+ ```
63
+
64
+ **Good: Cursor-Based Pagination**
65
+ ```sql
66
+ -- Much faster: Use cursor (last seen ID)
67
+ SELECT * FROM users
68
+ WHERE created_at < '2024-01-15 10:30:00' -- Last cursor
69
+ ORDER BY created_at DESC
70
+ LIMIT 20;
71
+
72
+ -- With composite sorting
73
+ SELECT * FROM users
74
+ WHERE (created_at, id) < ('2024-01-15 10:30:00', 12345)
75
+ ORDER BY created_at DESC, id DESC
76
+ LIMIT 20;
77
+
78
+ -- Requires index
79
+ CREATE INDEX idx_users_cursor ON users(created_at DESC, id DESC);
80
+ ```
81
+
82
+ ## Pattern 3: Aggregate Efficiently
83
+
84
+ **Optimize COUNT Queries:**
85
+ ```sql
86
+ -- Bad: Counts all rows
87
+ SELECT COUNT(*) FROM orders; -- Slow on large tables
88
+
89
+ -- Good: Use estimates for approximate counts
90
+ SELECT reltuples::bigint AS estimate
91
+ FROM pg_class
92
+ WHERE relname = 'orders';
93
+
94
+ -- Good: Filter before counting
95
+ SELECT COUNT(*) FROM orders
96
+ WHERE created_at > NOW() - INTERVAL '7 days';
97
+
98
+ -- Better: Use index-only scan
99
+ CREATE INDEX idx_orders_created ON orders(created_at);
100
+ SELECT COUNT(*) FROM orders
101
+ WHERE created_at > NOW() - INTERVAL '7 days';
102
+ ```
103
+
104
+ **Optimize GROUP BY:**
105
+ ```sql
106
+ -- Bad: Group by then filter
107
+ SELECT user_id, COUNT(*) as order_count
108
+ FROM orders
109
+ GROUP BY user_id
110
+ HAVING COUNT(*) > 10;
111
+
112
+ -- Better: Filter first, then group (if possible)
113
+ SELECT user_id, COUNT(*) as order_count
114
+ FROM orders
115
+ WHERE status = 'completed'
116
+ GROUP BY user_id
117
+ HAVING COUNT(*) > 10;
118
+
119
+ -- Best: Use covering index
120
+ CREATE INDEX idx_orders_user_status ON orders(user_id, status);
121
+ ```
122
+
123
+ ## Pattern 4: Subquery Optimization
124
+
125
+ **Transform Correlated Subqueries:**
126
+ ```sql
127
+ -- Bad: Correlated subquery (runs for each row)
128
+ SELECT u.name, u.email,
129
+ (SELECT COUNT(*) FROM orders o WHERE o.user_id = u.id) as order_count
130
+ FROM users u;
131
+
132
+ -- Good: JOIN with aggregation
133
+ SELECT u.name, u.email, COUNT(o.id) as order_count
134
+ FROM users u
135
+ LEFT JOIN orders o ON o.user_id = u.id
136
+ GROUP BY u.id, u.name, u.email;
137
+
138
+ -- Better: Use window functions
139
+ SELECT DISTINCT ON (u.id)
140
+ u.name, u.email,
141
+ COUNT(o.id) OVER (PARTITION BY u.id) as order_count
142
+ FROM users u
143
+ LEFT JOIN orders o ON o.user_id = u.id;
144
+ ```
145
+
146
+ **Use CTEs for Clarity:**
147
+ ```sql
148
+ -- Using Common Table Expressions
149
+ WITH recent_users AS (
150
+ SELECT id, name, email
151
+ FROM users
152
+ WHERE created_at > NOW() - INTERVAL '30 days'
153
+ ),
154
+ user_order_counts AS (
155
+ SELECT user_id, COUNT(*) as order_count
156
+ FROM orders
157
+ WHERE created_at > NOW() - INTERVAL '30 days'
158
+ GROUP BY user_id
159
+ )
160
+ SELECT ru.name, ru.email, COALESCE(uoc.order_count, 0) as orders
161
+ FROM recent_users ru
162
+ LEFT JOIN user_order_counts uoc ON ru.id = uoc.user_id;
163
+ ```
164
+
165
+ ## Pattern 5: Batch Operations
166
+
167
+ **Batch INSERT:**
168
+ ```sql
169
+ -- Bad: Multiple individual inserts
170
+ INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com');
171
+ INSERT INTO users (name, email) VALUES ('Bob', 'bob@example.com');
172
+ INSERT INTO users (name, email) VALUES ('Carol', 'carol@example.com');
173
+
174
+ -- Good: Batch insert
175
+ INSERT INTO users (name, email) VALUES
176
+ ('Alice', 'alice@example.com'),
177
+ ('Bob', 'bob@example.com'),
178
+ ('Carol', 'carol@example.com');
179
+
180
+ -- Better: Use COPY for bulk inserts (PostgreSQL)
181
+ COPY users (name, email) FROM '/tmp/users.csv' CSV HEADER;
182
+ ```
183
+
184
+ **Batch UPDATE:**
185
+ ```sql
186
+ -- Bad: Update in loop
187
+ UPDATE users SET status = 'active' WHERE id = 1;
188
+ UPDATE users SET status = 'active' WHERE id = 2;
189
+ -- ... repeat for many IDs
190
+
191
+ -- Good: Single UPDATE with IN clause
192
+ UPDATE users
193
+ SET status = 'active'
194
+ WHERE id IN (1, 2, 3, 4, 5, ...);
195
+
196
+ -- Better: Use temporary table for large batches
197
+ CREATE TEMP TABLE temp_user_updates (id INT, new_status VARCHAR);
198
+ INSERT INTO temp_user_updates VALUES (1, 'active'), (2, 'active'), ...;
199
+
200
+ UPDATE users u
201
+ SET status = t.new_status
202
+ FROM temp_user_updates t
203
+ WHERE u.id = t.id;
204
+ ```
@@ -106,60 +106,15 @@ After final review passes:
106
106
  - **REQUIRED SUB-SKILL:** Use finishing-a-development-branch
107
107
  - Follow that skill to verify tests, present options, execute choice
108
108
 
109
- ## Example Workflow
110
-
111
- ```
112
- You: I'm using Subagent-Driven Development to execute this plan.
113
-
114
- [Load plan, create TodoWrite]
115
-
116
- Task 1: Hook installation script
117
-
118
- [Dispatch implementation subagent]
119
- Subagent: Implemented install-hook with tests, 5/5 passing
120
-
121
- [Get git SHAs, dispatch code-reviewer]
122
- Reviewer: Strengths: Good test coverage. Issues: None. Ready.
123
-
124
- [Mark Task 1 complete]
125
-
126
- Task 2: Recovery modes
127
-
128
- [Dispatch implementation subagent]
129
- Subagent: Added verify/repair, 8/8 tests passing
130
-
131
- [Dispatch code-reviewer]
132
- Reviewer: Strengths: Solid. Issues (Important): Missing progress reporting
133
-
134
- [Dispatch fix subagent]
135
- Fix subagent: Added progress every 100 conversations
136
-
137
- [Verify fix, mark Task 2 complete]
138
-
139
- ...
140
-
141
- [After all tasks]
142
- [Dispatch final code-reviewer]
143
- Final reviewer: All requirements met, ready to merge
144
-
145
- Done!
146
- ```
109
+ Worked two-task example (dispatch → review → fix → complete): [`example-workflow.md`](example-workflow.md).
147
110
 
148
111
  ## Advantages
149
112
 
150
- **vs. Manual execution:**
151
- - Subagents follow TDD naturally
152
- - Fresh context per task (no confusion)
153
- - Parallel-safe (subagents don't interfere)
113
+ **vs. Manual execution:** subagents follow TDD naturally, fresh context per task (no confusion), parallel-safe (subagents don't interfere).
154
114
 
155
- **vs. Executing Plans:**
156
- - Same session (no handoff)
157
- - Continuous progress (no waiting)
158
- - Review checkpoints automatic
115
+ **vs. Executing Plans:** see Overview above (same session, no handoff, continuous progress).
159
116
 
160
- **Cost:**
161
- - More subagent invocations
162
- - But catches issues early (cheaper than debugging later)
117
+ **Cost:** more subagent invocations, but catches issues early (cheaper than debugging later).
163
118
 
164
119
  ## Red Flags
165
120
 
@@ -185,5 +140,3 @@ Done!
185
140
 
186
141
  **Alternative workflow:**
187
142
  - **executing-plans** - Use for parallel session instead of same-session execution
188
-
189
- See code-reviewer template: requesting-code-review/code-reviewer.md
@@ -0,0 +1,40 @@
1
+ # Subagent-Driven Development — Example Workflow
2
+
3
+ Worked example of the 7-step process in `SKILL.md`, showing two tasks running through dispatch → review → fix → complete.
4
+
5
+ ```
6
+ You: I'm using Subagent-Driven Development to execute this plan.
7
+
8
+ [Load plan, create TodoWrite]
9
+
10
+ Task 1: Hook installation script
11
+
12
+ [Dispatch implementation subagent]
13
+ Subagent: Implemented install-hook with tests, 5/5 passing
14
+
15
+ [Get git SHAs, dispatch code-reviewer]
16
+ Reviewer: Strengths: Good test coverage. Issues: None. Ready.
17
+
18
+ [Mark Task 1 complete]
19
+
20
+ Task 2: Recovery modes
21
+
22
+ [Dispatch implementation subagent]
23
+ Subagent: Added verify/repair, 8/8 tests passing
24
+
25
+ [Dispatch code-reviewer]
26
+ Reviewer: Strengths: Solid. Issues (Important): Missing progress reporting
27
+
28
+ [Dispatch fix subagent]
29
+ Fix subagent: Added progress every 100 conversations
30
+
31
+ [Verify fix, mark Task 2 complete]
32
+
33
+ ...
34
+
35
+ [After all tasks]
36
+ [Dispatch final code-reviewer]
37
+ Final reviewer: All requirements met, ready to merge
38
+
39
+ Done!
40
+ ```
@@ -242,27 +242,7 @@ If you catch yourself thinking:
242
242
 
243
243
  **When you see these:** STOP. Return to Phase 1.
244
244
 
245
- ## Common Rationalizations
246
-
247
- | Excuse | Reality |
248
- |--------|---------|
249
- | "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
250
- | "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
251
- | "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
252
- | "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
253
- | "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
254
- | "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
255
- | "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
256
- | "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |
257
-
258
- ## Quick Reference
259
-
260
- | Phase | Key Activities | Success Criteria |
261
- |-------|---------------|------------------|
262
- | **1. Root Cause** | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
263
- | **2. Pattern** | Find working examples, compare | Identify differences |
264
- | **3. Hypothesis** | Form theory, test minimally | Confirmed or new hypothesis |
265
- | **4. Implementation** | Create test, fix, verify | Bug resolved, tests pass |
245
+ Compact rationalization/quick-reference/impact tables: [`reference-tables.md`](reference-tables.md).
266
246
 
267
247
  ## When Process Reveals "No Root Cause"
268
248
 
@@ -286,10 +266,4 @@ If systematic investigation reveals issue is truly environmental, timing-depende
286
266
  - **condition-based-waiting** - Replace arbitrary timeouts identified in Phase 2
287
267
  - **verification-before-completion** - Verify fix worked before claiming success
288
268
 
289
- ## Real-World Impact
290
-
291
- From debugging sessions:
292
- - Systematic approach: 15-30 minutes to fix
293
- - Random fixes approach: 2-3 hours of thrashing
294
- - First-time fix rate: 95% vs 40%
295
- - New bugs introduced: Near zero vs common
269
+ Real-world before/after impact numbers: [`reference-tables.md`](reference-tables.md#real-world-impact).
@@ -0,0 +1,33 @@
1
+ # Systematic Debugging — Reference Tables
2
+
3
+ Compact restatements of the four-phase process in `SKILL.md`, plus supporting data. Read the phases in `SKILL.md` first; these tables are for quick lookup during a session, not a substitute for the phases.
4
+
5
+ ## Common Rationalizations
6
+
7
+ | Excuse | Reality |
8
+ |--------|---------|
9
+ | "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
10
+ | "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
11
+ | "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
12
+ | "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
13
+ | "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
14
+ | "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
15
+ | "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
16
+ | "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |
17
+
18
+ ## Quick Reference
19
+
20
+ | Phase | Key Activities | Success Criteria |
21
+ |-------|---------------|------------------|
22
+ | **1. Root Cause** | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY |
23
+ | **2. Pattern** | Find working examples, compare | Identify differences |
24
+ | **3. Hypothesis** | Form theory, test minimally | Confirmed or new hypothesis |
25
+ | **4. Implementation** | Create test, fix, verify | Bug resolved, tests pass |
26
+
27
+ ## Real-World Impact
28
+
29
+ From debugging sessions:
30
+ - Systematic approach: 15-30 minutes to fix
31
+ - Random fixes approach: 2-3 hours of thrashing
32
+ - First-time fix rate: 95% vs 40%
33
+ - New bugs introduced: Near zero vs common
@@ -253,21 +253,7 @@ Tests-first force edge case discovery before implementing. Tests-after verify yo
253
253
 
254
254
  30 minutes of tests after ≠ TDD. You get coverage, lose proof tests work.
255
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. |
256
+ Table of common rationalizations and why each is wrong: [`reference-tables.md`](reference-tables.md).
271
257
 
272
258
  ## Red Flags - STOP and Start Over
273
259
 
@@ -287,42 +273,7 @@ Tests-first force edge case discovery before implementing. Tests-after verify yo
287
273
 
288
274
  **All of these mean: Delete code. Start over with TDD.**
289
275
 
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.
276
+ Worked RED-GREEN-REFACTOR example for a bug fix: [`reference-tables.md`](reference-tables.md#example-bug-fix).
326
277
 
327
278
  ## Verification Checklist
328
279
 
@@ -0,0 +1,56 @@
1
+ # TDD — Reference Tables and Worked Example
2
+
3
+ Compact restatements of the Red-Green-Refactor cycle in `SKILL.md`, plus a worked example. Read `SKILL.md` first; these are for quick lookup during a session.
4
+
5
+ ## Common Rationalizations
6
+
7
+ | Excuse | Reality |
8
+ |--------|---------|
9
+ | "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
10
+ | "I'll test after" | Tests passing immediately prove nothing. |
11
+ | "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
12
+ | "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
13
+ | "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
14
+ | "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
15
+ | "Need to explore first" | Fine. Throw away exploration, start with TDD. |
16
+ | "Test hard = design unclear" | Listen to test. Hard to test = hard to use. |
17
+ | "TDD will slow me down" | TDD faster than debugging. Pragmatic = test-first. |
18
+ | "Manual test faster" | Manual doesn't prove edge cases. You'll re-test every change. |
19
+ | "Existing code has no tests" | You're improving it. Add tests for existing code. |
20
+
21
+ ## Example: Bug Fix
22
+
23
+ **Bug:** Empty email accepted
24
+
25
+ **RED**
26
+ ```typescript
27
+ test('rejects empty email', async () => {
28
+ const result = await submitForm({ email: '' });
29
+ expect(result.error).toBe('Email required');
30
+ });
31
+ ```
32
+
33
+ **Verify RED**
34
+ ```bash
35
+ $ npm test
36
+ FAIL: expected 'Email required', got undefined
37
+ ```
38
+
39
+ **GREEN**
40
+ ```typescript
41
+ function submitForm(data: FormData) {
42
+ if (!data.email?.trim()) {
43
+ return { error: 'Email required' };
44
+ }
45
+ // ...
46
+ }
47
+ ```
48
+
49
+ **Verify GREEN**
50
+ ```bash
51
+ $ npm test
52
+ PASS
53
+ ```
54
+
55
+ **REFACTOR**
56
+ Extract validation for multiple fields if needed.
@@ -273,16 +273,7 @@ TDD cycle:
273
273
 
274
274
  **If you're testing mock behavior, you violated TDD** - you added mocks without watching test fail against real code first.
275
275
 
276
- ## Quick Reference
277
-
278
- | Anti-Pattern | Fix |
279
- |--------------|-----|
280
- | Assert on mock elements | Test real component or unmock it |
281
- | Test-only methods in production | Move to test utilities |
282
- | Mock without understanding | Understand dependencies first, mock minimally |
283
- | Incomplete mocks | Mirror real API completely |
284
- | Tests as afterthought | TDD - tests first |
285
- | Over-complex mocks | Consider integration tests |
276
+ Compact anti-pattern → fix table: [`reference-tables.md`](reference-tables.md).
286
277
 
287
278
  ## Red Flags
288
279
 
@@ -0,0 +1,14 @@
1
+ # Testing Anti-Patterns — Quick Reference
2
+
3
+ Compact restatement of the five anti-patterns in `SKILL.md`. Read the full anti-pattern sections first for the violation/fix code examples; this table is for quick lookup during a session.
4
+
5
+ ## Quick Reference
6
+
7
+ | Anti-Pattern | Fix |
8
+ |--------------|-----|
9
+ | Assert on mock elements | Test real component or unmock it |
10
+ | Test-only methods in production | Move to test utilities |
11
+ | Mock without understanding | Understand dependencies first, mock minimally |
12
+ | Incomplete mocks | Mirror real API completely |
13
+ | Tests as afterthought | TDD - tests first |
14
+ | Over-complex mocks | Consider integration tests |
@@ -73,37 +73,7 @@ Skip any step = lying, not verifying
73
73
  | "Partial check is enough" | Partial proves nothing |
74
74
  | "Different words so rule doesn't apply" | Spirit over letter |
75
75
 
76
- ## Key Patterns
77
-
78
- **Tests:**
79
- ```
80
- ✅ [Run test command] [See: 34/34 pass] "All tests pass"
81
- ❌ "Should pass now" / "Looks correct"
82
- ```
83
-
84
- **Regression tests (TDD Red-Green):**
85
- ```
86
- ✅ Write → Run (pass) → Revert fix → Run (MUST FAIL) → Restore → Run (pass)
87
- ❌ "I've written a regression test" (without red-green verification)
88
- ```
89
-
90
- **Build:**
91
- ```
92
- ✅ [Run build] [See: exit 0] "Build passes"
93
- ❌ "Linter passed" (linter doesn't check compilation)
94
- ```
95
-
96
- **Requirements:**
97
- ```
98
- ✅ Re-read plan → Create checklist → Verify each → Report gaps or completion
99
- ❌ "Tests pass, phase complete"
100
- ```
101
-
102
- **Agent delegation:**
103
- ```
104
- ✅ Agent reports success → Check VCS diff → Verify changes → Report actual state
105
- ❌ Trust agent report
106
- ```
76
+ Worked ✅/❌ examples for each claim type above: [`key-patterns.md`](key-patterns.md).
107
77
 
108
78
  ## Why This Matters
109
79
 
@@ -0,0 +1,33 @@
1
+ # Verification Before Completion — Key Patterns
2
+
3
+ Worked ✅/❌ examples for each claim type in the "Common Failures" table in `SKILL.md`.
4
+
5
+ **Tests:**
6
+ ```
7
+ ✅ [Run test command] [See: 34/34 pass] "All tests pass"
8
+ ❌ "Should pass now" / "Looks correct"
9
+ ```
10
+
11
+ **Regression tests (TDD Red-Green):**
12
+ ```
13
+ ✅ Write → Run (pass) → Revert fix → Run (MUST FAIL) → Restore → Run (pass)
14
+ ❌ "I've written a regression test" (without red-green verification)
15
+ ```
16
+
17
+ **Build:**
18
+ ```
19
+ ✅ [Run build] [See: exit 0] "Build passes"
20
+ ❌ "Linter passed" (linter doesn't check compilation)
21
+ ```
22
+
23
+ **Requirements:**
24
+ ```
25
+ ✅ Re-read plan → Create checklist → Verify each → Report gaps or completion
26
+ ❌ "Tests pass, phase complete"
27
+ ```
28
+
29
+ **Agent delegation:**
30
+ ```
31
+ ✅ Agent reports success → Check VCS diff → Verify changes → Report actual state
32
+ ❌ Trust agent report
33
+ ```
@@ -66,6 +66,10 @@ For clearly non-code specialist lanes (docs-only, status, task queue), skip the
66
66
  - **Do not ask normal contributors to run internal helper commands**; run them yourself or tell them to rerun `ukit install`.
67
67
  - Do not ask normal contributors to memorize `ukit doctor`, `ukit diff`, `ukit uninstall`, or `ukit index ...` unless they explicitly need maintainer/debug help.
68
68
 
69
+ ## Skill Quality (maintainer-only)
70
+
71
+ - When editing a template skill/agent under `templates/.claude/`, read `.claude/skills/skill-quality/SKILL.md` before shipping the change.
72
+
69
73
  ## UKit v{{ukit.version}} Shared Runtime
70
74
 
71
75
  - Shared runtime state lives in `.ukit/storage/`.
@@ -1,2 +0,0 @@
1
- export { detectConflict, runHygiene } from './hygiene.js';
2
- export { expand, getContextInjection, search } from './retrieval.js';
@@ -1,2 +0,0 @@
1
- export { askAdvisor, shouldEscalate } from './advisor.js';
2
- export { classifyTask, detectComplexity, selectModel } from './router.js';
@@ -1,2 +0,0 @@
1
- export { scoreConfidence } from './confidence.js';
2
- export { validateOutput } from './validator.js';