opencodekit 0.9.2 → 0.11.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 (62) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENTS.md +116 -47
  3. package/dist/template/.opencode/agent/build.md +16 -48
  4. package/dist/template/.opencode/agent/explore.md +13 -34
  5. package/dist/template/.opencode/agent/planner.md +41 -11
  6. package/dist/template/.opencode/agent/review.md +2 -23
  7. package/dist/template/.opencode/agent/rush.md +24 -65
  8. package/dist/template/.opencode/agent/scout.md +5 -21
  9. package/dist/template/.opencode/agent/vision.md +0 -14
  10. package/dist/template/.opencode/command/accessibility-check.md +293 -30
  11. package/dist/template/.opencode/command/analyze-mockup.md +406 -20
  12. package/dist/template/.opencode/command/analyze-project.md +439 -30
  13. package/dist/template/.opencode/command/brainstorm.md +288 -5
  14. package/dist/template/.opencode/command/commit.md +226 -17
  15. package/dist/template/.opencode/command/create.md +138 -35
  16. package/dist/template/.opencode/command/design-audit.md +477 -29
  17. package/dist/template/.opencode/command/design.md +609 -6
  18. package/dist/template/.opencode/command/edit-image.md +223 -20
  19. package/dist/template/.opencode/command/finish.md +162 -71
  20. package/dist/template/.opencode/command/fix-ci.md +296 -24
  21. package/dist/template/.opencode/command/fix-types.md +345 -13
  22. package/dist/template/.opencode/command/fix-ui.md +293 -13
  23. package/dist/template/.opencode/command/fix.md +256 -9
  24. package/dist/template/.opencode/command/generate-diagram.md +327 -26
  25. package/dist/template/.opencode/command/generate-icon.md +266 -22
  26. package/dist/template/.opencode/command/generate-image.md +232 -12
  27. package/dist/template/.opencode/command/generate-pattern.md +234 -20
  28. package/dist/template/.opencode/command/generate-storyboard.md +231 -21
  29. package/dist/template/.opencode/command/handoff.md +202 -30
  30. package/dist/template/.opencode/command/implement.md +162 -50
  31. package/dist/template/.opencode/command/import-plan.md +247 -51
  32. package/dist/template/.opencode/command/init.md +154 -35
  33. package/dist/template/.opencode/command/integration-test.md +405 -24
  34. package/dist/template/.opencode/command/issue.md +171 -21
  35. package/dist/template/.opencode/command/new-feature.md +382 -54
  36. package/dist/template/.opencode/command/plan.md +144 -118
  37. package/dist/template/.opencode/command/pr.md +229 -28
  38. package/dist/template/.opencode/command/quick-build.md +234 -5
  39. package/dist/template/.opencode/command/research-and-implement.md +436 -12
  40. package/dist/template/.opencode/command/research-ui.md +444 -34
  41. package/dist/template/.opencode/command/research.md +173 -45
  42. package/dist/template/.opencode/command/restore-image.md +416 -22
  43. package/dist/template/.opencode/command/resume.md +439 -63
  44. package/dist/template/.opencode/command/revert-feature.md +341 -64
  45. package/dist/template/.opencode/command/review-codebase.md +193 -4
  46. package/dist/template/.opencode/command/skill-create.md +506 -14
  47. package/dist/template/.opencode/command/skill-optimize.md +487 -16
  48. package/dist/template/.opencode/command/status.md +320 -60
  49. package/dist/template/.opencode/command/summarize.md +374 -33
  50. package/dist/template/.opencode/command/triage.md +355 -0
  51. package/dist/template/.opencode/command/ui-review.md +292 -25
  52. package/dist/template/.opencode/plugin/README.md +110 -98
  53. package/dist/template/.opencode/plugin/compactor.ts +95 -171
  54. package/dist/template/.opencode/plugin/enforcer.ts +177 -127
  55. package/dist/template/.opencode/plugin/injector.ts +150 -0
  56. package/dist/template/.opencode/plugin/lib/notify.ts +86 -0
  57. package/dist/template/.opencode/plugin/notification.ts +57 -123
  58. package/dist/template/.opencode/plugin/truncator.ts +60 -166
  59. package/dist/template/.opencode/skill/mqdh/SKILL.md +161 -0
  60. package/dist/template/.opencode/skill/playwriter/SKILL.md +148 -0
  61. package/dist/template/.opencode/skill/v0/SKILL.md +154 -0
  62. package/package.json +1 -1
