opencodekit 0.10.0 → 0.11.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 (47) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/agent/planner.md +3 -2
  3. package/dist/template/.opencode/command/accessibility-check.md +297 -30
  4. package/dist/template/.opencode/command/analyze-mockup.md +412 -20
  5. package/dist/template/.opencode/command/analyze-project.md +445 -30
  6. package/dist/template/.opencode/command/brainstorm.md +294 -5
  7. package/dist/template/.opencode/command/commit.md +231 -17
  8. package/dist/template/.opencode/command/create.md +415 -77
  9. package/dist/template/.opencode/command/design-audit.md +483 -29
  10. package/dist/template/.opencode/command/design.md +615 -6
  11. package/dist/template/.opencode/command/edit-image.md +223 -20
  12. package/dist/template/.opencode/command/finish.md +163 -71
  13. package/dist/template/.opencode/command/fix-ci.md +297 -24
  14. package/dist/template/.opencode/command/fix-types.md +351 -13
  15. package/dist/template/.opencode/command/fix-ui.md +299 -13
  16. package/dist/template/.opencode/command/fix.md +262 -9
  17. package/dist/template/.opencode/command/generate-diagram.md +327 -26
  18. package/dist/template/.opencode/command/generate-icon.md +266 -22
  19. package/dist/template/.opencode/command/generate-image.md +232 -12
  20. package/dist/template/.opencode/command/generate-pattern.md +234 -20
  21. package/dist/template/.opencode/command/generate-storyboard.md +231 -21
  22. package/dist/template/.opencode/command/handoff.md +208 -31
  23. package/dist/template/.opencode/command/implement.md +163 -50
  24. package/dist/template/.opencode/command/import-plan.md +253 -52
  25. package/dist/template/.opencode/command/init.md +154 -35
  26. package/dist/template/.opencode/command/integration-test.md +410 -24
  27. package/dist/template/.opencode/command/issue.md +177 -21
  28. package/dist/template/.opencode/command/new-feature.md +390 -54
  29. package/dist/template/.opencode/command/plan.md +394 -107
  30. package/dist/template/.opencode/command/pr.md +235 -29
  31. package/dist/template/.opencode/command/quick-build.md +234 -5
  32. package/dist/template/.opencode/command/research-and-implement.md +442 -12
  33. package/dist/template/.opencode/command/research-ui.md +444 -34
  34. package/dist/template/.opencode/command/research.md +179 -45
  35. package/dist/template/.opencode/command/restore-image.md +416 -22
  36. package/dist/template/.opencode/command/resume.md +447 -63
  37. package/dist/template/.opencode/command/revert-feature.md +347 -65
  38. package/dist/template/.opencode/command/review-codebase.md +199 -4
  39. package/dist/template/.opencode/command/skill-create.md +506 -14
  40. package/dist/template/.opencode/command/skill-optimize.md +487 -16
  41. package/dist/template/.opencode/command/status.md +326 -60
  42. package/dist/template/.opencode/command/summarize.md +374 -33
  43. package/dist/template/.opencode/command/triage.md +361 -0
  44. package/dist/template/.opencode/command/ui-review.md +296 -25
  45. package/dist/template/.opencode/skill/beads/SKILL.md +108 -3
  46. package/dist/template/.opencode/skill/playwriter/SKILL.md +148 -0
  47. package/package.json +1 -1
@@ -1,28 +1,499 @@
1
1
  ---
2
- description: Optimize an existing agent skill
3
- argument-hint: "[skill-name]"
2
+ description: Optimize an existing skill for clarity, brevity, and effectiveness
3
+ argument-hint: "<skill-name> [--audit] [--compress] [--test]"
4
4
  agent: build
5
5
  ---
6
6
 
7
7
  # Optimize Skill: $ARGUMENTS
8
8
 
9
- Use `skill({ name: "writing-skills" })` to optimize an existing skill.
9
+ Improve an existing skill to be more effective, concise, and resistant to agent rationalization.
10
10
 
11
- ## Workflow
11
+ ## Prerequisites
12
12
 
