Authoring Skills and Rules (cross-platform)
Leading words: progressive disclosure, context pointer, token budget,
trigger-rich description, leading words, phase separation, branch-specific
reference, single source of truth, deletion test.
A practitioner's guide to writing and maintaining the two artifact families that
steer coding agents — Skills (on-demand, procedural capabilities) and
Rules / instructions (standing context) — across Claude Code, Cursor,
OpenCode, Codex, and GitHub Copilot.
Trigger: /authoring-skills-and-rules, or any request to write, port, or
review a Skill or rule. If the target platform(s) are unstated, ask before
scaffolding — the file layout differs per platform.
This skill carries the per-platform exact details in references/ (loaded on
demand). The body below is the decision model + the universal craft + a
phase-separated workflow.
The one decision that comes first: Skill vs Rule
Pick the artifact by how the behavior should load, not by topic.
|
Skill (SKILL.md) |
Rule / instructions |
| Loads |
On demand — only when the task matches its description |
Standing — always, or auto-attached by file glob |
| Cost |
~Free until triggered (only the description is always in context) |
Taxes every request it applies to |
| Best for |
Multi-step procedures, reusable workflows, domain playbooks |
Project facts, coding standards, guardrails, style |
| Analogy |
A specialist you call in |
House rules pinned to the wall |
| Portable as |
One folder, near-identical across 4 of 5 platforms |
Format differs sharply per platform |
Rules of thumb:
- Procedure or workflow → Skill. If it has steps, checkpoints, or scripts.
- Always-true fact or guardrail → Rule. "We use Vitest", "never commit
secrets", "this repo is a monorepo".
- A standing block that grew past a few paragraphs and became procedural →
graduate it from the rule/
CLAUDE.md into a Skill.
- One capability per Skill. If the description needs "and" to cover unrelated
jobs, split it.
User-invoked vs Model-invoked
For Skills, the second decision (after Skill-vs-Rule) is how the Skill is
triggered. The description is the swing vote.
| Flag combination |
What the agent sees |
What the user does |
When to pick |
user-invocable: true + disable-model-invocation: false (BOTH) |
Description in context — agent may auto-invoke |
May also /command invoke |
Common, safe workflows where auto-detect is desired (this skill) |
user-invocable: true + disable-model-invocation: true (USER-ONLY) |
Description hidden from agent |
Must /command invoke explicitly |
Heavy pipelines the user must opt into (e.g. deep-deliberation) — minimizes context load + unpredictability |
user-invocable: false (MODEL-ONLY, rare) |
Description in context |
Cannot invoke manually |
Almost never — restricts user control |
Heuristic: if the workflow is cheap and the user benefits from the agent
auto-detecting the need → BOTH. If the workflow is heavy (multiple subagents,
human checkpoints, large context budget) → USER-ONLY, so the agent does not
fire it on a whim.
Cross-platform support — the leverage point
SKILL.md is now a cross-agent standard. As of Dec 2025, all five — Claude
Code, Cursor, OpenCode, Codex, and Copilot — auto-discover Skills from a
skills/ directory. Author a Skill once and mirror the folder into each agent's
location. What still differs sharply is rules (standing instructions).
Key leverage: .agents/skills/ and .claude/skills/ are shared cross-agent
directories — Codex, OpenCode, and Copilot all read them (and Claude Code
reads .claude/skills/). A single authored folder, mirrored (or symlinked) into
the right places, covers every agent for skills. The remaining per-agent work
is rules.
For the per-platform exact paths, precedence, field semantics, and the mirror
strategy this very repo uses, see:
- references/cross-platform.md — write-once-run-everywhere strategy
- references/claude-code.md
- references/cursor.md
- references/opencode.md
- references/codex.md
- references/copilot.md
Universal craft (applies to every platform)
1. The description is the product
On every platform, the description is the only thing always in context — it
is what the model reads to decide whether to pull in the Skill or rule. Spend
your effort here.
- Write it in the third person, stating what it does + when to use it.
- Pack in concrete triggers: file types, tool names, verbs, user phrases.
- ✅ "Extract text and tables from PDFs, fill forms, merge documents. Use when
the user mentions PDFs, forms, or document extraction."
- ❌ "Helps with documents." / "I can help you with files."
- For an Agent-Requested Cursor rule, the description is the whole trigger —
name the framework/domain and the situations that should pull it in.
- Limits: Anthropic Skill
description ≤ 1024 chars; name ≤ 64 chars,
lowercase + digits + hyphens only, no anthropic/claude.
2. Progressive disclosure — keep the entry file lean
Once a Skill/rule loads, every token competes with the conversation. Structure so
detail loads only when needed.
- SKILL.md body: keep it well under ~500 lines. Cursor docs say the same for
rules: "Keep rules under 500 lines."
- Put depth in
references/*.md (zero token cost until the agent reads them)
and executable logic in scripts/ (run, not loaded into context).
- Reference one level deep only. A reference that links to another reference
may get truncated (the agent previews with
head) and lose context.
<skill-name>/
├── SKILL.md # metadata + decision model + workflow (lean)
├── references/ # per-topic detail, loaded on demand
│ └── <topic>.md
└── scripts/ # executable helpers (optional)
3. Leading words — the agent's reasoning anchor
Leading words are dense phrases that pack a lot of meaning into a small
space. Put them in the skill body (typically under the title as a banner) and
the agent will repeat them in its own reasoning traces, which anchors its
behavior to your intent without long prose.
- ✅
vertical slice instead of "don't code layer by layer; seek feedback early".
- ✅
ground truth instead of "always read the real artifacts before branching".
- Place them once as a banner, then echo them where the corresponding behavior
is required. The agent's thinking traces are the audit channel — if it is not
echoing the leading word, the steering did not take.
4. Naming and scope
- One capability per Skill. Gerund or plain-descriptive names
(
processing-pdfs, authoring-skills-and-rules) beat vague ones (helper,
utils). The Skill folder name must equal the name in frontmatter (and
on OpenCode/Codex, match the directory).
- One concept per rule. Split large standards into composable rules rather
than one giant file.
5. Write for a smart reader, concretely
- Assume the agent is capable — don't explain
git, npm, or basic concepts.
- Be actionable and specific, like a sharp internal doc. Prefer examples and
@file / path references over pasting whole files.
- No time-sensitive phrasing ("after August 2025, do X"). Skills are
long-lived; describe the current way and collapse legacy into an aside.
- Justify constants (why
timeout=30), and declare dependencies and how
to install them — never assume a tool is present.
6. What to leave out
- Secrets, API keys, tokens — ever.
- Whole style guides (use a linter) and generic tool docs the agent already knows.
- Rare edge cases and duplicated codebase docs (link to the canonical source).
- No-ops — paragraphs that, if deleted, would not change agent behavior. Run
the deletion test: if the agent would still do the right thing without it, cut it.
- Sediment — stale instructions left by previous authors. Audit and prune.
Workflow — 4 phases (creating or updating)
Each phase ends with a checkpoint. Do not skip ahead — phase separation prevents
the agent from rushing to draft before the scope is locked.
Phase 1 — Scope
- [ ] Classify: Skill vs rule (use the table above)
- [ ] Choose invocation: BOTH vs USER-ONLY (use the decision table above)
- [ ] Confirm target platform(s) — ask if unstated
🛑 Checkpoint: State the classification, invocation flag, and platform list
in one sentence. Do not proceed to Draft until the user confirms (or you are
explicitly operating solo and the scope is unambiguous).
Phase 2 — Draft
- [ ] Write the description first (triggers + what + when), third person
- [ ] Scaffold the correct file layout per platform (see references/)
- [ ] Write the lean body; inject leading words; push depth to references/,
logic to scripts/
🛑 Checkpoint: Read the description aloud. If you cannot name the triggers
crisply, the scope is still fuzzy — go back to Phase 1.
Phase 3 — Distribute
- [ ] Mirror/port the source folder to every requested platform
- [ ] For Copilot, translate to .github/instructions/*.instructions.md
(applyTo if path-scoped) or .prompt.md
- [ ] For Skills: copy the folder to each platform's location
(see references/cross-platform.md)
🛑 Checkpoint: grep the name: slug across the repo. Every mirror must be
in sync before validating.
Phase 4 — Validate
Run the checklist below. Any miss → back to the relevant phase.
Updating an existing Skill or rule
The 4 phases apply, with these additions:
- Phase 1:
grep the name: slug across the repo to locate every copy
(source + mirrors under .cursor/, .agents/, .claude/).
- Phase 2: Edit the source of truth only; never hand-edit a mirror.
Bump the
version (SemVer) in frontmatter. Re-check the description against
the new behavior — stale triggers are the most common rot.
- Phase 3: Re-mirror from source so mirrors never drift. Update the
changelog/README if the repo tracks them.
- Phase 4: Same checklist.
Validation checklist (before declaring done)
References
| File |
Use it for |
| references/claude-code.md |
Claude Code: SKILL.md fields, .claude/ paths, CLAUDE.md, slash commands |
| references/cursor.md |
Cursor: .mdc frontmatter, the 4 activation modes, .cursor/ layout |
| references/opencode.md |
OpenCode: AGENTS.md, opencode.json, agents/commands/skills dirs |
| references/codex.md |
Codex: AGENTS.md hierarchy, config.toml, .agents/skills, prompts (deprecated) |
| references/copilot.md |
Copilot: copilot-instructions, *.instructions.md (applyTo), prompt files |
| references/cross-platform.md |
Write-once-run-everywhere: the mirror/symlink strategy + AGENTS.md convergence |
1---2name: authoring-skills-and-rules3description: Author Skills (SKILL.md) and rules/instructions across Claude Code, Cursor, OpenCode, Codex, and GitHub Copilot. Covers frontmatter, file layout, activation model, cross-platform mirroring, and the universal craft: progressive disclosure, trigger-rich descriptions (context pointers), leading words, token budget, naming, and what to leave out. Use when the user asks to write, scaffold, refactor, port, or review a Skill, Cursor rule (.mdc), AGENTS.md, copilot-instructions, or prompt file — or to make one Skill/rule work across multiple agents.4---56# Authoring Skills and Rules (cross-platform)78> **Leading words:** progressive disclosure, context pointer, token budget,9> trigger-rich description, leading words, phase separation, branch-specific10> reference, single source of truth, deletion test.1112A practitioner's guide to writing and maintaining the two artifact families that13steer coding agents — **Skills** (on-demand, procedural capabilities) and14**Rules / instructions** (standing context) — across **Claude Code, Cursor,15OpenCode, Codex, and GitHub Copilot**.1617**Trigger:** `/authoring-skills-and-rules`, or any request to write, port, or18review a Skill or rule. If the target platform(s) are unstated, ask before19scaffolding — the file layout differs per platform.2021This skill carries the per-platform exact details in `references/` (loaded on22demand). The body below is the decision model + the universal craft + a23phase-separated workflow.2425---2627## The one decision that comes first: Skill vs Rule2829Pick the artifact by **how the behavior should load**, not by topic.3031| | **Skill** (`SKILL.md`) | **Rule / instructions** |32|---|---|---|33| Loads | On demand — only when the task matches its `description` | Standing — always, or auto-attached by file glob |34| Cost | ~Free until triggered (only the description is always in context) | Taxes every request it applies to |35| Best for | Multi-step procedures, reusable workflows, domain playbooks | Project facts, coding standards, guardrails, style |36| Analogy | A specialist you call in | House rules pinned to the wall |37| Portable as | One folder, near-identical across 4 of 5 platforms | Format differs sharply per platform |3839Rules of thumb:40- **Procedure or workflow → Skill.** If it has steps, checkpoints, or scripts.41- **Always-true fact or guardrail → Rule.** "We use Vitest", "never commit42 secrets", "this repo is a monorepo".43- **A standing block that grew past a few paragraphs and became procedural →44 graduate it from the rule/`CLAUDE.md` into a Skill.**45- **One capability per Skill.** If the description needs "and" to cover unrelated46 jobs, split it.4748---4950## User-invoked vs Model-invoked5152For Skills, the second decision (after Skill-vs-Rule) is **how the Skill is53triggered**. The `description` is the swing vote.5455| Flag combination | What the agent sees | What the user does | When to pick |56|---|---|---|---|57| `user-invocable: true` + `disable-model-invocation: false` (BOTH) | Description in context — agent may auto-invoke | May also `/command` invoke | Common, safe workflows where auto-detect is desired (this skill) |58| `user-invocable: true` + `disable-model-invocation: true` (USER-ONLY) | Description hidden from agent | Must `/command` invoke explicitly | Heavy pipelines the user must opt into (e.g. `deep-deliberation`) — minimizes context load + unpredictability |59| `user-invocable: false` (MODEL-ONLY, rare) | Description in context | Cannot invoke manually | Almost never — restricts user control |6061**Heuristic:** if the workflow is cheap and the user benefits from the agent62auto-detecting the need → BOTH. If the workflow is heavy (multiple subagents,63human checkpoints, large context budget) → USER-ONLY, so the agent does not64fire it on a whim.6566---6768## Cross-platform support — the leverage point6970**`SKILL.md` is now a cross-agent standard.** As of Dec 2025, all five — Claude71Code, Cursor, OpenCode, Codex, *and* Copilot — auto-discover Skills from a72`skills/` directory. Author a Skill once and mirror the folder into each agent's73location. What still differs sharply is **rules** (standing instructions).7475**Key leverage:** `.agents/skills/` and `.claude/skills/` are shared cross-agent76directories — Codex, OpenCode, *and* Copilot all read them (and Claude Code77reads `.claude/skills/`). A single authored folder, mirrored (or symlinked) into78the right places, covers every agent for skills. The remaining per-agent work79is **rules**.8081For the per-platform exact paths, precedence, field semantics, and the mirror82strategy this very repo uses, see:83- [references/cross-platform.md](references/cross-platform.md) — write-once-run-everywhere strategy84- [references/claude-code.md](references/claude-code.md)85- [references/cursor.md](references/cursor.md)86- [references/opencode.md](references/opencode.md)87- [references/codex.md](references/codex.md)88- [references/copilot.md](references/copilot.md)8990---9192## Universal craft (applies to every platform)9394### 1. The description is the product95On every platform, the **description is the only thing always in context** — it96is what the model reads to decide whether to pull in the Skill or rule. Spend97your effort here.9899- Write it in the **third person**, stating **what it does + when to use it**.100- Pack in **concrete triggers**: file types, tool names, verbs, user phrases.101 - ✅ "Extract text and tables from PDFs, fill forms, merge documents. Use when102 the user mentions PDFs, forms, or document extraction."103 - ❌ "Helps with documents." / "I can help you with files."104- For an **Agent-Requested Cursor rule**, the description is the *whole* trigger —105 name the framework/domain and the situations that should pull it in.106- **Limits:** Anthropic Skill `description` ≤ **1024 chars**; `name` ≤ **64 chars**,107 lowercase + digits + hyphens only, no `anthropic`/`claude`.108109### 2. Progressive disclosure — keep the entry file lean110Once a Skill/rule loads, every token competes with the conversation. Structure so111detail loads only when needed.112113- **SKILL.md body: keep it well under ~500 lines.** Cursor docs say the same for114 rules: **"Keep rules under 500 lines."**115- Put depth in **`references/*.md`** (zero token cost until the agent reads them)116 and executable logic in **`scripts/`** (run, not loaded into context).117- **Reference one level deep only.** A reference that links to another reference118 may get truncated (the agent previews with `head`) and lose context.119120```121<skill-name>/122├── SKILL.md # metadata + decision model + workflow (lean)123├── references/ # per-topic detail, loaded on demand124│ └── <topic>.md125└── scripts/ # executable helpers (optional)126```127128### 3. Leading words — the agent's reasoning anchor129**Leading words** are dense phrases that pack a lot of meaning into a small130space. Put them in the skill body (typically under the title as a banner) and131the agent will repeat them in its own reasoning traces, which anchors its132behavior to your intent without long prose.133134- ✅ `vertical slice` instead of "don't code layer by layer; seek feedback early".135- ✅ `ground truth` instead of "always read the real artifacts before branching".136- Place them once as a banner, then echo them where the corresponding behavior137 is required. The agent's thinking traces are the audit channel — if it is not138 echoing the leading word, the steering did not take.139140### 4. Naming and scope141- **One capability per Skill.** Gerund or plain-descriptive names142 (`processing-pdfs`, `authoring-skills-and-rules`) beat vague ones (`helper`,143 `utils`). The Skill folder name **must equal** the `name` in frontmatter (and144 on OpenCode/Codex, match the directory).145- **One concept per rule.** Split large standards into composable rules rather146 than one giant file.147148### 5. Write for a smart reader, concretely149- Assume the agent is capable — don't explain `git`, `npm`, or basic concepts.150- Be **actionable and specific**, like a sharp internal doc. Prefer examples and151 `@file` / path references over pasting whole files.152- **No time-sensitive phrasing** ("after August 2025, do X"). Skills are153 long-lived; describe the current way and collapse legacy into an aside.154- **Justify constants** (why `timeout=30`), and **declare dependencies** and how155 to install them — never assume a tool is present.156157### 6. What to leave out158- Secrets, API keys, tokens — ever.159- Whole style guides (use a linter) and generic tool docs the agent already knows.160- Rare edge cases and duplicated codebase docs (link to the canonical source).161- **No-ops** — paragraphs that, if deleted, would not change agent behavior. Run162 the deletion test: if the agent would still do the right thing without it, cut it.163- **Sediment** — stale instructions left by previous authors. Audit and prune.164165---166167## Workflow — 4 phases (creating or updating)168169Each phase ends with a checkpoint. Do not skip ahead — phase separation prevents170the agent from rushing to draft before the scope is locked.171172### Phase 1 — Scope173174```175- [ ] Classify: Skill vs rule (use the table above)176- [ ] Choose invocation: BOTH vs USER-ONLY (use the decision table above)177- [ ] Confirm target platform(s) — ask if unstated178```179180🛑 **Checkpoint:** State the classification, invocation flag, and platform list181in one sentence. Do not proceed to Draft until the user confirms (or you are182explicitly operating solo and the scope is unambiguous).183184### Phase 2 — Draft185186```187- [ ] Write the description first (triggers + what + when), third person188- [ ] Scaffold the correct file layout per platform (see references/)189- [ ] Write the lean body; inject leading words; push depth to references/,190 logic to scripts/191```192193🛑 **Checkpoint:** Read the description aloud. If you cannot name the triggers194crisply, the scope is still fuzzy — go back to Phase 1.195196### Phase 3 — Distribute197198```199- [ ] Mirror/port the source folder to every requested platform200- [ ] For Copilot, translate to .github/instructions/*.instructions.md201 (applyTo if path-scoped) or .prompt.md202- [ ] For Skills: copy the folder to each platform's location203 (see references/cross-platform.md)204```205206🛑 **Checkpoint:** `grep` the `name:` slug across the repo. Every mirror must be207in sync before validating.208209### Phase 4 — Validate210211Run the checklist below. Any miss → back to the relevant phase.212213### Updating an existing Skill or rule214215The 4 phases apply, with these additions:216- **Phase 1:** `grep` the `name:` slug across the repo to locate every copy217 (source + mirrors under `.cursor/`, `.agents/`, `.claude/`).218- **Phase 2:** Edit the **source of truth** only; never hand-edit a mirror.219 Bump the `version` (SemVer) in frontmatter. Re-check the description against220 the new behavior — stale triggers are the most common rot.221- **Phase 3:** Re-mirror from source so mirrors never drift. Update the222 changelog/README if the repo tracks them.223- **Phase 4:** Same checklist.224225---226227## Validation checklist (before declaring done)228229- [ ] `name` matches the folder name; lowercase-hyphen; no reserved words.230- [ ] `description` is third person, ≤1024 chars, and states **what + when** with231 concrete triggers.232- [ ] Invocation flags set intentionally (BOTH vs USER-ONLY) and match the233 workflow's weight.234- [ ] Leading words injected as a banner and echoed where the corresponding235 behavior is required.236- [ ] Entry file is lean (well under 500 lines); depth is in `references/`.237- [ ] References are one level deep; no nested reference chains.238- [ ] No secrets; dependencies declared; constants justified.239- [ ] Correct frontmatter for the platform (e.g. Cursor `globs`/`alwaysApply`;240 Copilot `applyTo`).241- [ ] If multi-platform: every requested platform has its copy/translation, and242 mirrors are in sync.243- [ ] One capability per Skill / one concept per rule.244- [ ] Deletion test run on every paragraph — no no-ops, no sediment.245246---247248## References249250| File | Use it for |251|---|---|252| [references/claude-code.md](references/claude-code.md) | Claude Code: SKILL.md fields, `.claude/` paths, CLAUDE.md, slash commands |253| [references/cursor.md](references/cursor.md) | Cursor: `.mdc` frontmatter, the 4 activation modes, `.cursor/` layout |254| [references/opencode.md](references/opencode.md) | OpenCode: AGENTS.md, `opencode.json`, agents/commands/skills dirs |255| [references/codex.md](references/codex.md) | Codex: AGENTS.md hierarchy, `config.toml`, `.agents/skills`, prompts (deprecated) |256| [references/copilot.md](references/copilot.md) | Copilot: copilot-instructions, `*.instructions.md` (`applyTo`), prompt files |257| [references/cross-platform.md](references/cross-platform.md) | Write-once-run-everywhere: the mirror/symlink strategy + AGENTS.md convergence |