@simplysm/sd-claude 13.0.0-beta.11

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 (119) hide show
  1. package/README.md +41 -0
  2. package/claude/agents/sd-api-reviewer.md +81 -0
  3. package/claude/agents/sd-code-reviewer.md +49 -0
  4. package/claude/agents/sd-code-simplifier.md +50 -0
  5. package/claude/sd-statusline.js +270 -0
  6. package/claude/skills/sd-api-name-review/SKILL.md +49 -0
  7. package/claude/skills/sd-brainstorm/SKILL.md +55 -0
  8. package/claude/skills/sd-check/SKILL.md +88 -0
  9. package/claude/skills/sd-commit/SKILL.md +48 -0
  10. package/claude/skills/sd-explore/SKILL.md +63 -0
  11. package/claude/skills/sd-plan/SKILL.md +104 -0
  12. package/claude/skills/sd-plan-dev/SKILL.md +266 -0
  13. package/claude/skills/sd-plan-dev/code-quality-reviewer-prompt.md +69 -0
  14. package/claude/skills/sd-plan-dev/implementer-prompt.md +50 -0
  15. package/claude/skills/sd-plan-dev/spec-reviewer-prompt.md +38 -0
  16. package/claude/skills/sd-readme/SKILL.md +95 -0
  17. package/claude/skills/sd-review/SKILL.md +93 -0
  18. package/claude/skills/sd-skill/SKILL.md +639 -0
  19. package/claude/skills/sd-skill/anthropic-best-practices.md +1150 -0
  20. package/claude/skills/sd-skill/examples/CLAUDE_MD_TESTING.md +189 -0
  21. package/claude/skills/sd-skill/persuasion-principles.md +187 -0
  22. package/claude/skills/sd-skill/testing-skills-with-subagents.md +384 -0
  23. package/claude/skills/sd-tdd/SKILL.md +373 -0
  24. package/claude/skills/sd-tdd/testing-anti-patterns.md +299 -0
  25. package/claude/skills/sd-worktree/SKILL.md +82 -0
  26. package/claude/skills/sd-worktree/sd-worktree.mjs +128 -0
  27. package/dist/commands/install.js +64 -0
  28. package/dist/commands/install.js.map +7 -0
  29. package/dist/commands/uninstall.js +40 -0
  30. package/dist/commands/uninstall.js.map +7 -0
  31. package/dist/core-common/src/common.types.d.ts +74 -0
  32. package/dist/core-common/src/common.types.d.ts.map +1 -0
  33. package/dist/core-common/src/env.d.ts +6 -0
  34. package/dist/core-common/src/env.d.ts.map +1 -0
  35. package/dist/core-common/src/errors/argument-error.d.ts +25 -0
  36. package/dist/core-common/src/errors/argument-error.d.ts.map +1 -0
  37. package/dist/core-common/src/errors/not-implemented-error.d.ts +29 -0
  38. package/dist/core-common/src/errors/not-implemented-error.d.ts.map +1 -0
  39. package/dist/core-common/src/errors/sd-error.d.ts +27 -0
  40. package/dist/core-common/src/errors/sd-error.d.ts.map +1 -0
  41. package/dist/core-common/src/errors/timeout-error.d.ts +31 -0
  42. package/dist/core-common/src/errors/timeout-error.d.ts.map +1 -0
  43. package/dist/core-common/src/extensions/arr-ext.d.ts +15 -0
  44. package/dist/core-common/src/extensions/arr-ext.d.ts.map +1 -0
  45. package/dist/core-common/src/extensions/arr-ext.helpers.d.ts +19 -0
  46. package/dist/core-common/src/extensions/arr-ext.helpers.d.ts.map +1 -0
  47. package/dist/core-common/src/extensions/arr-ext.types.d.ts +215 -0
  48. package/dist/core-common/src/extensions/arr-ext.types.d.ts.map +1 -0
  49. package/dist/core-common/src/extensions/map-ext.d.ts +57 -0
  50. package/dist/core-common/src/extensions/map-ext.d.ts.map +1 -0
  51. package/dist/core-common/src/extensions/set-ext.d.ts +36 -0
  52. package/dist/core-common/src/extensions/set-ext.d.ts.map +1 -0
  53. package/dist/core-common/src/features/debounce-queue.d.ts +53 -0
  54. package/dist/core-common/src/features/debounce-queue.d.ts.map +1 -0
  55. package/dist/core-common/src/features/event-emitter.d.ts +66 -0
  56. package/dist/core-common/src/features/event-emitter.d.ts.map +1 -0
  57. package/dist/core-common/src/features/serial-queue.d.ts +47 -0
  58. package/dist/core-common/src/features/serial-queue.d.ts.map +1 -0
  59. package/dist/core-common/src/index.d.ts +32 -0
  60. package/dist/core-common/src/index.d.ts.map +1 -0
  61. package/dist/core-common/src/types/date-only.d.ts +152 -0
  62. package/dist/core-common/src/types/date-only.d.ts.map +1 -0
  63. package/dist/core-common/src/types/date-time.d.ts +96 -0
  64. package/dist/core-common/src/types/date-time.d.ts.map +1 -0
  65. package/dist/core-common/src/types/lazy-gc-map.d.ts +80 -0
  66. package/dist/core-common/src/types/lazy-gc-map.d.ts.map +1 -0
  67. package/dist/core-common/src/types/time.d.ts +68 -0
  68. package/dist/core-common/src/types/time.d.ts.map +1 -0
  69. package/dist/core-common/src/types/uuid.d.ts +35 -0
  70. package/dist/core-common/src/types/uuid.d.ts.map +1 -0
  71. package/dist/core-common/src/utils/bytes.d.ts +51 -0
  72. package/dist/core-common/src/utils/bytes.d.ts.map +1 -0
  73. package/dist/core-common/src/utils/date-format.d.ts +90 -0
  74. package/dist/core-common/src/utils/date-format.d.ts.map +1 -0
  75. package/dist/core-common/src/utils/json.d.ts +34 -0
  76. package/dist/core-common/src/utils/json.d.ts.map +1 -0
  77. package/dist/core-common/src/utils/num.d.ts +60 -0
  78. package/dist/core-common/src/utils/num.d.ts.map +1 -0
  79. package/dist/core-common/src/utils/obj.d.ts +258 -0
  80. package/dist/core-common/src/utils/obj.d.ts.map +1 -0
  81. package/dist/core-common/src/utils/path.d.ts +23 -0
  82. package/dist/core-common/src/utils/path.d.ts.map +1 -0
  83. package/dist/core-common/src/utils/primitive.d.ts +18 -0
  84. package/dist/core-common/src/utils/primitive.d.ts.map +1 -0
  85. package/dist/core-common/src/utils/str.d.ts +103 -0
  86. package/dist/core-common/src/utils/str.d.ts.map +1 -0
  87. package/dist/core-common/src/utils/template-strings.d.ts +84 -0
  88. package/dist/core-common/src/utils/template-strings.d.ts.map +1 -0
  89. package/dist/core-common/src/utils/transferable.d.ts +47 -0
  90. package/dist/core-common/src/utils/transferable.d.ts.map +1 -0
  91. package/dist/core-common/src/utils/wait.d.ts +19 -0
  92. package/dist/core-common/src/utils/wait.d.ts.map +1 -0
  93. package/dist/core-common/src/utils/xml.d.ts +36 -0
  94. package/dist/core-common/src/utils/xml.d.ts.map +1 -0
  95. package/dist/core-common/src/zip/sd-zip.d.ts +80 -0
  96. package/dist/core-common/src/zip/sd-zip.d.ts.map +1 -0
  97. package/dist/core-node/src/features/fs-watcher.d.ts +70 -0
  98. package/dist/core-node/src/features/fs-watcher.d.ts.map +1 -0
  99. package/dist/core-node/src/index.d.ts +7 -0
  100. package/dist/core-node/src/index.d.ts.map +1 -0
  101. package/dist/core-node/src/utils/fs.d.ts +197 -0
  102. package/dist/core-node/src/utils/fs.d.ts.map +1 -0
  103. package/dist/core-node/src/utils/path.d.ts +75 -0
  104. package/dist/core-node/src/utils/path.d.ts.map +1 -0
  105. package/dist/core-node/src/worker/create-worker.d.ts +23 -0
  106. package/dist/core-node/src/worker/create-worker.d.ts.map +1 -0
  107. package/dist/core-node/src/worker/types.d.ts +67 -0
  108. package/dist/core-node/src/worker/types.d.ts.map +1 -0
  109. package/dist/core-node/src/worker/worker.d.ts +27 -0
  110. package/dist/core-node/src/worker/worker.d.ts.map +1 -0
  111. package/dist/sd-claude/src/commands/install.d.ts +14 -0
  112. package/dist/sd-claude/src/commands/install.d.ts.map +1 -0
  113. package/dist/sd-claude/src/commands/uninstall.d.ts +10 -0
  114. package/dist/sd-claude/src/commands/uninstall.d.ts.map +1 -0
  115. package/dist/sd-claude/src/sd-claude.d.ts +8 -0
  116. package/dist/sd-claude/src/sd-claude.d.ts.map +1 -0
  117. package/dist/sd-claude.js +40 -0
  118. package/dist/sd-claude.js.map +7 -0
  119. package/package.json +30 -0