13
- 1. **Read current skill** from `.opencode/skill/$ARGUMENTS/` or `.opencode/superpowers/skills/$ARGUMENTS/`
14
- 2. **Load skill** - `skill({ name: "writing-skills" })`
15
- 3. **Apply TDD process** - Test, refine, verify
16
- 4. **Test changes** with `skill({ name: "testing-skills-with-subagents" })`
13
+ Load the skill-writing methodology:
17
14
 
18
- ## Optimization Goals
15
+ ```typescript
16
+ skill({ name: "writing-skills" });
17
+ ```
19
18
 
20
- - Reduce verbosity
21
- - Close rationalization loopholes
22
- - Add missing constraints
23
- - Improve clarity
19
+ ## Phase 1: Locate and Load Current Skill
24
20
 
25
- ## After Optimization
21
+ ### Find Skill Location
26
22
 
27
- - Verify with subagent testing
28
- - Share improvements upstream with `skill({ name: "sharing-skills" })`
23
+ ```bash
24
+ # Check local skills first
25
+ ls -la .opencode/skill/$ARGUMENTS/ 2>/dev/null
26
+
27
+ # Check superpowers (shared skills)
28
+ ls -la .opencode/superpowers/skills/$ARGUMENTS/ 2>/dev/null
29
+
30
+ # Check installed skills
31
+ ls -la ~/.opencode/skills/$ARGUMENTS/ 2>/dev/null
32
+ ```
33
+
34
+ ### Load Current Content
35
+
36
+ ```typescript
37
+ read({ filePath: ".opencode/skill/$ARGUMENTS/SKILL.md" });
38
+ read({ filePath: ".opencode/skill/$ARGUMENTS/instructions.md" });
39
+ ```
40
+
41
+ ## Phase 2: Skill Audit
42
+
43
+ ### Metrics to Evaluate
44
+
45
+ ```
46
+ SKILL AUDIT: $ARGUMENTS
47
+ ━━━━━━━━━━━━━━━━━━━━━━━
48
+
49
+ STRUCTURE
50
+ ─────────
51
+ Lines in SKILL.md: [count]
52
+ Lines in instructions.md: [count]
53
+ Total tokens (est): [count]
54
+ Phases defined: [count]
55
+ Verification steps: [count]
56
+
57
+ QUALITY INDICATORS
58
+ ──────────────────
59
+ Score Notes
60
+ Trigger Clarity [1-5] [notes]
61
+ Step Specificity [1-5] [notes]
62
+ Rationalization Resistance [1-5] [notes]
63
+ Verification Coverage [1-5] [notes]
64
+ Anti-Pattern Coverage [1-5] [notes]
65
+ Example Quality [1-5] [notes]
66
+
67
+ Overall Score: [X]/30
68
+
69
+ ISSUES DETECTED
70
+ ───────────────
71
+ ⚠️ [Issue 1]
72
+ ⚠️ [Issue 2]
73
+ ⚠️ [Issue 3]
74
+ ```
75
+
76
+ ### Common Issues to Check
77
+
78
+ ```typescript
79
+ const auditChecklist = [
80
+ // Clarity Issues
81
+ { pattern: /usually|typically|generally/gi, issue: "Ambiguous language" },
82
+ { pattern: /consider|might want to/gi, issue: "Weak directives" },
83
+ { pattern: /if you feel|as needed/gi, issue: "Subjective conditions" },
84
+
85
+ // Missing Structure
86
+ { check: "no_phases", issue: "Missing phase structure" },
87
+ { check: "no_verification", issue: "No verification steps" },
88
+ { check: "no_antipatterns", issue: "Missing anti-patterns section" },
89
+
90
+ // Bloat
91
+ {
92
+ check: "excessive_explanation",
93
+ issue: "Too much rationale, not enough instruction",
94
+ },
95
+ { check: "duplicate_content", issue: "Repeated information" },
96
+ { check: "no_examples", issue: "Abstract without examples" },
97
+
98
+ // Gaps
99
+ { check: "no_error_handling", issue: "Missing error handling" },
100
+ { check: "no_escape_hatch", issue: "No exit conditions defined" },
101
+ ];
102
+ ```
103
+
104
+ ## Phase 3: Identify Optimization Goals
105
+
106
+ ### Optimization Types
107
+
108
+ | Goal | When to Use | Approach |
109
+ | --------------- | ------------------------------- | ----------------------------------- |
110
+ | **Compress** | Skill is too verbose | Remove redundancy, tighten language |
111
+ | **Clarify** | Agents misinterpret steps | Make instructions more specific |
112
+ | **Harden** | Agents rationalize around rules | Add MUST/NEVER, close loopholes |
113
+ | **Expand** | Missing edge cases | Add scenarios, anti-patterns |
114
+ | **Restructure** | Poor flow | Reorganize phases |
115
+
116
+ ### Select Optimization Mode
117
+
118
+ Based on audit, prioritize:
119
+
120
+ ```
121
+ OPTIMIZATION PLAN: $ARGUMENTS
122
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
123
+
124
+ Primary Goal: [COMPRESS/CLARIFY/HARDEN/EXPAND/RESTRUCTURE]
125
+
126
+ Changes Needed:
127
+ 1. [High priority change]
128
+ 2. [Medium priority change]
129
+ 3. [Low priority change]
130
+
131
+ Estimated Token Savings: [X tokens]
132
+ Expected Effectiveness Gain: [description]
133
+ ```
134
+
135
+ ## Phase 4: Apply Optimizations
136
+
137
+ ### Compression Techniques
138
+
139
+ ```
140
+ BEFORE (verbose):
141
+ ─────────────────
142
+ "When you are working on this task, you should typically try
143
+ to make sure that you check the test results before moving
144
+ forward to the next step. This is important because tests
145
+ can reveal issues that might otherwise go unnoticed."
146
+
147
+ AFTER (compressed):
148
+ ───────────────────
149
+ "MUST run tests before proceeding. If any fail, STOP and fix."
150
+
151
+ Rules:
152
+ - Remove hedging words (typically, usually, might)
153
+ - Convert passive to active voice
154
+ - Replace explanations with imperatives
155
+ - Use MUST/NEVER for non-negotiable steps
156
+ ```
157
+
158
+ ### Clarification Techniques
159
+
160
+ ```
161
+ BEFORE (vague):
162
+ ───────────────
163
+ "Check that the configuration is correct."
164
+
165
+ AFTER (specific):
166
+ ─────────────────
167
+ "Verify config:
168
+ 1. Run: `npm run config:check`
169
+ 2. Confirm output shows: 'Configuration valid'
170
+ 3. If errors, check [specific file] for [specific issue]"
171
+
172
+ Rules:
173
+ - Replace "check" with specific verification command
174
+ - Include expected output
175
+ - Add troubleshooting for failures
176
+ ```
177
+
178
+ ### Hardening Techniques
179
+
180
+ ```
181
+ BEFORE (soft):
182
+ ──────────────
183
+ "You should generally avoid committing directly to main."
184
+
185
+ AFTER (hardened):
186
+ ─────────────────
187
+ "NEVER commit directly to main. ALWAYS use feature branches.
188
+
189
+ If tempted to commit to main because 'it's just a small fix':
190
+ - STOP
191
+ - Create branch anyway: git checkout -b fix/small-fix
192
+ - This is NOT optional"
193
+
194
+ Rules:
195
+ - Add MUST/NEVER to critical rules
196
+ - Anticipate rationalizations
197
+ - Explicitly reject common excuses
198
+ - Name the anti-pattern
199
+ ```
200
+
201
+ ### Expansion Techniques
202
+
203
+ ```
204
+ BEFORE (incomplete):
205
+ ────────────────────
206
+ "Handle errors appropriately."
207
+
208
+ AFTER (comprehensive):
209
+ ──────────────────────
210
+ "Error Handling:
211
+
212
+ Network Errors:
213
+ - Retry 2x with exponential backoff
214
+ - If still failing, log and surface to user
215
+
216
+ Validation Errors:
217
+ - Display specific field errors
218
+ - Do NOT proceed with invalid data
219
+
220
+ Permission Errors:
221
+ - Log with full context
222
+ - Display user-friendly message
223
+ - Do NOT expose internal details"
224
+
225
+ Rules:
226
+ - List specific error categories
227
+ - Provide handling for each
228
+ - Include what NOT to do
229
+ ```
230
+
231
+ ## Phase 5: Test Optimizations
232
+
233
+ ### Before/After Comparison
234
+
235
+ ```typescript
236
+ // Test with original skill
237
+ task({
238
+ subagent_type: "build",
239
+ description: "Test original skill",
240
+ prompt: `
241
+ Load skill: skill({ name: "$ARGUMENTS" })
242
+
243
+ Scenario: [test scenario]
244
+
245
+ Follow the skill and report each step.
246
+ `,
247
+ });
248
+
249
+ // Test with optimized skill (after saving changes)
250
+ task({
251
+ subagent_type: "build",
252
+ description: "Test optimized skill",
253
+ prompt: `
254
+ Load skill: skill({ name: "$ARGUMENTS" })
255
+
256
+ Scenario: [same test scenario]
257
+
258
+ Follow the skill and report each step.
259
+ `,
260
+ });
261
+ ```
262
+
263
+ ### Compare Results
264
+
265
+ ```
266
+ TEST COMPARISON
267
+ ━━━━━━━━━━━━━━━
268
+
269
+ Original Optimized
270
+ ────────────────────────────────────────────
271
+ Completed correctly 70% 95%
272
+ Steps followed 8/10 10/10
273
+ Rationalizations 3 0
274
+ Verification done Partial Full
275
+ Token usage 12,000 8,000
276
+
277
+ Improvement: ✓ Significant
278
+ ```
279
+
280
+ ## Phase 6: Validate Anti-Rationalization
281
+
282
+ ### Intentional Pressure Test
283
+
284
+ ```typescript
285
+ task({
286
+ subagent_type: "build",
287
+ description: "Pressure test skill",
288
+ prompt: `
289
+ Load skill: skill({ name: "$ARGUMENTS" })
290
+
291
+ Scenario: [test scenario]
292
+
293
+ IMPORTANT: You are under time pressure. Try to complete
294
+ this as quickly as possible. Some steps may seem
295
+ unnecessary - use your judgment on what to skip.
296
+
297
+ Report what you did.
298
+ `,
299
+ });
300
+ ```
301
+
302
+ **If agent skips steps:** Skill needs hardening at those points.
303
+
304
+ ### Edge Case Test
305
+
306
+ ```typescript
307
+ task({
308
+ subagent_type: "build",
309
+ description: "Edge case test",
310
+ prompt: `
311
+ Load skill: skill({ name: "$ARGUMENTS" })
312
+
313
+ Scenario: [unusual edge case]
314
+
315
+ Follow the skill. If the skill doesn't cover this case,
316
+ note what guidance was missing.
317
+ `,
318
+ });
319
+ ```
320
+
321
+ ## Phase 7: Document Changes
322
+
323
+ ### Create Changelog
324
+
325
+ ```markdown
326
+ # $ARGUMENTS Optimization Changelog
327
+
328
+ ## Version [X.Y] - [Date]
329
+
330
+ ### Changed
331
+
332
+ - Compressed phase 2 instructions (saved ~2000 tokens)
333
+ - Added specific verification commands to phase 3
334
+ - Hardened commit rules with explicit anti-patterns
335
+
336
+ ### Added
337
+
338
+ - Error handling section for network failures
339
+ - Edge case: handling empty input
340
+ - Troubleshooting: common TypeScript errors
341
+
342
+ ### Removed
343
+
344
+ - Redundant explanations in phase 1
345
+ - Duplicate verification steps
346
+
347
+ ### Metrics
348
+
349
+ - Token count: 12,000 → 8,500 (-29%)
350
+ - Test pass rate: 70% → 95%
351
+ - Rationalization incidents: 3 → 0
352
+ ```
353
+
354
+ ## Phase 8: Apply and Verify
355
+
356
+ ### Save Changes
357
+
358
+ ```typescript
359
+ write({
360
+ filePath: ".opencode/skill/$ARGUMENTS/SKILL.md",
361
+ content: optimizedSkillContent,
362
+ });
363
+
364
+ write({
365
+ filePath: ".opencode/skill/$ARGUMENTS/instructions.md",
366
+ content: optimizedInstructionsContent,
367
+ });
368
+ ```
369
+
370
+ ### Final Verification
371
+
372
+ ```typescript
373
+ // Reload and verify
374
+ skill({ name: "$ARGUMENTS" });
375
+ ```
376
+
377
+ Confirm:
378
+
379
+ - [ ] Skill loads without error
380
+ - [ ] Instructions display correctly
381
+ - [ ] Token count reduced (if compression goal)
382
+ - [ ] Test scenarios pass
383
+ - [ ] Anti-rationalization test passes
384
+
385
+ ## Quick Optimization Modes
386
+
387
+ ### Compress Mode (--compress)
388
+
389
+ Focus only on reducing token count:
390
+
391
+ ```bash
392
+ /skill-optimize my-skill --compress
393
+ ```
394
+
395
+ Targets:
396
+
397
+ - Remove redundant explanations
398
+ - Consolidate duplicate steps
399
+ - Shorten verbose instructions
400
+ - Goal: 30% token reduction
401
+
402
+ ### Audit Mode (--audit)
403
+
404
+ Only analyze, don't modify:
405
+
406
+ ```bash
407
+ /skill-optimize my-skill --audit
408
+ ```
409
+
410
+ Produces audit report without changes.
411
+
412
+ ### Test Mode (--test)
413
+
414
+ Run full test suite against skill:
415
+
416
+ ```bash
417
+ /skill-optimize my-skill --test
418
+ ```
419
+
420
+ Runs baseline and skill tests, reports effectiveness.
421
+
422
+ ## Optimization Patterns
423
+
424
+ ### Pattern: Guard Clauses
425
+
426
+ ```
427
+ BEFORE:
428
+ "If the input is valid, proceed with processing.
429
+ Otherwise, return an error."
430
+
431
+ AFTER:
432
+ "GUARD: Check input validity first
433
+ - If invalid: return error immediately
434
+ - If valid: continue to processing
435
+
436
+ DO NOT proceed with invalid input under any circumstances."
437
+ ```
438
+
439
+ ### Pattern: Named Anti-Patterns
440
+
441
+ ```
442
+ BEFORE:
443
+ "Don't skip the tests."
444
+
445
+ AFTER:
446
+ "❌ ANTI-PATTERN: 'YOLO Deploy'
447
+ Skipping tests because 'it's a small change' or 'I tested manually'
448
+
449
+ This ALWAYS leads to production bugs. NO EXCEPTIONS.
450
+ Run the full test suite even for one-line changes."
451
+ ```
452
+
453
+ ### Pattern: Verification Gates
454
+
455
+ ```
456
+ BEFORE:
457
+ "Make sure the build passes."
458
+
459
+ AFTER:
460
+ "GATE: Build Verification
461
+ Run: npm run build
462
+ Expected: 'Build completed successfully'
463
+
464
+ ⛔ DO NOT PROCEED if:
465
+ - Build fails
466
+ - Warnings about missing dependencies
467
+ - TypeScript errors (even if build 'succeeds')
468
+
469
+ If gate fails, fix issues before continuing."
470
+ ```
471
+
472
+ ## Output
473
+
474
+ ```
475
+ SKILL OPTIMIZED: $ARGUMENTS
476
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━
477
+
478
+ Changes Applied:
479
+ ✓ Compressed phase 2 (saved 2,100 tokens)
480
+ ✓ Added 3 verification gates
481
+ ✓ Hardened 2 critical rules
482
+ ✓ Added 4 anti-patterns
483
+
484
+ Metrics:
485
+ Before After Change
486
+ ──────────────────────────────────────
487
+ 12,000 tokens 8,500 tokens -29%
488
+ 70% pass rate 95% pass rate +36%
489
+ 3 rationalizations 0 -100%
490
+
491
+ Files Modified:
492
+ .opencode/skill/$ARGUMENTS/SKILL.md
493
+ .opencode/skill/$ARGUMENTS/instructions.md
494
+
495
+ Next Steps:
496
+ - Run additional edge case tests
497
+ - Consider sharing upstream: skill({ name: "sharing-skills" })
498
+ - Monitor for new failure modes in production use
499
+ ```