@@ -1,29 +1,521 @@
1
1
  ---
2
- description: Create custom skills for agents
3
- argument-hint: "[skill-name]"
2
+ description: Create custom skills for agents using TDD-driven approach
3
+ argument-hint: "<skill-name> [--from-observation] [--template=<type>]"
4
4
  agent: build
5
5
  ---
6
6
 
7
7
  # Create Skill: $ARGUMENTS
8
8
 
9
- Use `skill({ name: "writing-skills" })` to create a new skill.
9
+ Create a new reusable skill that agents can load to handle specific scenarios.
10
10
 
11
- ## Workflow
11
+ ## What is a Skill?
12
12
 
13
- 1. **Load skill** - `skill({ name: "writing-skills" })`
14
- 2. **Follow by TDD process** - Test with subagents before writing
15
- 3. **Save to** `.opencode/skill/$ARGUMENTS/`
13
+ Skills are process instructions that:
16
14
 
17
- ## Skill Structure
15
+ - Guide agents through complex multi-step workflows
16
+ - Encode hard-won knowledge that prevents common mistakes
17
+ - Provide guardrails that resist agent rationalization
18
+ - Can be loaded on-demand when relevant scenarios arise
19
+
20
+ ## Prerequisites
21
+
22
+ Load the skill-writing skill first:
23
+
24
+ ```typescript
25
+ skill({ name: "writing-skills" });
26
+ ```
27
+
28
+ This provides the TDD framework for skill creation.
29
+
30
+ ## Phase 1: Define the Problem
31
+
32
+ ### Identify the Trigger
33
+
34
+ When should this skill be loaded? Define clear trigger conditions:
35
+
36
+ ```markdown
37
+ **Use this skill when:**
38
+
39
+ - [Specific scenario 1]
40
+ - [Specific scenario 2]
41
+ - [Observable condition]
42
+
43
+ **Do NOT use when:**
44
+
45
+ - [Exception 1]
46
+ - [Exception 2]
47
+ ```
48
+
49
+ ### Document the Pain Point
50
+
51
+ What goes wrong without this skill?
52
+
53
+ ```
54
+ PROBLEM STATEMENT
55
+ ━━━━━━━━━━━━━━━━━
56
+
57
+ Without guidance, agents typically:
58
+ 1. [Common mistake 1]
59
+ 2. [Common mistake 2]
60
+ 3. [Rationalization pattern]
61
+
62
+ This leads to:
63
+ - [Bad outcome 1]
64
+ - [Bad outcome 2]
65
+ - [Wasted effort]
66
+ ```
67
+
68
+ ### Define Success Criteria
69
+
70
+ What does correct behavior look like?
71
+
72
+ ```
73
+ SUCCESS CRITERIA
74
+ ━━━━━━━━━━━━━━━━
75
+
76
+ An agent following this skill will:
77
+ ✓ [Correct behavior 1]
78
+ ✓ [Correct behavior 2]
79
+ ✓ [Verification step]
80
+
81
+ Observable outputs:
82
+ - [Artifact 1]
83
+ - [Artifact 2]
84
+ ```
85
+
86
+ ## Phase 2: Design the Skill Structure
87
+
88
+ ### Skill Anatomy
18
89
 
