clawpowers 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/.claude-plugin/manifest.json +19 -0
  2. package/.codex/INSTALL.md +36 -0
  3. package/.cursor-plugin/manifest.json +21 -0
  4. package/.opencode/INSTALL.md +52 -0
  5. package/ARCHITECTURE.md +69 -0
  6. package/README.md +381 -0
  7. package/bin/clawpowers.js +390 -0
  8. package/bin/clawpowers.sh +91 -0
  9. package/gemini-extension.json +32 -0
  10. package/hooks/session-start +205 -0
  11. package/hooks/session-start.cmd +43 -0
  12. package/hooks/session-start.js +163 -0
  13. package/package.json +54 -0
  14. package/runtime/feedback/analyze.js +621 -0
  15. package/runtime/feedback/analyze.sh +546 -0
  16. package/runtime/init.js +172 -0
  17. package/runtime/init.sh +145 -0
  18. package/runtime/metrics/collector.js +361 -0
  19. package/runtime/metrics/collector.sh +308 -0
  20. package/runtime/persistence/store.js +433 -0
  21. package/runtime/persistence/store.sh +303 -0
  22. package/skill.json +74 -0
  23. package/skills/agent-payments/SKILL.md +411 -0
  24. package/skills/brainstorming/SKILL.md +233 -0
  25. package/skills/content-pipeline/SKILL.md +282 -0
  26. package/skills/dispatching-parallel-agents/SKILL.md +305 -0
  27. package/skills/executing-plans/SKILL.md +255 -0
  28. package/skills/finishing-a-development-branch/SKILL.md +260 -0
  29. package/skills/learn-how-to-learn/SKILL.md +235 -0
  30. package/skills/market-intelligence/SKILL.md +288 -0
  31. package/skills/prospecting/SKILL.md +313 -0
  32. package/skills/receiving-code-review/SKILL.md +225 -0
  33. package/skills/requesting-code-review/SKILL.md +206 -0
  34. package/skills/security-audit/SKILL.md +308 -0
  35. package/skills/subagent-driven-development/SKILL.md +244 -0
  36. package/skills/systematic-debugging/SKILL.md +279 -0
  37. package/skills/test-driven-development/SKILL.md +299 -0
  38. package/skills/using-clawpowers/SKILL.md +137 -0
  39. package/skills/using-git-worktrees/SKILL.md +261 -0
  40. package/skills/verification-before-completion/SKILL.md +254 -0
  41. package/skills/writing-plans/SKILL.md +276 -0
  42. package/skills/writing-skills/SKILL.md +260 -0
