Skill Authoring は何をしますか?
A skill is a procedure someone else will run without you, on a machine you will never see. That is the quality bar: a stranger's agent must load it, follow it, and produce what the description promised, without reading this repository.
Treat it as a software artefact — interface (the description), implementation (body and scripts), version, owner, and a check that proves it works. Context, attention and money are all finite: every line you add spends them, and recall degrades as the window fills. Prose is for judgement; code is for fragility.
Step 0 — Choose the mechanism before writing anything
People ask for a skill when they often need something else. Match the request to the guarantee they actually want:
| Request sounds like | Mechanism | Guarantee |
|---|---|---|
| A fact the model cannot discover from the repository | Memory file (AGENTS.md) | Always present, advisory |
| A procedure or reference it should find itself | Skill | Loaded when the description matches |
| "Run this exact prompt when I say so" | Slash command | You control the trigger |
| Work needing its own context, tools or model | Subagent | Isolation, separate permissions |
| Read or act in an external system | MCP tool | Typed action outside the repository |
| "It must always / never do this" | Hook or deny rule | Deterministic, can block |
Two rules settle most cases:
- Judgement and variation → skill. Must happen every time → hook, deny rule or managed setting. A prompt line is a preference, not a control.
- Start with a skill. Promote to an agent only for isolation — its own context window, tool allowlist, model or permission policy — never because the task is long.
If one deterministic function has one obvious path, write the function. Publish the
smallest artefact that works: a skill before a plugin, a script before either. Read
references/mechanisms.md when the choice is contested, when someone proposes several
agents, or when you must justify "not an agent" with evidence.
Step 1 — Intake
Ask one at a time and write the answers down. Do not start drafting first; the draft is cheap and the rework is not.
- Trigger — two or three sentences the user would really type, in their words.
- Result — what exists afterwards that did not before: a file, a decision, a fixed bug, a document.
- What fails today — run three real tasks without the skill and name the specific failure. If you cannot name one, you may not need a skill; say so and stop.
- Audience — only them, or a stranger after
git clone? This sets the eval bar. - Inputs — what must exist before it starts, and what it does when that is missing.
- Boundaries — what it must never do: destructive commands, writes outside a directory, network calls, publishing.
- Determinism — which parts are calculation, conversion or validation? Those
belong in
scripts/. - Domain knowledge — what must it know that a general model does not? That becomes the question set for the research pass, which every build gets.
If they arrive with a spec, verify it against these eight and skip what is answered.
Step 2 — Search before building
List skills/ and read every description. If one covers 80% of the request, extend
it: a near-duplicate ID is worse than a missing skill, because both are advertised to
the model and it picks unpredictably. Only a genuinely different trigger justifies a
new skill. "Deploy to AWS" and "Deploy to GCP" can be one skill with two references;
"review a diff" and "write a release note" cannot.
Step 3 — Research hand-off (always)
Every skill or agent gets a researcher pass, even when the domain feels obvious. You
cannot tell from the inside which of your general-model beliefs are wrong for this
domain, so the pass exists to correct the priors, not to confirm them. It cannot
interview, so hand it a topic directory with an intake index, not a conversation:
Spawn researcher. The topic index is authoritative; do not interview.
Topic: <id>
Intake: research/<id>/index.md
Questions the specialist must answer correctly:
1. ...
Boundary: <domain, version, jurisdiction, audience>
Depth: deep — enough to write skills/<id>/references/*.md
Return: the researcher completion block and the knowledge-base index path
Ask for expertise, not facts. Every question set covers what an expert knows and a general model merely repeats:
- What the work is and why — the goal, the decision it serves, what "good" means.
- Best practices, with conditions — when each applies, its cost, what breaks without it. An unconditional rule is usually a slogan.
- Canonical patterns — the two or three shapes practitioners reuse, and when each wins.
- Antipatterns and failure modes — symptom, cause, fix. Recognising the bad shape early is most of the expertise.
- Contested cases — where practitioners disagree, and what would settle it.
- Scope — version, jurisdiction, and what changed recently.
Scale the depth, never the existence of the pass: one scoped question for a single-step skill, several aspects for a broad domain. Where the domain has no public literature, run it anyway and record the thin evidence — that is how you learn which part is your assumption.
Distil the knowledge base into references/: a decisions-and-facts document, not a
reading list, and not a summary of common knowledge. Keep the reasons, the patterns, the
antipatterns and the citations. Anything factual that did not come from a note is an
assumption — list it in the skill's limitations and in the response to the user.
Never let it pass as research.
Step 4 — Design the skill
Progressive disclosure is the architecture, not a filing preference:
| Level | Loads | Budget | Contents |
|---|---|---|---|
| Metadata | name + description | ~100 tokens per skill | What and when |
| Body | SKILL.md | <5k tokens, <500 lines | Workflow, rules, pointers |
| Resources | references/, scripts/, templates/ | Zero until read | Depth, deterministic work |
A body that loads on every trigger competes with the conversation. When it grows, move reference material out and say when to read it — do not add a table of contents to a skill that should have been three files.
Useful body order: when not to use and where to hand off → inputs and what to ask for if missing → numbered workflow with checkable outcomes → rules, hard ones first → output contract with a template → verification and failure handling → pointers to references.
Match freedom to fragility:
| Freedom | Use when | Example |
|---|---|---|
| High | Many approaches valid; context decides | "Review this module; prioritise blocking issues." |
| Medium | Preferred pattern, room to adapt | A parameterised template with a default |
| Low | Fragile, exact sequence | "Run exactly this script; do not add flags." |
Three patterns earn their keep:
- Checklist — the model copies and ticks it off; use for anything with many independent requirements.
- Feedback loop — "run validator → fix → run again → proceed only when it passes"; use whenever a check exists.
- Plan file — write intended changes to a structured file, validate, then apply. Use for batch or destructive work, so a mistake costs a file, not a database.
Step 5 — Scripts and references
- Run, don't read. Say "Run
scripts/<name>.py": the source never enters context, only its output. If the logic matters as reference, say "see" and accept the read. - Solve, don't defer. Handle expected errors, print the next action, and justify
constants (
TIMEOUT = 30 # p99 of upstream, not47). Exit non-zero on failure; silent partial success is the worst outcome a reusable tool can have. - One level deep. Link every reference directly from
SKILL.md. Deep chains cause partial reads. Put a table of contents at the top of files over ~100 lines. - Expertise, not encyclopaedia. A reference carries the reason behind each rule, the canonical patterns with the condition that selects them, and the antipatterns with their symptom and fix. A file that lists facts or links, with no judgement, is a reading list and will not make the skill an expert.
- Portable paths. Forward slashes, one term per concept, no time-sensitive instructions in the main flow.
Step 6 — Write the description
The description is the entire triggering mechanism. The model sees one or two sentences and decides whether to read anything else. Write:
What it does — the concrete result, in the user's vocabulary. When to use it — the situations, including where the user does not name the artefact.
Rules that separate a skill that fires from one that does not:
- Third person: "Processes Excel files", not "I can help you with Excel".
- Name artefacts and synonyms: "PDF, handout, printable, one-pager".
- Describe situations, not categories: "when a document is too long for a meeting" beats "for presentations".
- Add one near-miss boundary when confusion is likely: "not for spreadsheets".
- Put the trigger in the description; the body carries only the boundary (when not to use, or which skill to hand off to).
- Target 300–600 characters; the portable hard cap is 1,024.
- One skill, one job. No marketing adjectives — they describe nothing.
If the skill exists but never fires, the description is almost always the cause, not the body. Fix it before editing anything else.
Step 7 — Draft the files
| File | Content |
|---|---|
skills/<id>/SKILL.md | Procedure. Under 500 lines. Points at references. |
skills/<id>/references/*.md | The expertise layer: reasons, patterns, antipatterns, contested cases, limits, citations |
skills/<id>/scripts/* | Anything deterministic, plus requirements.txt |
skills/<id>/templates/* | Files the skill copies and fills in |
agents/<name>/agent.md | Agent source: shared description and body |
agents/<name>/opencode.yaml, claude.yaml | Frontmatter keys for that tool only |
docs/skills/<id>.md | For humans, not the model |
README.md | One table row |
Start from templates/SKILL.md.tmpl and templates/agent.md.tmpl. For an agent,
render after writing the source: python3 scripts/render_agents.py.
Step 8 — Validate, then evaluate
python3 skills/skill-authoring/scripts/lint_collection.py
Fix every error. Read every warning and either fix it or say why it stands. Then run
each bundled script once with --help and once on a tiny real input. The linter checks
structure, not quality; it cannot tell you the procedure is wrong. When judging a
finished draft — body order, safety, anti-patterns — read references/quality-bar.md.
Evaluation comes next, and it is the part most drafts skip:
- Trigger test — five prompts: three that should fire, two near-misses that should not. A positive that does not fire means rewrite the description; a negative that fires means add a boundary. Do not add keywords for the negative case.
- Before publishing to strangers — about twenty queries: 8–10 positives, 8–10 near-miss negatives, 2–3 explicit invocations. Record precision and recall.
- Behavioural test — three real tasks from the intake, run against the skill. Check the outcome (file exists, command exit code, schema valid), not the agent's claim that it worked. If one answer is enough, one success is enough; if it must always work, run it several times and require all to pass.
Read references/evaluation.md before claiming a skill is tested. Keep the prompts in
your response to the user, not in the repository, unless the collection has an evals/
directory.
Step 9 — Document and version
docs/skills/<id>.md answers, for a human: what it is, when it triggers, how to
invoke it, what it produces, which files it owns, what it needs installed, and what it
does not do. Use the headings the linter expects. Add the README row.
Bump version in .claude-plugin/plugin.json, and keep marketplace.json in step. A
description change is a behaviour change: patch for wording that does not alter
triggering, minor for a new capability or a changed trigger, major for a rename or a
removed output. Record the reason ("fired on 'release' too broadly; added a single-PR
exclusion"), not just the diff — in CHANGELOG.md if the repository keeps one, in the
pull request otherwise.
When the thing is an agent, not a skill
Create an agent only if at least one is true: it needs its own context window, its own tool permissions, its own model, or you want to select it as a primary persona. If a subagent has no distinct context, tool set or policy, it is an expensive function call.
An agent is a contract, not a persona. Five fields are mandatory: role (name and
decision scope), objective (a verifiable deliverable), read scope, write
scope, and handoff (output schema, recipient, triggers). A contract is only real
if the harness enforces it: "you are read-only" is a preference; a tool list without
Write and a deny rule are controls. Read references/agent-contract.md before
designing one.
An agent has one body and two frontmatters. Write the instructions once in
agents/<name>/agent.md (with the shared description), put only the tool-specific
keys in opencode.yaml and claude.yaml beside it, then render:
python3 scripts/render_agents.py
That writes agents/opencode/<name>.md and agents/claude/<name>.md, which are
generated and must not be edited by hand — lint_collection.py fails when they are
stale. The reason is not tidiness: two hand-maintained copies of the same procedure
diverge, and the divergence is invisible until one harness behaves differently.
| OpenCode | Claude Code | |
|---|---|---|
| Identity | filename | name: frontmatter (the renderer writes it) |
| Mode | mode: primary | subagent | all | implicit; subagent unless used with --agent |
| Tools | permissions: list, last match wins | tools: / disallowedTools: |
| Model | model: provider/model | model: alias | inherit |
| Budget | steps | maxTurns |
| Interview | possible only as primary/all | impossible in subagents |
Harness notes
- The skill ID is the directory name;
nameis a display label. Renaming the folder breaks every install that referenced it. - OpenCode also reads
.claude/skills/for compatibility.metadatawithopencode/autoinvoke: falsehides a skill from the model while keeping it loadable by ID. - Permission lists are last-match-wins: broad rule first, narrow exception after.
Safety
A skill inherits the permissions of the agent that loads it: shell, files, credentials, messages, memory. It is a software supply chain, and the description is the label on the box.
- Do not combine private data, untrusted content and the ability to send. Any two are manageable; all three let an attacker who writes text the agent reads walk data out through the agent's own permissions. Break a leg structurally, not with a sentence in the body.
- The description must imply everything the body does. A "format a document" skill that also uploads it is a supply-chain problem, not a feature.
- Bundled scripts are code someone will execute. No
curl | bash, no encoded blobs, no downloads the description does not mention, no writes outside the target directory, no credentials in examples — not even obvious fakes, because they get copied. - Irreversible actions ask once, explicitly, and name what will be destroyed. A default deny on timeout belongs in the harness, not the prompt.
Maintenance
- Never rename an existing skill ID or agent name; installs reference them. Deprecate instead: announce, keep the old version installable for one cycle, name the replacement, remove on a date.
- Review the portfolio quarterly. At fifty skills, metadata is roughly 5,000 tokens in every session and near-duplicates compete. Every skill gets an owner and a review date; retire what nobody uses.
- On a model upgrade, run the evals unchanged, read the transcripts for new failure modes, remove scaffolding the new model no longer needs, re-check the descriptions, then canary with a rollback path.
Non-negotiables
- Never rename an existing skill ID, topic slug, or agent name.
- No secrets, customer data, or credentials — in examples either.
- No destructive default. If the procedure deletes, pushes, or publishes, it asks first and says so in the description.
- Scripts fail loudly and exit non-zero.
- The skill is safe to read: if the description implies "format a document", the body does not also reach the network.
- Never present an assumption as fact.
Review checklist for an existing skill
- Mechanism is right: a skill, not a hook/command/agent doing the same job worse
- Description names the trigger situations in the user's words, third person, with a near-miss boundary where needed
- Body is procedure; facts live in
references/; body is under 500 lines - References carry the expertise layer: reason, patterns, antipatterns, contested cases, limits — not a list of facts or links
- Workflow has numbered steps with checkable outcomes, and a failure path
- Deterministic parts are scripts that exit non-zero
- Every referenced path exists; references are one level deep
- Output contract explicit, with a template or example
- Trigger and behavioural evals run, outcome checked rather than claimed
- Docs page, README row and version are current, with a stated reason for the bump
- No assumption is presented as fact; no secret or unexpected network call