19
90
  ```
20
91
  .opencode/skill/$ARGUMENTS/
21
- ├── SKILL.md (Main skill definition)
22
- ├── instructions.md (Detailed instructions)
23
- └── tests/ (Test scenarios)
92
+ ├── SKILL.md # Main skill file (loaded by skill tool)
93
+ ├── instructions.md # Detailed step-by-step instructions
94
+ ├── examples/ # Example scenarios
95
+ │ ├── good-example.md # What correct execution looks like
96
+ │ └── bad-example.md # What to avoid (anti-patterns)
97
+ └── tests/ # Test scenarios for validation
98
+ ├── scenario-1.md # Test case 1
99
+ └── scenario-2.md # Test case 2
100
+ ```
101
+
102
+ ### SKILL.md Template
103
+
104
+ ```markdown
105
+ ---
106
+ name: $ARGUMENTS
107
+ description: [One-line description]
108
+ trigger: [When to use this skill]
109
+ agent: build
110
+ mcp_servers: [] # Optional: MCP servers to connect
111
+ ---
112
+
113
+ # $ARGUMENTS
114
+
115
+ [Brief description of what this skill does and why it exists]
116
+
117
+ ## When to Use
118
+
119
+ Use this skill when:
120
+
121
+ - [Condition 1]
122
+ - [Condition 2]
123
+
124
+ Do NOT use when:
125
+
126
+ - [Exception 1]
127
+
128
+ ## Quick Start
129
+
130
+ [3-5 step summary of the core workflow]
131
+
132
+ ## Detailed Instructions
133
+
134
+ See: [instructions.md](./instructions.md)
135
+
136
+ ## Anti-Patterns
137
+
138
+ ❌ **[Bad Pattern Name]**
139
+ [Description of what NOT to do]
140
+
141
+ ❌ **[Another Bad Pattern]**
142
+ [Description]
143
+
144
+ ## Verification
145
+
146
+ Before completing, verify:
147
+
148
+ - [ ] [Checklist item 1]
149
+ - [ ] [Checklist item 2]
150
+ - [ ] [Checklist item 3]
151
+ ```
152
+
153
+ ### Instructions.md Template
154
+
155
+ ````markdown
156
+ # $ARGUMENTS: Detailed Instructions
157
+
158
+ ## Phase 1: [Setup/Initialization]
159
+
160
+ ### Step 1.1: [Action]
161
+
162
+ [Detailed instructions]
163
+
164
+ ```typescript
165
+ // Code example if relevant
166
+ ```
167
+ ````
168
+
169
+ ### Step 1.2: [Action]
170
+
171
+ [Detailed instructions]
172
+
173
+ **Expected Output:**
174
+
175
+ ```
176
+ [What the agent should see]
177
+ ```
178
+
179
+ ## Phase 2: [Core Workflow]
180
+
181
+ ### Step 2.1: [Action]
182
+
183
+ [Instructions with rationale - WHY this step matters]
184
+
185
+ ⚠️ **Common Mistake:** [What agents often do wrong here]
186
+
187
+ ✅ **Correct Approach:** [What to do instead]
188
+
189
+ ### Step 2.2: [Action]
190
+
191
+ [Instructions]
192
+
193
+ ## Phase 3: [Verification]
194
+
195
+ ### Step 3.1: Verify Results
196
+
197
+ [How to confirm success]
198
+
199
+ ### Step 3.2: Clean Up
200
+
201
+ [Any cleanup steps]
202
+
203
+ ## Troubleshooting
204
+
205
+ ### [Common Issue 1]
206
+
207
+ **Symptom:** [What you observe]
208
+ **Cause:** [Why it happens]
209
+ **Solution:** [How to fix]
210
+
211
+ ### [Common Issue 2]
212
+
213
+ **Symptom:** [What you observe]
214
+ **Cause:** [Why it happens]
215
+ **Solution:** [How to fix]
216
+
217
+ ````
218
+
219
+ ## Phase 3: Write Tests First (TDD)
220
+
221
+ ### Create Test Scenario
222
+
223
+ ```markdown
224
+ # Test: $ARGUMENTS - [Scenario Name]
225
+
226
+ ## Setup
227
+ [Initial state before skill execution]
228
+
229
+ ## Input
230
+ [What triggers the skill]
231
+
232
+ ## Expected Behavior
233
+ 1. Agent should [action 1]
234
+ 2. Agent should [action 2]
235
+ 3. Agent should NOT [anti-pattern]
236
+
237
+ ## Expected Output
238
+ [Artifacts or changes]
239
+
240
+ ## Verification
241
+ [How to confirm correct behavior]
242
+ ````
243
+
244
+ ### Run Baseline Test (RED)
245
+
246
+ Test without the skill to confirm the problem exists:
247
+
248
+ ```typescript
249
+ task({
250
+ subagent_type: "build",
251
+ description: "Baseline test for skill",
252
+ prompt: `
253
+ [Scenario that triggers the skill need]
254
+
255
+ DO NOT load any skills. Just attempt the task naturally.
256
+
257
+ Report what you did and any issues encountered.
258
+ `,
259
+ });
260
+ ```
261
+
262
+ **Expected Result:** Agent makes the mistakes the skill prevents.
263
+
264
+ ## Phase 4: Write the Skill (GREEN)
265
+
266
+ ### Core Principles
267
+
268
+ 1. **Be Prescriptive, Not Descriptive**
269
+ - ❌ "Consider checking for errors"
270
+ - ✅ "MUST run `npm test` before proceeding. If tests fail, STOP."
271
+
272
+ 2. **Close Rationalization Loopholes**
273
+ - ❌ "Usually you should..."
274
+ - ✅ "ALWAYS do X. NO EXCEPTIONS."
275
+
276
+ 3. **Add Verification Gates**
277
+ - After each major step, require observable verification
278
+ - "Run [command] and confirm output contains [pattern]"
279
+
280
+ 4. **Include Anti-Patterns**
281
+ - Explicitly state what NOT to do
282
+ - Agents are more likely to avoid named anti-patterns
283
+
284
+ 5. **Provide Escape Hatches**
285
+ - Define what to do when skill doesn't apply
286
+ - "If [condition], exit this skill and [alternative]"
287
+
288
+ ### Write SKILL.md
289
+
290
+ Create the main skill file with:
291
+
292
+ - Clear trigger conditions
293
+ - Step-by-step workflow
294
+ - Verification checklist
295
+ - Anti-patterns section
296
+
297
+ ### Write instructions.md
298
+
299
+ Create detailed instructions with:
300
+
301
+ - Numbered phases and steps
302
+ - Code examples where helpful
303
+ - Common mistakes highlighted
304
+ - Troubleshooting section
305
+
306
+ ## Phase 5: Test the Skill (GREEN → PASSING)
307
+
308
+ ```typescript
309
+ task({
310
+ subagent_type: "build",
311
+ description: "Test skill execution",
312
+ prompt: `
313
+ Load the skill: skill({ name: "$ARGUMENTS" })
314
+
315
+ Then attempt this scenario:
316
+ [Same scenario as baseline]
317
+
318
+ Follow the skill instructions exactly.
319
+ Report each step you take and verification results.
320
+ `,
321
+ });
24
322
  ```
25
323
 
26
- ## After Creation
324
+ **Expected Result:** Agent follows skill correctly, avoids mistakes.
325
+
326
+ ## Phase 6: Iterate (REFACTOR)
327
+
328
+ ### Identify Gaps
329
+
330
+ Review test results for:
331
+
332
+ - Steps that were unclear
333
+ - Rationalizations that slipped through
334
+ - Missing edge cases
335
+ - Overly verbose instructions
336
+
337
+ ### Tighten the Skill
338
+
339
+ ```
340
+ COMMON REFINEMENTS
341
+ ━━━━━━━━━━━━━━━━━━
342
+
343
+ 1. Add MUST/NEVER language where agents deviated
344
+ 2. Remove ambiguous "usually" or "typically" phrases
345
+ 3. Add specific commands instead of "check that..."
346
+ 4. Include exact error messages to look for
347
+ 5. Add more anti-patterns based on observed failures
348
+ ```
349
+
350
+ ### Re-Test
351
+
352
+ Run test scenarios again until skill guides behavior correctly.
353
+
354
+ ## Phase 7: Document Examples
355
+
356
+ ### Good Example
357
+
358
+ ```markdown
359
+ # Example: $ARGUMENTS - Correct Execution
360
+
361
+ ## Scenario
362
+
363
+ [What triggered the skill]
364
+
365
+ ## Execution Trace
366
+
367
+ 1. Loaded skill
368
+ 2. Checked [precondition] ✓
369
+ 3. Ran [step 1]
370
+ Output: [what was observed]
371
+ 4. Ran [step 2]
372
+ Output: [what was observed]
373
+ 5. Verified [condition] ✓
374
+
375
+ ## Result
376
+
377
+ [Successful outcome]
378
+ ```
379
+
380
+ ### Bad Example
381
+
382
+ ```markdown
383
+ # Anti-Example: $ARGUMENTS - What NOT to Do
384
+
385
+ ## Scenario
386
+
387
+ [Same trigger]
388
+
389
+ ## What Went Wrong
390
+
391
+ ❌ Skipped step 2 because "it seemed unnecessary"
392
+ ❌ Didn't verify before proceeding
393
+ ❌ Assumed X instead of checking
394
+
395
+ ## Consequence
27
396
 