@@ -0,0 +1,260 @@
1
+ ---
2
+ name: writing-skills
3
+ description: Create new ClawPowers skills using TDD methodology — write test scenarios, watch the agent fail without the skill, write the skill, verify the agent passes. Activate when you need a new skill that ClawPowers doesn't have.
4
+ version: 1.0.0
5
+ requires:
6
+ tools: [bash]
7
+ runtime: false
8
+ metrics:
9
+ tracks: [skills_written, skill_quality_scores, test_coverage, anti_pattern_count]
10
+ improves: [skill_structure_quality, when_to_use_clarity, example_relevance]
11
+ ---
12
+
13
+ # Writing Skills
14
+
15
+ ## When to Use
16
+
17
+ Apply this skill when:
18
+
19
+ - ClawPowers lacks a skill you need repeatedly
20
+ - You've solved a non-trivial problem 3+ times and want to codify the approach
21
+ - A team has domain-specific methodologies that should be agent-accessible
22
+ - An existing skill is missing important context or examples
23
+ - You're improving an existing skill that consistently produces suboptimal results
24
+
25
+ **Skip when:**
26
+ - The skill would be a one-off
27
+ - The methodology is already captured in a skill that could be extended
28
+ - You don't have enough real experience with the problem to write a useful skill (skills written from theory, not experience, are worse than no skill)
29
+
30
+ **Decision tree:**
31
+ ```
32
+ Have you solved this problem multiple times manually?
33
+ ├── No → Solve it first. Document later.
34
+ └── Yes → Is it covered by an existing skill?
35
+ ├── Yes → Extend the existing skill (new section, new example)
36
+ └── No → writing-skills ← YOU ARE HERE
37
+ ```
38
+
39
+ ## Core Methodology
40
+
41
+ ### TDD for Skills
42
+
43
+ Skills are tested by measuring whether an agent WITHOUT the skill fails a scenario that an agent WITH the skill handles correctly. This is behavioral testing — not unit testing of code.
44
+
45
+ ### Phase 1: Write Test Scenarios (RED)
46
+
47
+ Before writing any skill content, write test scenarios that the skill must handle.
48
+
49
+ **Test scenario format:**
50
+ ```markdown
51
+ ## Scenario N: [Descriptive name]
52
+
53
+ **Agent state:** Agent has no knowledge of [skill domain]
54
+ **Input:** [Exact prompt or situation the agent receives]
55
+ **Without skill:** [Specific wrong behavior the agent exhibits]
56
+ **With skill:** [Specific correct behavior the skill produces]
57
+ **Success criteria:**
58
+ - [ ] [Observable, verifiable outcome]
59
+ - [ ] [Observable, verifiable outcome]
60
+ ```
61
+
62
+ **Minimum scenarios before writing the skill:**
63
+ - 1 happy path (common use case)
64
+ - 1 edge case (unusual but valid)
65
+ - 1 failure case (when NOT to use the skill)
66
+ - 1 anti-pattern case (common mistake the skill prevents)
67
+
68
+ **Example scenarios for a hypothetical "database-migration" skill:**
69
+
70
+ ```markdown
71
+ ## Scenario 1: Running migrations safely
72
+ Without skill: Agent runs `alembic upgrade head` without backing up first
73
+ With skill: Agent follows backup → dry-run → verify → apply sequence
74
+
75
+ ## Scenario 2: Rolling back a bad migration
76
+ Without skill: Agent manually deletes rows or drops columns (data loss)
77
+ With skill: Agent runs `alembic downgrade -1`, verifies schema, identifies root cause
78
+
79
+ ## Scenario 3: When NOT to use this skill
80
+ Input: "Update the user model to add an index"
81
+ Without skill: Agent triggers migration skill for every schema change
82
+ With skill: Agent recognizes index-only changes don't need this protocol
83
+
84
+ ## Scenario 4: Anti-pattern — concurrent migrations
85
+ Without skill: Agent runs migrations in parallel across multiple servers
86
+ With skill: Agent ensures single-server serial execution with distributed lock
87
+ ```
88
+
89
+ ### Phase 2: Verify Failure (The "RED" Moment)
90
+
91
+ Before writing the skill, verify that an agent without it fails at least Scenario 1. This confirms:
92
+ - The skill is actually needed
93
+ - The test scenarios are meaningful
94
+ - The skill will produce measurable improvement
95
+
96
+ If an agent without the skill already handles the scenarios correctly, you don't need the skill.
97
+
98
+ ### Phase 3: Write the Skill
99
+
100
+ Use the ClawPowers skill template:
101
+
102
+ ```markdown
103
+ ---
104
+ name: skill-name-kebab-case
105
+ description: [One sentence: when to trigger this skill. Start with "Activate when..."]
106
+ version: 1.0.0
107
+ requires:
108
+ tools: [tool1, tool2] # Only tools the skill actually requires
109
+ runtime: false # true if skill needs ~/.clawpowers/
110
+ metrics:
111
+ tracks: [metric1, metric2] # Observable outcomes
112
+ improves: [param1, param2] # Parameters RSI can tune
113
+ ---
114
+
115
+ # [Skill Name]
116
+
117
+ ## When to Use
118
+
119
+ [Decision tree. Include when to skip the skill.]
120
+
121
+ ## Core Methodology
122
+
123
+ [The actual methodology. Numbered steps. Concrete, not abstract.]
124
+
125
+ ## ClawPowers Enhancement
126
+
127
+ [What the runtime layer adds. Only if runtime: true or if runtime is optional benefit.]
128
+
129
+ ## Anti-Patterns
130
+
131
+ [Table of common mistakes, why they fail, correct approach.]
132
+
133
+ ## Examples
134
+
135
+ [1-3 concrete examples with real code/commands, not hypotheticals.]
136
+ ```
137
+
138
+ ### Phase 4: Quality Gates
139
+
140
+ Before the skill is "done", it must pass these gates:
141
+
142
+ **Gate 1: When to Use is a decision tree, not a list**
143
+ - Does it tell you when NOT to use the skill?
144
+ - Does it handle edge cases in the decision?
145
+
146
+ **Gate 2: Core Methodology is actionable**
147
+ - Can someone follow these steps without guessing?
148
+ - Does every step produce a verifiable output?
149
+ - Are code/command examples real, not pseudocode?
150
+
151
+ **Gate 3: Anti-Patterns are specific**
152
+ - Each anti-pattern names a specific behavior, not a category
153
+ - Each explains WHY it fails (not just "don't do this")
154
+ - Each provides a concrete correct approach
155
+
156
+ **Gate 4: Examples are real**
157
+ - Examples use plausible real names (not `foo`, `bar`, `example`)
158
+ - Code examples are syntactically correct
159
+ - Examples cover the most common real-world use case
160
+
161
+ **Gate 5: No stubs**
162
+ - No "TODO: add examples here"
163
+ - No "coming soon" sections
164
+ - No placeholder text
165
+
166
+ ### Phase 5: Verify Pass (The "GREEN" Moment)
167
+
168
+ Apply the test scenarios to the completed skill. Verify:
169
+ - Scenario 1 (happy path): skill guides agent to correct outcome
170
+ - Scenario 2 (edge case): skill handles it explicitly or provides guidance
171
+ - Scenario 3 (skip case): skill's "When to Use" correctly excludes this
172
+ - Scenario 4 (anti-pattern): skill's Anti-Patterns section covers it
173
+
174
+ ### Phase 6: Register the Skill
175
+
176
+ Add the skill to `skills/using-clawpowers/SKILL.md`:
177
+
178
+ ```markdown
179
+ # In the "Quick Reference" section, add:
180
+ 25. `database-migration` — Safe migration sequence with backup, dry-run, and rollback
181
+ ```
182
+
183
+ Add trigger pattern to the pattern map:
184
+ ```markdown
185
+ | Running or planning a database schema change | `database-migration` |
186
+ ```
187
+
188
+ ## ClawPowers Enhancement
189
+
190
+ When `~/.clawpowers/` runtime is initialized:
191
+
192
+ **Skill Quality Scoring:**
193
+
194
+ Each skill is scored on:
195
+ - Scenario coverage (how many test scenarios does it pass?)
196
+ - Usage frequency (how often is it triggered per session?)
197
+ - Outcome rate (when triggered, what % of executions succeed?)
198
+ - Anti-pattern prevention (how often does it prevent a documented anti-pattern?)
199
+
200
+ ```bash
201
+ bash runtime/persistence/store.sh set "skill-quality:database-migration:scenario_coverage" "4/4"
202
+ bash runtime/persistence/store.sh set "skill-quality:database-migration:outcome_rate" "0.92"
203
+ ```
204
+
205
+ **Anti-Pattern Detection:**
206
+
207
+ The feedback engine monitors skill usage for anti-patterns not covered by the skill:
208
+ ```bash
209
+ bash runtime/feedback/analyze.sh --skill database-migration
210
+ # → New anti-pattern detected: agents omit the verify step after applying migrations
211
+ # → Recommend adding explicit verify step to Core Methodology
212
+ ```
213
+
214
+ **Skill Evolution:**
215
+
216
+ When a skill's outcome rate drops below threshold (< 80%), the feedback engine flags it for revision:
217
+ ```bash
218
+ bash runtime/metrics/collector.sh record \
219
+ --skill writing-skills \
220
+ --outcome success \
221
+ --notes "database-migration: 4 scenarios, all passing, quality gates cleared"
222
+ ```
223
+
224
+ ## Anti-Patterns
225
+
226
+ | Anti-Pattern | Why It Fails | Correct Approach |
227
+ |-------------|-------------|-----------------|
228
+ | Writing from theory | Skill misses real-world edge cases | Write skills from real experience only |
229
+ | Skipping test scenarios | No way to verify the skill works | Write scenarios first (TDD) |
230
+ | Vague "When to Use" | Skill triggers at wrong times | Decision tree with explicit skip conditions |
231
+ | Placeholder sections | Skill is deployed incomplete | All sections must be complete before registration |
232
+ | One giant methodology section | Agents lose track of where they are | Numbered steps with verifiable outputs |
233
+ | No anti-patterns section | Common mistakes recur | Always include anti-patterns |
234
+ | Examples with foo/bar names | Low signal — agents don't recognize applicability | Use realistic domain names in examples |
235
+
236
+ ## Examples
237
+
238
+ ### Example 1: Simple Skill (2 scenarios)
239
+
240
+ **Skill:** `git-submodule-update`
241
+ **Problem:** Agents frequently forget to update submodules after `git pull`
242
+
243
+ **Scenarios:**
244
+ 1. After `git pull`, submodule code is stale — skill ensures `git submodule update --init --recursive`
245
+ 2. New submodule added — skill ensures `git submodule update --init` for new submodules only
246
+
247
+ **Skill structure:** When to Use → 3-step methodology (detect stale, update, verify) → 2 anti-patterns → 1 example
248
+
249
+ ### Example 2: Complex Skill (4 scenarios)
250
+
251
+ **Skill:** `zero-downtime-deployment`
252
+ **Problem:** Agents deploy without considering traffic impact
253
+
254
+ **Scenarios:**
255
+ 1. Deploying new version (happy path) — blue-green or rolling strategy
256
+ 2. Deploying with schema migration — migration-first, app second
257
+ 3. Rolling back a bad deploy — revert app before revert migration
258
+ 4. Skip case — deploying to a dev environment with no traffic
259
+
260
+ **Skill structure:** When to Use (with explicit skip for dev) → 5-step methodology → 4 anti-patterns → 2 examples (with and without migration)