@fakhrulraharjo/opencode-skill-creator 0.3.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.
- package/README.md +343 -0
- package/bin/opencode-skill-creator.js +338 -0
- package/dist/build-manifest.json +6 -0
- package/dist/package.json +62 -0
- package/dist/skill/SKILL.md +481 -0
- package/dist/skill/agents/analyzer.md +274 -0
- package/dist/skill/agents/comparator.md +202 -0
- package/dist/skill/agents/grader.md +223 -0
- package/dist/skill/references/schemas.md +430 -0
- package/dist/skill/templates/eval-review.html +146 -0
- package/dist/skill-creator.js +15318 -0
- package/dist/templates/viewer.html +1325 -0
- package/package.json +62 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fakhrulraharjo/opencode-skill-creator",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "OpenCode plugin for skill creation with oh-my-openagent compatibility — custom tools for validation, evaluation, description optimization, benchmarking, and review serving. Fork of opencode-skill-creator with detectionMode='auto' support for routing agents (Sisyphus/hephaestus/prometheus).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/skill-creator.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"opencode-skill-creator": "./bin/opencode-skill-creator.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "node ./scripts/build.mjs",
|
|
12
|
+
"test": "node --test test/*.test.mjs",
|
|
13
|
+
"test:ts": "for f in test/*.test.ts; do bun test --isolate \"$f\" || exit 1; done",
|
|
14
|
+
"prepack": "npm run build && npm test && npm run test:ts"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"jsonc-parser": "^3.3.1"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"README.md",
|
|
21
|
+
"bin/",
|
|
22
|
+
"dist/"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"opencode",
|
|
26
|
+
"opencode-plugin",
|
|
27
|
+
"skill-creator",
|
|
28
|
+
"ai-skills",
|
|
29
|
+
"agent-skills",
|
|
30
|
+
"eval",
|
|
31
|
+
"benchmark",
|
|
32
|
+
"description-optimization",
|
|
33
|
+
"skill-evaluation",
|
|
34
|
+
"llm",
|
|
35
|
+
"ai-agent",
|
|
36
|
+
"open-source",
|
|
37
|
+
"typescript"
|
|
38
|
+
],
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/fakhrulraharjo/opencode-skill-creator.git",
|
|
42
|
+
"directory": "plugin"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/fakhrulraharjo/opencode-skill-creator#readme",
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/fakhrulraharjo/opencode-skill-creator/issues"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=18"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"license": "Apache-2.0",
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@opencode-ai/plugin": ">=1.0.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@opencode-ai/plugin": "^1.0.0",
|
|
60
|
+
"@types/bun": "latest"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: opencode-skill-creator
|
|
3
|
+
description: Create, test, evaluate, optimize, and package OpenCode skills with the opencode-skill-creator plugin. Use when users explicitly mention opencode-skill-creator, OpenCode Skill Creator, creating an OpenCode skill, editing an OpenCode SKILL.md, running skill evals, benchmarking skill performance, or optimizing an OpenCode skill description. Do not use for generic Claude Code or Superpowers skill creation unless the user asks to port that workflow to OpenCode.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OpenCode Skill Creator
|
|
7
|
+
|
|
8
|
+
A skill for creating new skills and iteratively improving them.
|
|
9
|
+
|
|
10
|
+
At a high level, the process of creating a skill goes like this:
|
|
11
|
+
|
|
12
|
+
- Decide what you want the skill to do and roughly how it should do it
|
|
13
|
+
- Write a draft of the skill
|
|
14
|
+
- Create a few test prompts and run opencode-with-access-to-the-skill on them
|
|
15
|
+
- Help the user evaluate the results both qualitatively and quantitatively
|
|
16
|
+
- While the runs happen in the background, draft some quantitative evals if there aren't any (if there are some, you can either use as is or modify if you feel something needs to change about them). Then explain them to the user (or if they already existed, explain the ones that already exist)
|
|
17
|
+
- Use the `skill_serve_review` tool to show the user the results for them to look at, and also let them look at the quantitative metrics
|
|
18
|
+
- Rewrite the skill based on feedback from the user's evaluation of the results (and also if there are any glaring flaws that become apparent from the quantitative benchmarks)
|
|
19
|
+
- Repeat until you're satisfied
|
|
20
|
+
- Expand the test set and try again at larger scale
|
|
21
|
+
|
|
22
|
+
Your job when using this skill is to figure out where the user is in this process and then jump in and help them progress through these stages. So for instance, maybe they're like "I want to make a skill for X". You can help narrow down what they mean, write a draft, write the test cases, figure out how they want to evaluate, run all the prompts, and repeat.
|
|
23
|
+
|
|
24
|
+
On the other hand, maybe they already have a draft of the skill. In this case you can go straight to the eval/iterate part of the loop.
|
|
25
|
+
|
|
26
|
+
For new skill creation, the intake interview is mandatory. Ask at least 3-5 targeted questions before drafting anything (ask more if the workflow is complex). Treat this as shadowing a teammate: the user is the domain expert and existing employee, and the agent is the new hire that must learn and mirror the real workflow.
|
|
27
|
+
|
|
28
|
+
You can still be flexible about eval depth and iteration speed after intake. If the user asks to skip intake, warn once that skill quality and workflow match will be worse, get explicit confirmation, and then proceed with best effort.
|
|
29
|
+
|
|
30
|
+
Then after the skill is done (but again, the order is flexible), you can also run the skill description optimizer (`skill_optimize_loop` tool), which we have a whole separate tool for, to optimize the triggering of the skill.
|
|
31
|
+
|
|
32
|
+
Cool? Cool.
|
|
33
|
+
|
|
34
|
+
## Communicating with the user
|
|
35
|
+
|
|
36
|
+
The skill creator is liable to be used by people across a wide range of familiarity with coding jargon. If you haven't heard (and how could you, it's only very recently that it started), there's a trend now where the power of AI coding agents is inspiring plumbers to open up their terminals, parents and grandparents to google "how to install npm". On the other hand, the bulk of users are probably fairly computer-literate.
|
|
37
|
+
|
|
38
|
+
So please pay attention to context cues to understand how to phrase your communication! In the default case, just to give you some idea:
|
|
39
|
+
|
|
40
|
+
- "evaluation" and "benchmark" are borderline, but OK
|
|
41
|
+
- for "JSON" and "assertion" you want to see serious cues from the user that they know what those things are before using them without explaining them
|
|
42
|
+
|
|
43
|
+
It's OK to briefly explain terms if you're in doubt, and feel free to clarify terms with a short definition if you're unsure if the user will get it.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Creating a skill
|
|
48
|
+
|
|
49
|
+
### Capture Intent (Required Gate for New Skills)
|
|
50
|
+
|
|
51
|
+
For new skills, this step is mandatory and cannot be skipped. Do not draft SKILL.md, evals, or other files until this interview is complete and the user confirms your summary.
|
|
52
|
+
|
|
53
|
+
Start by understanding the user's intent. The current conversation might already contain part of the workflow the user wants to capture (e.g., they say "turn this into a skill"). Extract that first: tools used, sequence of steps, corrections, inputs/outputs, and success criteria. Then fill the gaps with questions.
|
|
54
|
+
|
|
55
|
+
Ask at least 3-5 targeted questions (more when needed). Cover these minimum areas:
|
|
56
|
+
|
|
57
|
+
1. What should this skill enable OpenCode to do end-to-end?
|
|
58
|
+
2. When should this skill trigger? (phrases, contexts, near-misses)
|
|
59
|
+
3. What output format and quality bar are expected?
|
|
60
|
+
4. What workflow steps must be preserved exactly vs. where can the agent improvise?
|
|
61
|
+
5. Should we set up test cases to verify behavior? Skills with objectively verifiable outputs (file transforms, data extraction, code generation, fixed workflow steps) benefit from test cases. Skills with subjective outputs (writing style, art) often don't need them. Suggest the appropriate default based on skill type, then let the user decide.
|
|
62
|
+
|
|
63
|
+
Before moving on, summarize your understanding in plain language and ask the user to confirm or correct it.
|
|
64
|
+
|
|
65
|
+
If the user explicitly asks to skip intake, warn that final quality and workflow fit will likely be worse. Proceed only after explicit confirmation.
|
|
66
|
+
|
|
67
|
+
### Interview and Research
|
|
68
|
+
|
|
69
|
+
Proactively ask questions about edge cases, input/output formats, example files, success criteria, and dependencies. Use a buddy/shadowing stance: mirror the user's real workflow, terminology, handoffs, and decision points. Wait to write test prompts until you've got this part ironed out.
|
|
70
|
+
|
|
71
|
+
Check available MCPs — if useful for research (searching docs, finding similar skills, looking up best practices), research in parallel via the Task tool (using `general` or `explore` subagent types) if available, otherwise inline. Come prepared with context to reduce burden on the user.
|
|
72
|
+
|
|
73
|
+
### Write the SKILL.md
|
|
74
|
+
|
|
75
|
+
For new skills, default to a staging location instead of the current repo/worktree. Use the system temp directory unless the user explicitly requests another path (for example: Unix/macOS `/tmp/opencode-skills/<skill-name>/`, `$TMPDIR/opencode-skills/<skill-name>/`; Windows `%TEMP%\\opencode-skills\\<skill-name>\\`). This avoids cluttering unrelated repositories during skill development.
|
|
76
|
+
|
|
77
|
+
Based on the user interview, fill in these components:
|
|
78
|
+
|
|
79
|
+
- **name**: Skill identifier (kebab-case, 1–64 chars, regex `^[a-z0-9]+(-[a-z0-9]+)*$`)
|
|
80
|
+
- **description**: When to trigger, what it does. This is the primary triggering mechanism — include both what the skill does AND specific contexts for when to use it. All "when to use" info goes here, not in the body. Note: currently OpenCode has a tendency to "undertrigger" skills — to not use them when they'd be useful. To combat this, please make the skill descriptions a little bit "pushy". So for instance, instead of "How to build a simple fast dashboard to display internal data.", you might write "How to build a simple fast dashboard to display internal data. Make sure to use this skill whenever the user mentions dashboards, data visualization, internal metrics, or wants to display any kind of company data, even if they don't explicitly ask for a 'dashboard.'"
|
|
81
|
+
- **compatibility**: Required tools, dependencies (optional, rarely needed)
|
|
82
|
+
- **the rest of the skill :)**
|
|
83
|
+
|
|
84
|
+
### Skill Writing Guide
|
|
85
|
+
|
|
86
|
+
#### Anatomy of a Skill
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
skill-name/
|
|
90
|
+
├── SKILL.md (required)
|
|
91
|
+
│ ├── YAML frontmatter (name, description required)
|
|
92
|
+
│ └── Markdown instructions
|
|
93
|
+
└── Bundled Resources (optional)
|
|
94
|
+
├── scripts/ - Executable code for deterministic/repetitive tasks
|
|
95
|
+
├── references/ - Docs loaded into context as needed
|
|
96
|
+
└── assets/ - Files used in output (templates, icons, fonts)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The skill directory name must match the `name` field in the frontmatter.
|
|
100
|
+
|
|
101
|
+
#### Progressive Disclosure
|
|
102
|
+
|
|
103
|
+
Skills use a three-level loading system:
|
|
104
|
+
1. **Metadata** (name + description) — Always in context (~100 words)
|
|
105
|
+
2. **SKILL.md body** — In context whenever skill triggers (<500 lines ideal)
|
|
106
|
+
3. **Bundled resources** — As needed (unlimited, scripts can execute without loading)
|
|
107
|
+
|
|
108
|
+
These word counts are approximate and you can feel free to go longer if needed.
|
|
109
|
+
|
|
110
|
+
**Key patterns:**
|
|
111
|
+
- Keep SKILL.md under 500 lines; if you're approaching this limit, add an additional layer of hierarchy along with clear pointers about where the model using the skill should go next to follow up.
|
|
112
|
+
- Reference files clearly from SKILL.md with guidance on when to read them
|
|
113
|
+
- For large reference files (>300 lines), include a table of contents
|
|
114
|
+
|
|
115
|
+
**Domain organization**: When a skill supports multiple domains/frameworks, organize by variant:
|
|
116
|
+
```
|
|
117
|
+
cloud-deploy/
|
|
118
|
+
├── SKILL.md (workflow + selection)
|
|
119
|
+
└── references/
|
|
120
|
+
├── aws.md
|
|
121
|
+
├── gcp.md
|
|
122
|
+
└── azure.md
|
|
123
|
+
```
|
|
124
|
+
OpenCode reads only the relevant reference file.
|
|
125
|
+
|
|
126
|
+
#### Principle of Lack of Surprise
|
|
127
|
+
|
|
128
|
+
This goes without saying, but skills must not contain malware, exploit code, or any content that could compromise system security. A skill's contents should not surprise the user in their intent if described. Don't go along with requests to create misleading skills or skills designed to facilitate unauthorized access, data exfiltration, or other malicious activities. Things like a "roleplay as an XYZ" are OK though.
|
|
129
|
+
|
|
130
|
+
#### Writing Patterns
|
|
131
|
+
|
|
132
|
+
Prefer using the imperative form in instructions.
|
|
133
|
+
|
|
134
|
+
**Defining output formats** — You can do it like this:
|
|
135
|
+
```markdown
|
|
136
|
+
## Report structure
|
|
137
|
+
ALWAYS use this exact template:
|
|
138
|
+
# [Title]
|
|
139
|
+
## Executive summary
|
|
140
|
+
## Key findings
|
|
141
|
+
## Recommendations
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Examples pattern** — It's useful to include examples. You can format them like this (but if "Input" and "Output" are in the examples you might want to deviate a little):
|
|
145
|
+
```markdown
|
|
146
|
+
## Commit message format
|
|
147
|
+
**Example 1:**
|
|
148
|
+
Input: Added user authentication with JWT tokens
|
|
149
|
+
Output: feat(auth): implement JWT-based authentication
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Writing Style
|
|
153
|
+
|
|
154
|
+
Try to explain to the model why things are important in lieu of heavy-handed musty MUSTs. Use theory of mind and try to make the skill general and not super-narrow to specific examples. Start by writing a draft and then look at it with fresh eyes and improve it.
|
|
155
|
+
|
|
156
|
+
### Test Cases
|
|
157
|
+
|
|
158
|
+
After writing the skill draft, come up with 2–3 realistic test prompts — the kind of thing a real user would actually say. Share them with the user: [you don't have to use this exact language] "Here are a few test cases I'd like to try. Do these look right, or do you want to add more?" Then run them.
|
|
159
|
+
|
|
160
|
+
Save test cases to `evals/evals.json`. Don't write assertions yet — just the prompts. You'll draft assertions in the next step while the runs are in progress.
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"skill_name": "example-skill",
|
|
165
|
+
"evals": [
|
|
166
|
+
{
|
|
167
|
+
"id": 1,
|
|
168
|
+
"prompt": "User's task prompt",
|
|
169
|
+
"expected_output": "Description of expected result",
|
|
170
|
+
"files": []
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
See `references/schemas.md` for the full schema (including the `assertions` field, which you'll add later).
|
|
177
|
+
|
|
178
|
+
## Running and evaluating test cases
|
|
179
|
+
|
|
180
|
+
This section is one continuous sequence — don't stop partway through. Do NOT use `/skill-test` or any other testing skill.
|
|
181
|
+
|
|
182
|
+
Put results in `<skill-name>-workspace/` next to the staged skill directory in the system temp area (for example: Unix/macOS `/tmp/opencode-skills/<skill-name>-workspace/`; Windows `%TEMP%\\opencode-skills\\<skill-name>-workspace\\`). Within the workspace, organize results by iteration (`iteration-1/`, `iteration-2/`, etc.) and within that, each test case gets a directory (`eval-0/`, `eval-1/`, etc.). Don't create all of this upfront — just create directories as you go.
|
|
183
|
+
|
|
184
|
+
### Step 1: Spawn all runs (with-skill AND baseline) in the same turn
|
|
185
|
+
|
|
186
|
+
For each test case, spawn two Task tool invocations (using `general` subagent type) in the same turn — one with the skill, one without. This is important: don't spawn the with-skill runs first and then come back for baselines later. Launch everything at once so it all finishes around the same time.
|
|
187
|
+
|
|
188
|
+
**With-skill run:**
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
Execute this task:
|
|
192
|
+
- Skill path: <path-to-skill>
|
|
193
|
+
- Task: <eval prompt>
|
|
194
|
+
- Input files: <eval files if any, or "none">
|
|
195
|
+
- Save outputs to: <workspace>/iteration-<N>/eval-<ID>/with_skill/outputs/
|
|
196
|
+
- Outputs to save: <what the user cares about — e.g., "the .docx file", "the final CSV">
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Baseline run** (same prompt, but the baseline depends on context):
|
|
200
|
+
- **Creating a new skill**: no skill at all. Same prompt, no skill path, save to `without_skill/outputs/`.
|
|
201
|
+
- **Improving an existing skill**: the old version. Before editing, snapshot the skill (`cp -r <skill-path> <workspace>/skill-snapshot/`), then point the baseline Task tool invocation at the snapshot. Save to `old_skill/outputs/`.
|
|
202
|
+
|
|
203
|
+
Write an `eval_metadata.json` for each test case (assertions can be empty for now). Give each eval a descriptive name based on what it's testing — not just "eval-0". Use this name for the directory too. If this iteration uses new or modified eval prompts, create these files for each new eval directory — don't assume they carry over from previous iterations.
|
|
204
|
+
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
"eval_id": 0,
|
|
208
|
+
"eval_name": "descriptive-name-here",
|
|
209
|
+
"prompt": "The user's task prompt",
|
|
210
|
+
"assertions": []
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Step 2: While runs are in progress, draft assertions
|
|
215
|
+
|
|
216
|
+
Don't just wait for the runs to finish — you can use this time productively. Draft quantitative assertions for each test case and explain them to the user. If assertions already exist in `evals/evals.json`, review them and explain what they check.
|
|
217
|
+
|
|
218
|
+
Good assertions are objectively verifiable and have descriptive names — they should read clearly in the benchmark viewer so someone glancing at the results immediately understands what each one checks. Subjective skills (writing style, design quality) are better evaluated qualitatively — don't force assertions onto things that need human judgment.
|
|
219
|
+
|
|
220
|
+
Update the `eval_metadata.json` files and `evals/evals.json` with the assertions once drafted. Also explain to the user what they'll see in the viewer — both the qualitative outputs and the quantitative benchmark.
|
|
221
|
+
|
|
222
|
+
### Step 3: As runs complete, capture timing data
|
|
223
|
+
|
|
224
|
+
When each Task tool invocation completes, you receive a notification containing `total_tokens` and `duration_ms`. Save this data immediately to `timing.json` in the run directory:
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"total_tokens": 84852,
|
|
229
|
+
"duration_ms": 23332,
|
|
230
|
+
"total_duration_seconds": 23.3
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
This is the only opportunity to capture this data — it comes through the task notification and isn't persisted elsewhere. Process each notification as it arrives rather than trying to batch them.
|
|
235
|
+
|
|
236
|
+
### Step 4: Grade, aggregate, and launch the viewer
|
|
237
|
+
|
|
238
|
+
Once all runs are done:
|
|
239
|
+
|
|
240
|
+
Before launching review, enforce this gate: every eval must have paired comparison outputs (`with_skill` plus one baseline: `without_skill` or `old_skill`). Do not continue to review if pairs are missing unless the user explicitly asks to proceed with partial data.
|
|
241
|
+
|
|
242
|
+
1. **Grade each run** — spawn a grader Task (using `general` subagent type), or grade inline, that reads `agents/grader.md` and evaluates each assertion against the outputs. Save results to `grading.json` in each run directory. The grading.json expectations array must use the fields `text`, `passed`, and `evidence` (not `name`/`met`/`details` or other variants) — the viewer depends on these exact field names. For assertions that can be checked programmatically, write and run a script rather than eyeballing it — scripts are faster, more reliable, and can be reused across iterations.
|
|
243
|
+
|
|
244
|
+
2. **Aggregate into benchmark** — use the `skill_aggregate_benchmark` tool:
|
|
245
|
+
```
|
|
246
|
+
Call skill_aggregate_benchmark with:
|
|
247
|
+
benchmarkDir: <workspace>/iteration-N
|
|
248
|
+
skillName: <name>
|
|
249
|
+
```
|
|
250
|
+
This produces `benchmark.json` and `benchmark.md` with pass_rate, time, and tokens for each configuration, with mean ± stddev and the delta. If generating benchmark.json manually, see `references/schemas.md` for the exact schema the viewer expects.
|
|
251
|
+
Put each with_skill version before its baseline counterpart.
|
|
252
|
+
|
|
253
|
+
3. **Do an analyst pass** — read the benchmark data and surface patterns the aggregate stats might hide. See `agents/analyzer.md` (the "Analyzing Benchmark Results" section) for what to look for — things like assertions that always pass regardless of skill (non-discriminating), high-variance evals (possibly flaky), and time/token tradeoffs.
|
|
254
|
+
|
|
255
|
+
4. **Launch the viewer** with both qualitative outputs and quantitative data using the `skill_serve_review` tool:
|
|
256
|
+
```
|
|
257
|
+
Call skill_serve_review with:
|
|
258
|
+
workspace: <workspace>/iteration-N
|
|
259
|
+
skillName: "my-skill"
|
|
260
|
+
benchmarkPath: <workspace>/iteration-N/benchmark.json
|
|
261
|
+
allowPartial: false
|
|
262
|
+
```
|
|
263
|
+
For iteration 2+, also pass `previousWorkspace: <workspace>/iteration-<N-1>`.
|
|
264
|
+
|
|
265
|
+
If `benchmarkPath` is omitted, the tool auto-generates `benchmark.json` and `benchmark.md` inside the workspace before opening the viewer.
|
|
266
|
+
|
|
267
|
+
The default is strict (`allowPartial: false`): it fails fast when eval pairs are incomplete. Use `allowPartial: true` only when the user explicitly accepts incomplete comparisons.
|
|
268
|
+
|
|
269
|
+
**Headless environments:** Use the `skill_export_static_review` tool to write a standalone HTML file instead of starting a server. Feedback will be downloaded as a `feedback.json` file when the user clicks "Submit All Reviews". After download, copy `feedback.json` into the workspace directory for the next iteration to pick up.
|
|
270
|
+
|
|
271
|
+
Note: please use the `skill_serve_review` or `skill_export_static_review` tools to create the viewer; there's no need to write custom HTML.
|
|
272
|
+
|
|
273
|
+
5. **Tell the user** something like: "I've opened the results in your browser. There are two tabs — 'Outputs' lets you click through each test case and leave feedback, 'Benchmark' shows the quantitative comparison. When you're done, come back here and let me know."
|
|
274
|
+
|
|
275
|
+
### What the user sees in the viewer
|
|
276
|
+
|
|
277
|
+
The "Outputs" tab shows one test case at a time:
|
|
278
|
+
- **Prompt**: the task that was given
|
|
279
|
+
- **Output**: the files the skill produced, rendered inline where possible
|
|
280
|
+
- **Previous Output** (iteration 2+): collapsed section showing last iteration's output
|
|
281
|
+
- **Formal Grades** (if grading was run): collapsed section showing assertion pass/fail
|
|
282
|
+
- **Feedback**: a textbox that auto-saves as they type
|
|
283
|
+
- **Previous Feedback** (iteration 2+): their comments from last time, shown below the textbox
|
|
284
|
+
|
|
285
|
+
The "Benchmark" tab shows the stats summary: pass rates, timing, and token usage for each configuration, with per-eval breakdowns and analyst observations.
|
|
286
|
+
|
|
287
|
+
Navigation is via prev/next buttons or arrow keys. When done, they click "Submit All Reviews" which saves all feedback to `feedback.json`.
|
|
288
|
+
|
|
289
|
+
### Step 5: Read the feedback
|
|
290
|
+
|
|
291
|
+
When the user tells you they're done, read `feedback.json`:
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"reviews": [
|
|
296
|
+
{"run_id": "eval-0-with_skill", "feedback": "the chart is missing axis labels", "timestamp": "..."},
|
|
297
|
+
{"run_id": "eval-1-with_skill", "feedback": "", "timestamp": "..."},
|
|
298
|
+
{"run_id": "eval-2-with_skill", "feedback": "perfect, love this", "timestamp": "..."}
|
|
299
|
+
],
|
|
300
|
+
"status": "complete"
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Empty feedback means the user thought it was fine. Focus your improvements on the test cases where the user had specific complaints.
|
|
305
|
+
|
|
306
|
+
Stop the viewer server when you're done with it by calling the `skill_stop_review` tool.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Improving the skill
|
|
311
|
+
|
|
312
|
+
This is the heart of the loop. You've run the test cases, the user has reviewed the results, and now you need to make the skill better based on their feedback.
|
|
313
|
+
|
|
314
|
+
### How to think about improvements
|
|
315
|
+
|
|
316
|
+
1. **Generalize from the feedback.** The big picture thing that's happening here is that we're trying to create skills that can be used a million times (maybe literally, maybe even more who knows) across many different prompts. Here you and the user are iterating on only a few examples over and over again because it helps move faster. The user knows these examples in and out and it's quick for them to assess new outputs. But if the skill you and the user are codeveloping works only for those examples, it's useless. Rather than put in fiddly overfitty changes, or oppressively constrictive MUSTs, if there's some stubborn issue, you might try branching out and using different metaphors, or recommending different patterns of working. It's relatively cheap to try and maybe you'll land on something great.
|
|
317
|
+
|
|
318
|
+
2. **Keep the prompt lean.** Remove things that aren't pulling their weight. Make sure to read the transcripts, not just the final outputs — if it looks like the skill is making the model waste a bunch of time doing things that are unproductive, you can try getting rid of the parts of the skill that are making it do that and seeing what happens.
|
|
319
|
+
|
|
320
|
+
3. **Explain the why.** Try hard to explain the **why** behind everything you're asking the model to do. Today's LLMs are *smart*. They have good theory of mind and when given a good harness can go beyond rote instructions and really make things happen. Even if the feedback from the user is terse or frustrated, try to actually understand the task and why the user is writing what they wrote, and what they actually wrote, and then transmit this understanding into the instructions. If you find yourself writing ALWAYS or NEVER in all caps, or using super rigid structures, that's a yellow flag — if possible, reframe and explain the reasoning so that the model understands why the thing you're asking for is important. That's a more humane, powerful, and effective approach.
|
|
321
|
+
|
|
322
|
+
4. **Look for repeated work across test cases.** Read the transcripts from the test runs and notice if the Task tool invocations all independently wrote similar helper scripts or took the same multi-step approach to something. If all 3 test cases resulted in the agent writing a `create_docx.py` or a `build_chart.py`, that's a strong signal the skill should bundle that script. Write it once, put it in `scripts/`, and tell the skill to use it. This saves every future invocation from reinventing the wheel.
|
|
323
|
+
|
|
324
|
+
This task is pretty important (we are trying to create billions a year in economic value here!) and your thinking time is not the blocker; take your time and really mull things over. I'd suggest writing a draft revision and then looking at it anew and making improvements. Really do your best to get into the head of the user and understand what they want and need.
|
|
325
|
+
|
|
326
|
+
### The iteration loop
|
|
327
|
+
|
|
328
|
+
After improving the skill:
|
|
329
|
+
|
|
330
|
+
1. Apply your improvements to the skill
|
|
331
|
+
2. Rerun all test cases into a new `iteration-<N+1>/` directory, including baseline runs. If you're creating a new skill, the baseline is always `without_skill` (no skill) — that stays the same across iterations. If you're improving an existing skill, use your judgment on what makes sense as the baseline: the original version the user came in with, or the previous iteration.
|
|
332
|
+
3. Launch the reviewer with the `skill_serve_review` tool, passing `previousWorkspace` pointing at the previous iteration
|
|
333
|
+
4. Wait for the user to review and tell you they're done
|
|
334
|
+
5. Read the new feedback, improve again, repeat
|
|
335
|
+
|
|
336
|
+
Keep going until:
|
|
337
|
+
- The user says they're happy
|
|
338
|
+
- The feedback is all empty (everything looks good)
|
|
339
|
+
- You're not making meaningful progress
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Advanced: Blind comparison
|
|
344
|
+
|
|
345
|
+
For situations where you want a more rigorous comparison between two versions of a skill (e.g., the user asks "is the new version actually better?"), there's a blind comparison system. Read `agents/comparator.md` and `agents/analyzer.md` for the details. The basic idea is: give two outputs to an independent agent without telling it which is which, and let it judge quality. Then analyze why the winner won.
|
|
346
|
+
|
|
347
|
+
This is optional, requires the Task tool (using `general` subagent type), and most users won't need it. The human review loop is usually sufficient.
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Description Optimization
|
|
352
|
+
|
|
353
|
+
The description field in SKILL.md frontmatter is the primary mechanism that determines whether OpenCode invokes a skill. After creating or improving a skill, offer to optimize the description for better triggering accuracy.
|
|
354
|
+
|
|
355
|
+
### Step 1: Generate trigger eval queries
|
|
356
|
+
|
|
357
|
+
Create 20 eval queries — a mix of should-trigger and should-not-trigger. Save as JSON:
|
|
358
|
+
|
|
359
|
+
```json
|
|
360
|
+
[
|
|
361
|
+
{"query": "the user prompt", "should_trigger": true},
|
|
362
|
+
{"query": "another prompt", "should_trigger": false}
|
|
363
|
+
]
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
The queries must be realistic and something an OpenCode user would actually type. Not abstract requests, but requests that are concrete and specific and have a good amount of detail. For instance, file paths, personal context about the user's job or situation, column names and values, company names, URLs. A little bit of backstory. Some might be in lowercase or contain abbreviations or typos or casual speech. Use a mix of different lengths, and focus on edge cases rather than making them clear-cut (the user will get a chance to sign off on them).
|
|
367
|
+
|
|
368
|
+
Bad: `"Format this data"`, `"Extract text from PDF"`, `"Create a chart"`
|
|
369
|
+
|
|
370
|
+
Good: `"ok so my boss just sent me this xlsx file (its in my downloads, called something like 'Q4 sales final FINAL v2.xlsx') and she wants me to add a column that shows the profit margin as a percentage. The revenue is in column C and costs are in column D i think"`
|
|
371
|
+
|
|
372
|
+
For the **should-trigger** queries (8–10), think about coverage. You want different phrasings of the same intent — some formal, some casual. Include cases where the user doesn't explicitly name the skill or file type but clearly needs it. Throw in some uncommon use cases and cases where this skill competes with another but should win.
|
|
373
|
+
|
|
374
|
+
For the **should-not-trigger** queries (8–10), the most valuable ones are the near-misses — queries that share keywords or concepts with the skill but actually need something different. Think adjacent domains, ambiguous phrasing where a naive keyword match would trigger but shouldn't, and cases where the query touches on something the skill does but in a context where another tool is more appropriate.
|
|
375
|
+
|
|
376
|
+
The key thing to avoid: don't make should-not-trigger queries obviously irrelevant. "Write a fibonacci function" as a negative test for a PDF skill is too easy — it doesn't test anything. The negative cases should be genuinely tricky.
|
|
377
|
+
|
|
378
|
+
### Step 2: Review with user
|
|
379
|
+
|
|
380
|
+
Present the eval set to the user for review using the HTML template:
|
|
381
|
+
|
|
382
|
+
1. Read the template from `templates/eval-review.html` (located in the opencode-skill-creator skill directory, alongside this SKILL.md)
|
|
383
|
+
2. Replace the placeholders:
|
|
384
|
+
- `__EVAL_DATA_PLACEHOLDER__` → the JSON array of eval items (no quotes around it — it's a JS variable assignment)
|
|
385
|
+
- `__SKILL_NAME_PLACEHOLDER__` → the skill's name
|
|
386
|
+
- `__SKILL_DESCRIPTION_PLACEHOLDER__` → the skill's current description
|
|
387
|
+
3. Write to a temp file (e.g., `/tmp/eval_review_<skill-name>.html`) and open it: `open /tmp/eval_review_<skill-name>.html`
|
|
388
|
+
4. The user can edit queries, toggle should-trigger, add/remove entries, then click "Export Eval Set"
|
|
389
|
+
5. The file downloads to `~/Downloads/eval_set.json` — check the Downloads folder for the most recent version in case there are multiple (e.g., `eval_set (1).json`)
|
|
390
|
+
|
|
391
|
+
This step matters — bad eval queries lead to bad descriptions.
|
|
392
|
+
|
|
393
|
+
### Step 3: Run the optimization loop
|
|
394
|
+
|
|
395
|
+
Tell the user: "This will take some time — I'll run the optimization loop and check on it periodically."
|
|
396
|
+
|
|
397
|
+
Save the eval set to the workspace, then use the `skill_optimize_loop` tool:
|
|
398
|
+
|
|
399
|
+
```
|
|
400
|
+
Call skill_optimize_loop with:
|
|
401
|
+
evalSetPath: <path-to-trigger-eval.json>
|
|
402
|
+
skillPath: <path-to-skill>
|
|
403
|
+
model: <model-id-powering-this-session>
|
|
404
|
+
maxIterations: 5
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Use the model ID from your system prompt (the one powering the current session) so the triggering test matches what the user actually experiences.
|
|
408
|
+
|
|
409
|
+
This handles the full optimization loop automatically. It splits the eval set into 60% train and 40% held-out test, evaluates the current description (running each query 3 times to get a reliable trigger rate), then calls OpenCode to propose improvements based on what failed. It re-evaluates each new description on both train and test, iterating up to 5 times. When it's done, it returns JSON with `best_description` — selected by test score rather than train score to avoid overfitting.
|
|
410
|
+
|
|
411
|
+
### How skill triggering works
|
|
412
|
+
|
|
413
|
+
Understanding the triggering mechanism helps design better eval queries. Skills appear in OpenCode's `available_skills` list with their name + description, and OpenCode decides whether to consult a skill based on that description. The important thing to know is that OpenCode only consults skills for tasks it can't easily handle on its own — simple, one-step queries like "read this PDF" may not trigger a skill even if the description matches perfectly, because OpenCode can handle them directly with basic tools. Complex, multi-step, or specialized queries reliably trigger skills when the description matches.
|
|
414
|
+
|
|
415
|
+
This means your eval queries should be substantive enough that OpenCode would actually benefit from consulting a skill. Simple queries like "read file X" are poor test cases — they won't trigger skills regardless of description quality.
|
|
416
|
+
|
|
417
|
+
### Step 4: Apply the result
|
|
418
|
+
|
|
419
|
+
Take `best_description` from the JSON output and update the skill's SKILL.md frontmatter. Show the user before/after and report the scores.
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Skill Installation
|
|
424
|
+
|
|
425
|
+
After the skill is created and validated, help the user install it. Skills can be installed in two locations:
|
|
426
|
+
|
|
427
|
+
- **Project-level**: `.opencode/skills/<skill-name>/SKILL.md` — available only in this project
|
|
428
|
+
- **Global**: `~/.config/opencode/skills/<skill-name>/SKILL.md` — available in all projects
|
|
429
|
+
|
|
430
|
+
Copy the skill directory to the desired location. The directory name must match the `name` field in the SKILL.md frontmatter.
|
|
431
|
+
|
|
432
|
+
Keep all draft/eval artifacts in the staging location; only copy the final validated skill directory into project/global install paths.
|
|
433
|
+
|
|
434
|
+
You can validate the skill before installation by calling the `skill_validate` tool.
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## Available plugin tools
|
|
439
|
+
|
|
440
|
+
The opencode-skill-creator plugin provides these custom tools that are available during your session:
|
|
441
|
+
|
|
442
|
+
- **`skill_validate`** — Validate a skill's SKILL.md structure and frontmatter
|
|
443
|
+
- **`skill_parse`** — Parse a SKILL.md and return its name, description, and content length
|
|
444
|
+
- **`skill_eval`** — Test trigger accuracy for a set of eval queries
|
|
445
|
+
- **`skill_improve_description`** — LLM-powered description improvement based on eval failures
|
|
446
|
+
- **`skill_optimize_loop`** — Full eval→improve optimization loop with train/test split
|
|
447
|
+
- **`skill_aggregate_benchmark`** — Aggregate grading.json files into benchmark statistics
|
|
448
|
+
- **`skill_generate_report`** — Generate HTML optimization report
|
|
449
|
+
- **`skill_serve_review`** — Start the eval review viewer (HTTP server + browser)
|
|
450
|
+
- **`skill_stop_review`** — Stop a running review server
|
|
451
|
+
- **`skill_export_static_review`** — Generate standalone HTML review (no server)
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
## Reference files
|
|
456
|
+
|
|
457
|
+
The agents/ directory contains instructions for specialized tasks (used via the Task tool). Read them when you need to spawn the relevant task.
|
|
458
|
+
|
|
459
|
+
- `agents/grader.md` — How to evaluate assertions against outputs
|
|
460
|
+
- `agents/comparator.md` — How to do blind A/B comparison between two outputs
|
|
461
|
+
- `agents/analyzer.md` — How to analyze why one version beat another
|
|
462
|
+
|
|
463
|
+
The references/ directory has additional documentation:
|
|
464
|
+
- `references/schemas.md` — JSON structures for evals.json, grading.json, etc.
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
Repeating one more time the core loop here for emphasis:
|
|
469
|
+
|
|
470
|
+
- Figure out what the skill is about
|
|
471
|
+
- Draft or edit the skill
|
|
472
|
+
- Run opencode-with-access-to-the-skill on test prompts
|
|
473
|
+
- With the user, evaluate the outputs:
|
|
474
|
+
- Create benchmark.json (via `skill_aggregate_benchmark`) and launch the viewer (via `skill_serve_review`) to help the user review them
|
|
475
|
+
- Run quantitative evals
|
|
476
|
+
- Repeat until you and the user are satisfied
|
|
477
|
+
- Install the final skill for the user.
|
|
478
|
+
|
|
479
|
+
Please add steps to your TodoList (using the todowrite tool), if you have such a thing, to make sure you don't forget. Please specifically put "Create evals JSON and launch the eval viewer (via skill_serve_review) so human can review test cases" in your TodoList to make sure it happens.
|
|
480
|
+
|
|
481
|
+
Good luck!
|