28
- - Test with `skill({ name: "testing-skills-with-subagents" })`
29
- - Share upstream with `skill({ name: "sharing-skills" })`
397
+ [What broke]
398
+
399
+ ## Lesson
400
+
401
+ [Why the skill step matters]
402
+ ```
403
+
404
+ ## Phase 8: Finalize and Register
405
+
406
+ ### File Structure Check
407
+
408
+ ```bash
409
+ ls -la .opencode/skill/$ARGUMENTS/
410
+ ```
411
+
412
+ Expected:
413
+
414
+ ```
415
+ SKILL.md
416
+ instructions.md
417
+ examples/
418
+ good-example.md
419
+ bad-example.md
420
+ tests/
421
+ scenario-1.md
422
+ ```
423
+
424
+ ### Test Loading
425
+
426
+ ```typescript
427
+ skill({ name: "$ARGUMENTS" });
428
+ ```
429
+
430
+ Verify:
431
+
432
+ - Skill loads without error
433
+ - Instructions are clear when displayed
434
+ - Agent can follow the workflow
435
+
436
+ ## Optional: Share Upstream
437
+
438
+ If this skill is generally useful:
439
+
440
+ ```typescript
441
+ skill({ name: "sharing-skills" });
442
+ ```
443
+
444
+ This guides contributing the skill back to the skills repository.
445
+
446
+ ## Templates
447
+
448
+ ### Quick Templates
449
+
450
+ ```bash
451
+ /skill-create debugging --template=debugging
452
+ /skill-create deployment --template=deployment
453
+ /skill-create code-review --template=review
454
+ /skill-create migration --template=migration
455
+ ```
456
+
457
+ ### Template Types
458
+
459
+ | Template | Best For |
460
+ | ------------- | ---------------------------- |
461
+ | `debugging` | Root cause analysis skills |
462
+ | `deployment` | Release and deploy workflows |
463
+ | `review` | Code review checklists |
464
+ | `migration` | Data or schema migrations |
465
+ | `security` | Security audit workflows |
466
+ | `testing` | Test creation patterns |
467
+ | `refactoring` | Safe refactoring steps |
468
+
469
+ ## From Observation
470
+
471
+ If creating from an existing observation:
472
+
473
+ ```bash
474
+ /skill-create my-skill --from-observation
475
+ ```
476
+
477
+ This will:
478
+
479
+ 1. Search observations for patterns
480
+ 2. Extract relevant learnings
481
+ 3. Pre-populate skill with discovered knowledge
482
+
483
+ ```typescript
484
+ memory_search({ query: "$ARGUMENTS", type: "observations" });
485
+ ```
486
+
487
+ ## Success Criteria
488
+
489
+ The skill is ready when:
490
+
491
+ - [ ] Baseline test (no skill) shows the problem
492
+ - [ ] Skill test shows correct behavior
493
+ - [ ] Instructions are unambiguous
494
+ - [ ] Anti-patterns are documented
495
+ - [ ] At least one good and one bad example
496
+ - [ ] Loads without error via `skill()` tool
497
+ - [ ] Verified by independent subagent test
498
+
499
+ ## Output
500
+
501
+ ```
502
+ SKILL CREATED: $ARGUMENTS
503
+ ━━━━━━━━━━━━━━━━━━━━━━━━━
504
+
505
+ Location: .opencode/skill/$ARGUMENTS/
506
+
507
+ Files:
508
+ ✓ SKILL.md (main definition)
509
+ ✓ instructions.md (detailed steps)
510
+ ✓ examples/good-example.md
511
+ ✓ examples/bad-example.md
512
+ ✓ tests/scenario-1.md
513
+
514
+ Usage:
515
+ skill({ name: "$ARGUMENTS" })
516
+
517
+ Next Steps:
518
+ - Test with more scenarios
519
+ - Share upstream: skill({ name: "sharing-skills" })
520
+ - Add to relevant command files
521
+ ```