@@ -0,0 +1,639 @@
1
+ ---
2
+ name: sd-skill
3
+ description: Use when creating new skills, editing existing skills, or verifying skills work before deployment
4
+ model: sonnet
5
+ ---
6
+
7
+ # Writing Skills
8
+
9
+ ## Overview
10
+
11
+ **Writing skills IS Test-Driven Development applied to process documentation.**
12
+
13
+ You write test cases (pressure scenarios with subagents), watch them fail (baseline behavior), write the skill (documentation), watch tests pass (agents comply), and refactor (close loopholes).
14
+
15
+ **Core principle:** If you didn't watch an agent fail without the skill, you don't know if the skill teaches the right thing.
16
+
17
+ **REQUIRED BACKGROUND:** You MUST understand sd-tdd before using this skill. That skill defines the fundamental RED-GREEN-REFACTOR cycle. This skill adapts TDD to documentation.
18
+
19
+ **Official guidance:** For Anthropic's official skill authoring best practices, see anthropic-best-practices.md. This document provides additional patterns and guidelines that complement the TDD-focused approach in this skill.
20
+
21
+ ## What is a Skill?
22
+
23
+ A **skill** is a reference guide for proven techniques, patterns, or tools. Skills help future Claude instances find and apply effective approaches.
24
+
25
+ **Skills are:** Reusable techniques, patterns, tools, reference guides
26
+
27
+ **Skills are NOT:** Narratives about how you solved a problem once
28
+
29
+ ## TDD Mapping for Skills
30
+
31
+ | TDD Concept | Skill Creation |
32
+ |-------------|----------------|
33
+ | **Test case** | Pressure scenario with subagent |
34
+ | **Production code** | Skill document (SKILL.md) |
35
+ | **Test fails (RED)** | Agent violates rule without skill (baseline) |
36
+ | **Test passes (GREEN)** | Agent complies with skill present |
37
+ | **Refactor** | Close loopholes while maintaining compliance |
38
+ | **Write test first** | Run baseline scenario BEFORE writing skill |
39
+ | **Watch it fail** | Document exact rationalizations agent uses |
40
+ | **Minimal code** | Write skill addressing those specific violations |
41
+ | **Watch it pass** | Verify agent now complies |
42
+ | **Refactor cycle** | Find new rationalizations → plug → re-verify |
43
+
44
+ The entire skill creation process follows RED-GREEN-REFACTOR.
45
+
46
+ ## When to Create a Skill
47
+
48
+ **Create when:**
49
+ - Technique wasn't intuitively obvious to you
50
+ - You'd reference this again across projects
51
+ - Pattern applies broadly (not project-specific)
52
+ - Others would benefit
53
+
54
+ **Don't create for:**
55
+ - One-off solutions
56
+ - Standard practices well-documented elsewhere
57
+ - Project-specific conventions (put in CLAUDE.md)
58
+ - Mechanical constraints (if it's enforceable with regex/validation, automate it—save documentation for judgment calls)
59
+
60
+ ## Skill Types
61
+
62
+ ### Technique
63
+ Concrete method with steps to follow (condition-based-waiting, root-cause-tracing)
64
+
65
+ ### Pattern
66
+ Way of thinking about problems (flatten-with-flags, test-invariants)
67
+
68
+ ### Reference
69
+ API docs, syntax guides, tool documentation (office docs)
70
+
71
+ ## Directory Structure
72
+
73
+
74
+ ```
75
+ skills/
76
+ skill-name/
77
+ SKILL.md # Main reference (required)
78
+ supporting-file.* # Only if needed
79
+ ```
80
+
81
+ **Flat namespace** - all skills in one searchable namespace
82
+
83
+ **Separate files for:**
84
+ 1. **Heavy reference** (100+ lines) - API docs, comprehensive syntax
85
+ 2. **Reusable tools** - Scripts, utilities, templates
86
+
87
+ **Keep inline:**
88
+ - Principles and concepts
89
+ - Code patterns (< 50 lines)
90
+ - Everything else
91
+
92
+ ## SKILL.md Structure
93
+
94
+ **Frontmatter (YAML):**
95
+ - Only two fields supported: `name` and `description`
96
+ - Max 1024 characters total
97
+ - `name`: Use letters, numbers, and hyphens only (no parentheses, special chars)
98
+ - `description`: Third-person, describes ONLY when to use (NOT what it does)
99
+ - Start with "Use when..." to focus on triggering conditions
100
+ - Include specific symptoms, situations, and contexts
101
+ - **NEVER summarize the skill's process or workflow** (see CSO section for why)
102
+ - Keep under 500 characters if possible
103
+
104
+ ```markdown
105
+ ---
106
+ name: Skill-Name-With-Hyphens
107
+ description: Use when [specific triggering conditions and symptoms]
108
+ ---
109
+
110
+ # Skill Name
111
+
112
+ ## Overview
113
+ What is this? Core principle in 1-2 sentences.
114
+
115
+ ## When to Use
116
+ [Small inline flowchart IF decision non-obvious]
117
+
118
+ Bullet list with SYMPTOMS and use cases
119
+ When NOT to use
120
+
121
+ ## Core Pattern (for techniques/patterns)
122
+ Before/after code comparison
123
+
124
+ ## Quick Reference
125
+ Table or bullets for scanning common operations
126
+
127
+ ## Implementation
128
+ Inline code for simple patterns
129
+ Link to file for heavy reference or reusable tools
130
+
131
+ ## Common Mistakes
132
+ What goes wrong + fixes
133
+
134
+ ## Real-World Impact (optional)
135
+ Concrete results
136
+ ```
137
+
138
+
139
+ ## Claude Search Optimization (CSO)
140
+
141
+ **Critical for discovery:** Future Claude needs to FIND your skill
142
+
143
+ ### 1. Rich Description Field
144
+
145
+ **Purpose:** Claude reads description to decide which skills to load for a given task. Make it answer: "Should I read this skill right now?"
146
+
147
+ **Format:** Start with "Use when..." to focus on triggering conditions
148
+
149
+ **CRITICAL: Description = When to Use, NOT What the Skill Does**
150
+
151
+ The description should ONLY describe triggering conditions. Do NOT summarize the skill's process or workflow in the description.
152
+
153
+ **Why this matters:** Testing revealed that when a description summarizes the skill's workflow, Claude may follow the description instead of reading the full skill content. A description saying "code review between tasks" caused Claude to do ONE review, even though the skill's flowchart clearly showed TWO reviews (spec compliance then code quality).
154
+
155
+ When the description was changed to just "Use when executing implementation plans with independent tasks" (no workflow summary), Claude correctly read the flowchart and followed the two-stage review process.
156
+
157
+ **The trap:** Descriptions that summarize workflow create a shortcut Claude will take. The skill body becomes documentation Claude skips.
158
+
159
+ ```yaml
160
+ # ❌ BAD: Summarizes workflow - Claude may follow this instead of reading skill
161
+ description: Use when executing plans - dispatches subagent per task with code review between tasks
162
+
163
+ # ❌ BAD: Too much process detail
164
+ description: Use for TDD - write test first, watch it fail, write minimal code, refactor
165
+
166
+ # ✅ GOOD: Just triggering conditions, no workflow summary
167
+ description: Use when executing implementation plans with independent tasks in the current session
168
+
169
+ # ✅ GOOD: Triggering conditions only
170
+ description: Use when implementing any feature or bugfix, before writing implementation code
171
+ ```
172
+
173
+ **Content:**
174
+ - Use concrete triggers, symptoms, and situations that signal this skill applies
175
+ - Describe the *problem* (race conditions, inconsistent behavior) not *language-specific symptoms* (setTimeout, sleep)
176
+ - Keep triggers technology-agnostic unless the skill itself is technology-specific
177
+ - If skill is technology-specific, make that explicit in the trigger
178
+ - Write in third person (injected into system prompt)
179
+ - **NEVER summarize the skill's process or workflow**
180
+
181
+ ```yaml
182
+ # ❌ BAD: Too abstract, vague, doesn't include when to use
183
+ description: For async testing
184
+
185
+ # ❌ BAD: First person
186
+ description: I can help you with async tests when they're flaky
187
+
188
+ # ❌ BAD: Mentions technology but skill isn't specific to it
189
+ description: Use when tests use setTimeout/sleep and are flaky
190
+
191
+ # ✅ GOOD: Starts with "Use when", describes problem, no workflow
192
+ description: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently
193
+
194
+ # ✅ GOOD: Technology-specific skill with explicit trigger
195
+ description: Use when using React Router and handling authentication redirects
196
+ ```
197
+
198
+ ### 2. Keyword Coverage
199
+
200
+ Use words Claude would search for:
201
+ - Error messages: "Hook timed out", "ENOTEMPTY", "race condition"
202
+ - Symptoms: "flaky", "hanging", "zombie", "pollution"
203
+ - Synonyms: "timeout/hang/freeze", "cleanup/teardown/afterEach"
204
+ - Tools: Actual commands, library names, file types
205
+
206
+ ### 3. Descriptive Naming
207
+
208
+ **Use active voice, verb-first:**
209
+ - ✅ `creating-skills` not `skill-creation`
210
+ - ✅ `condition-based-waiting` not `async-test-helpers`
211
+
212
+ ### 4. Token Efficiency (Critical)
213
+
214
+ **Problem:** getting-started and frequently-referenced skills load into EVERY conversation. Every token counts.
215
+
216
+ **Target word counts:**
217
+ - getting-started workflows: <150 words each
218
+ - Frequently-loaded skills: <200 words total
219
+ - Other skills: <500 words (still be concise)
220
+
221
+ **Techniques:**
222
+
223
+ **Move details to tool help:**
224
+ ```bash
225
+ # ❌ BAD: Document all flags in SKILL.md
226
+ search-conversations supports --text, --both, --after DATE, --before DATE, --limit N
227
+
228
+ # ✅ GOOD: Reference --help
229
+ search-conversations supports multiple modes and filters. Run --help for details.
230
+ ```
231
+
232
+ **Use cross-references:**
233
+ ```markdown
234
+ # ❌ BAD: Repeat workflow details
235
+ When searching, dispatch subagent with template...
236
+ [20 lines of repeated instructions]
237
+
238
+ # ✅ GOOD: Reference other skill
239
+ Always use subagents (50-100x context savings). REQUIRED: Use [other-skill-name] for workflow.
240
+ ```
241
+
242
+ **Compress examples:**
243
+ ```markdown
244
+ # ❌ BAD: Verbose example (42 words)
245
+ your human partner: "How did we handle authentication errors in React Router before?"
246
+ You: I'll search past conversations for React Router authentication patterns.
247
+ [Dispatch subagent with search query: "React Router authentication error handling 401"]
248
+
249
+ # ✅ GOOD: Minimal example (20 words)
250
+ Partner: "How did we handle auth errors in React Router?"
251
+ You: Searching...
252
+ [Dispatch subagent → synthesis]
253
+ ```
254
+
255
+ **Eliminate redundancy:**
256
+ - Don't repeat what's in cross-referenced skills
257
+ - Don't explain what's obvious from command
258
+ - Don't include multiple examples of same pattern
259
+
260
+ **Name by what you DO or core insight:**
261
+ - ✅ `condition-based-waiting` > `async-test-helpers`
262
+ - ✅ `using-skills` not `skill-usage`
263
+ - ✅ `flatten-with-flags` > `data-structure-refactoring`
264
+ - ✅ `root-cause-tracing` > `debugging-techniques`
265
+
266
+ **Gerunds (-ing) work well for processes:**
267
+ - `creating-skills`, `testing-skills`, `debugging-with-logs`
268
+ - Active, describes the action you're taking
269
+
270
+ ### 4. Cross-Referencing Other Skills
271
+
272
+ **When writing documentation that references other skills:**
273
+
274
+ Use skill name only, with explicit requirement markers:
275
+ - ✅ Good: `**REQUIRED SUB-SKILL:** Use sd-tdd`
276
+ - ✅ Good: `**REQUIRED BACKGROUND:** You MUST understand sd-tdd`
277
+ - ❌ Bad: `See skills/testing/test-driven-development` (unclear if required)
278
+ - ❌ Bad: `@skills/testing/test-driven-development/SKILL.md` (force-loads, burns context)
279
+
280
+ **Why no @ links:** `@` syntax force-loads files immediately, consuming 200k+ context before you need them.
281
+
282
+ ## Flowchart Usage
283
+
284
+ ```dot
285
+ digraph when_flowchart {
286
+ "Need to show information?" [shape=diamond];
287
+ "Decision where I might go wrong?" [shape=diamond];
288
+ "Use markdown" [shape=box];
289
+ "Small inline flowchart" [shape=box];
290
+
291
+ "Need to show information?" -> "Decision where I might go wrong?" [label="yes"];
292
+ "Decision where I might go wrong?" -> "Small inline flowchart" [label="yes"];
293
+ "Decision where I might go wrong?" -> "Use markdown" [label="no"];
294
+ }
295
+ ```
296
+
297
+ **Use flowcharts ONLY for:**
298
+ - Non-obvious decision points
299
+ - Process loops where you might stop too early
300
+ - "When to use A vs B" decisions
301
+
302
+ **Never use flowcharts for:**
303
+ - Reference material → Tables, lists
304
+ - Code examples → Markdown blocks
305
+ - Linear instructions → Numbered lists
306
+ - Labels without semantic meaning (step1, helper2)
307
+
308
+ ## Code Examples
309
+
310
+ **One excellent example beats many mediocre ones**
311
+
312
+ Choose most relevant language:
313
+ - Testing techniques → TypeScript/JavaScript
314
+ - System debugging → Shell/Python
315
+ - Data processing → Python
316
+
317
+ **Good example:**
318
+ - Complete and runnable
319
+ - Well-commented explaining WHY
320
+ - From real scenario
321
+ - Shows pattern clearly
322
+ - Ready to adapt (not generic template)
323
+
324
+ **Don't:**
325
+ - Implement in 5+ languages
326
+ - Create fill-in-the-blank templates
327
+ - Write contrived examples
328
+
329
+ You're good at porting - one great example is enough.
330
+
331
+ ## File Organization
332
+
333
+ ### Self-Contained Skill
334
+ ```
335
+ defense-in-depth/
336
+ SKILL.md # Everything inline
337
+ ```
338
+ When: All content fits, no heavy reference needed
339
+
340
+ ### Skill with Reusable Tool
341
+ ```
342
+ condition-based-waiting/
343
+ SKILL.md # Overview + patterns
344
+ example.ts # Working helpers to adapt
345
+ ```
346
+ When: Tool is reusable code, not just narrative
347
+
348
+ ### Skill with Heavy Reference
349
+ ```
350
+ pptx/
351
+ SKILL.md # Overview + workflows
352
+ pptxgenjs.md # 600 lines API reference
353
+ ooxml.md # 500 lines XML structure
354
+ scripts/ # Executable tools
355
+ ```
356
+ When: Reference material too large for inline
357
+
358
+ ## The Iron Law (Same as TDD)
359
+
360
+ ```
361
+ NO SKILL WITHOUT A FAILING TEST FIRST
362
+ ```
363
+
364
+ This applies to NEW skills AND EDITS to existing skills.
365
+
366
+ Write skill before testing? Delete it. Start over.
367
+ Edit skill without testing? Same violation.
368
+
369
+ **No exceptions:**
370
+ - Not for "simple additions"
371
+ - Not for "just adding a section"
372
+ - Not for "documentation updates"
373
+ - Don't keep untested changes as "reference"
374
+ - Don't "adapt" while running tests
375
+ - Delete means delete
376
+
377
+ **REQUIRED BACKGROUND:** The sd-tdd skill explains why this matters. Same principles apply to documentation.
378
+
379
+ ## Testing All Skill Types
380
+
381
+ Different skill types need different test approaches:
382
+
383
+ ### Discipline-Enforcing Skills (rules/requirements)
384
+
385
+ **Examples:** TDD, verification-before-completion, designing-before-coding
386
+
387
+ **Test with:**
388
+ - Academic questions: Do they understand the rules?
389
+ - Pressure scenarios: Do they comply under stress?
390
+ - Multiple pressures combined: time + sunk cost + exhaustion
391
+ - Identify rationalizations and add explicit counters
392
+
393
+ **Success criteria:** Agent follows rule under maximum pressure
394
+
395
+ ### Technique Skills (how-to guides)
396
+
397
+ **Examples:** condition-based-waiting, root-cause-tracing, defensive-programming
398
+
399
+ **Test with:**
400
+ - Application scenarios: Can they apply the technique correctly?
401
+ - Variation scenarios: Do they handle edge cases?
402
+ - Missing information tests: Do instructions have gaps?
403
+
404
+ **Success criteria:** Agent successfully applies technique to new scenario
405
+
406
+ ### Pattern Skills (mental models)
407
+
408
+ **Examples:** reducing-complexity, information-hiding concepts
409
+
410
+ **Test with:**
411
+ - Recognition scenarios: Do they recognize when pattern applies?
412
+ - Application scenarios: Can they use the mental model?
413
+ - Counter-examples: Do they know when NOT to apply?
414
+
415
+ **Success criteria:** Agent correctly identifies when/how to apply pattern
416
+
417
+ ### Reference Skills (documentation/APIs)
418
+
419
+ **Examples:** API documentation, command references, library guides
420
+
421
+ **Test with:**
422
+ - Retrieval scenarios: Can they find the right information?
423
+ - Application scenarios: Can they use what they found correctly?
424
+ - Gap testing: Are common use cases covered?
425
+
426
+ **Success criteria:** Agent finds and correctly applies reference information
427
+
428
+ ## Common Rationalizations for Skipping Testing
429
+
430
+ | Excuse | Reality |
431
+ |--------|---------|
432
+ | "Skill is obviously clear" | Clear to you ≠ clear to other agents. Test it. |
433
+ | "It's just a reference" | References can have gaps, unclear sections. Test retrieval. |
434
+ | "Testing is overkill" | Untested skills have issues. Always. 15 min testing saves hours. |
435
+ | "I'll test if problems emerge" | Problems = agents can't use skill. Test BEFORE deploying. |
436
+ | "Too tedious to test" | Testing is less tedious than debugging bad skill in production. |
437
+ | "I'm confident it's good" | Overconfidence guarantees issues. Test anyway. |
438
+ | "Academic review is enough" | Reading ≠ using. Test application scenarios. |
439
+ | "No time to test" | Deploying untested skill wastes more time fixing it later. |
440
+
441
+ **All of these mean: Test before deploying. No exceptions.**
442
+
443
+ ## Bulletproofing Skills Against Rationalization
444
+
445
+ Skills that enforce discipline (like TDD) need to resist rationalization. Agents are smart and will find loopholes when under pressure.
446
+
447
+ **Psychology note:** Understanding WHY persuasion techniques work helps you apply them systematically. See persuasion-principles.md for research foundation (Cialdini, 2021; Meincke et al., 2025) on authority, commitment, scarcity, social proof, and unity principles.
448
+
449
+ ### Close Every Loophole Explicitly
450
+
451
+ Don't just state the rule - forbid specific workarounds:
452
+
453
+ <Bad>
454
+ ```markdown
455
+ Write code before test? Delete it.
456
+ ```
457
+ </Bad>
458
+
459
+ <Good>
460
+ ```markdown
461
+ Write code before test? Delete it. Start over.
462
+
463
+ **No exceptions:**
464
+ - Don't keep it as "reference"
465
+ - Don't "adapt" it while writing tests
466
+ - Don't look at it
467
+ - Delete means delete
468
+ ```
469
+ </Good>
470
+
471
+ ### Address "Spirit vs Letter" Arguments
472
+
473
+ Add foundational principle early:
474
+
475
+ ```markdown
476
+ **Violating the letter of the rules is violating the spirit of the rules.**
477
+ ```
478
+
479
+ This cuts off entire class of "I'm following the spirit" rationalizations.
480
+
481
+ ### Build Rationalization Table
482
+
483
+ Capture rationalizations from baseline testing (see Testing section below). Every excuse agents make goes in the table:
484
+
485
+ ```markdown
486
+ | Excuse | Reality |
487
+ |--------|---------|
488
+ | "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
489
+ | "I'll test after" | Tests passing immediately prove nothing. |
490
+ | "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
491
+ ```
492
+
493
+ ### Create Red Flags List
494
+
495
+ Make it easy for agents to self-check when rationalizing:
496
+
497
+ ```markdown
498
+ ## Red Flags - STOP and Start Over
499
+
500
+ - Code before test
501
+ - "I already manually tested it"
502
+ - "Tests after achieve the same purpose"
503
+ - "It's about spirit not ritual"
504
+ - "This is different because..."
505
+
506
+ **All of these mean: Delete code. Start over with TDD.**
507
+ ```
508
+
509
+ ### Update CSO for Violation Symptoms
510
+
511
+ Add to description: symptoms of when you're ABOUT to violate the rule:
512
+
513
+ ```yaml
514
+ description: use when implementing any feature or bugfix, before writing implementation code
515
+ ```
516
+
517
+ ## RED-GREEN-REFACTOR for Skills
518
+
519
+ Follow the TDD cycle:
520
+
521
+ ### RED: Write Failing Test (Baseline)
522
+
523
+ Run pressure scenario with subagent WITHOUT the skill. Document exact behavior:
524
+ - What choices did they make?
525
+ - What rationalizations did they use (verbatim)?
526
+ - Which pressures triggered violations?
527
+
528
+ This is "watch the test fail" - you must see what agents naturally do before writing the skill.
529
+
530
+ ### GREEN: Write Minimal Skill
531
+
532
+ Write skill that addresses those specific rationalizations. Don't add extra content for hypothetical cases.
533
+
534
+ Run same scenarios WITH skill. Agent should now comply.
535
+
536
+ ### REFACTOR: Close Loopholes
537
+
538
+ Agent found new rationalization? Add explicit counter. Re-test until bulletproof.
539
+
540
+ **Testing methodology:** See testing-skills-with-subagents.md for the complete testing methodology:
541
+ - How to write pressure scenarios
542
+ - Pressure types (time, sunk cost, authority, exhaustion)
543
+ - Plugging holes systematically
544
+ - Meta-testing techniques
545
+
546
+ ## Anti-Patterns
547
+
548
+ ### ❌ Narrative Example
549
+ "In session 2025-10-03, we found empty projectDir caused..."
550
+ **Why bad:** Too specific, not reusable
551
+
552
+ ### ❌ Multi-Language Dilution
553
+ example-js.js, example-py.py, example-go.go
554
+ **Why bad:** Mediocre quality, maintenance burden
555
+
556
+ ### ❌ Code in Flowcharts
557
+ ```dot
558
+ step1 [label="import fs"];
559
+ step2 [label="read file"];
560
+ ```
561
+ **Why bad:** Can't copy-paste, hard to read
562
+
563
+ ### ❌ Generic Labels
564
+ helper1, helper2, step3, pattern4
565
+ **Why bad:** Labels should have semantic meaning
566
+
567
+ ## STOP: Before Moving to Next Skill
568
+
569
+ **After writing ANY skill, you MUST STOP and complete the deployment process.**
570
+
571
+ **Do NOT:**
572
+ - Create multiple skills in batch without testing each
573
+ - Move to next skill before current one is verified
574
+ - Skip testing because "batching is more efficient"
575
+
576
+ **The deployment checklist below is MANDATORY for EACH skill.**
577
+
578
+ Deploying untested skills = deploying untested code. It's a violation of quality standards.
579
+
580
+ ## Skill Creation Checklist (TDD Adapted)
581
+
582
+ **IMPORTANT: Use TaskCreate to create todos for EACH checklist item below.**
583
+
584
+ **RED Phase - Write Failing Test:**
585
+ - [ ] Create pressure scenarios (3+ combined pressures for discipline skills)
586
+ - [ ] Run scenarios WITHOUT skill - document baseline behavior verbatim
587
+ - [ ] Identify patterns in rationalizations/failures
588
+
589
+ **GREEN Phase - Write Minimal Skill:**
590
+ - [ ] Name uses only letters, numbers, hyphens (no parentheses/special chars)
591
+ - [ ] YAML frontmatter with only name and description (max 1024 chars)
592
+ - [ ] Description starts with "Use when..." and includes specific triggers/symptoms
593
+ - [ ] Description written in third person
594
+ - [ ] Keywords throughout for search (errors, symptoms, tools)
595
+ - [ ] Clear overview with core principle
596
+ - [ ] Address specific baseline failures identified in RED
597
+ - [ ] Code inline OR link to separate file
598
+ - [ ] One excellent example (not multi-language)
599
+ - [ ] Run scenarios WITH skill - verify agents now comply
600
+
601
+ **REFACTOR Phase - Close Loopholes:**
602
+ - [ ] Identify NEW rationalizations from testing
603
+ - [ ] Add explicit counters (if discipline skill)
604
+ - [ ] Build rationalization table from all test iterations
605
+ - [ ] Create red flags list
606
+ - [ ] Re-test until bulletproof
607
+
608
+ **Quality Checks:**
609
+ - [ ] Small flowchart only if decision non-obvious
610
+ - [ ] Quick reference table
611
+ - [ ] Common mistakes section
612
+ - [ ] No narrative storytelling
613
+ - [ ] Supporting files only for tools or heavy reference
614
+
615
+ **Deployment:**
616
+ - [ ] Commit skill to git and push to your fork (if configured)
617
+ - [ ] Consider contributing back via PR (if broadly useful)
618
+
619
+ ## Discovery Workflow
620
+
621
+ How future Claude finds your skill:
622
+
623
+ 1. **Encounters problem** ("tests are flaky")
624
+ 3. **Finds SKILL** (description matches)
625
+ 4. **Scans overview** (is this relevant?)
626
+ 5. **Reads patterns** (quick reference table)
627
+ 6. **Loads example** (only when implementing)
628
+
629
+ **Optimize for this flow** - put searchable terms early and often.
630
+
631
+ ## The Bottom Line
632
+
633
+ **Creating skills IS TDD for process documentation.**
634
+
635
+ Same Iron Law: No skill without failing test first.
636
+ Same cycle: RED (baseline) → GREEN (write skill) → REFACTOR (close loopholes).
637
+ Same benefits: Better quality, fewer surprises, bulletproof results.
638
+
639
+ If you follow TDD for code, follow it for skills. It's the same discipline applied to documentation.