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