@its-thepoe/write-a-skill 1.0.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 (3) hide show
  1. package/SKILL.md +160 -0
  2. package/package.json +22 -0
  3. package/reference.md +280 -0
package/SKILL.md ADDED
@@ -0,0 +1,160 @@
1
+ ---
2
+ name: write-a-skill
3
+ description: >-
4
+ Authors or improves an Agent Skill (SKILL.md + optional reference/examples/scripts)
5
+ with correct structure, frontmatter, and trigger phrases. Use when the user asks to
6
+ create, write, add, refine, or scaffold a skill, slash command, or prompt pack; or
7
+ to decide skill vs always-on rules (.cursor/rules, CLAUDE.md, AGENTS.md).
8
+ argument-hint: "[topic or skill name]"
9
+ ---
10
+
11
+ # Write a skill
12
+
13
+ ## One folder per skill
14
+
15
+ **Yes — exactly one directory per skill.** That folder is the whole skill: put **`SKILL.md` in the root of that folder**, plus optional siblings (`reference.md`, `examples.md`, `scripts/`, `package.json`, `LOVABLE.md`, etc.). Do not scatter one skill across multiple folders.
16
+
17
+ **Plugin bundles (optional):** some teams ship many skills inside a single installable plugin (e.g. `plugins/<plugin-id>/skills/<skill-name>/`). Same rule applies: **one folder per skill**, with `SKILL.md` inside. See [reference.md](reference.md#plugin-or-monorepo-layout).
18
+
19
+ ## This repo (many skills)
20
+
21
+ Put each skill in its **own folder at the repo root** (kebab-case; **`name` in frontmatter** should match the folder where products require it — some allow `ce:plan`-style `name` with a different folder name; follow your target product docs). Same folder copies or symlinks into Cursor, Claude Code, Windsurf, Gemini / Antigravity, etc.
22
+
23
+ ```text
24
+ <this repo>/
25
+ README.md
26
+ LICENSE
27
+ write-a-skill/
28
+ SKILL.md
29
+ reference.md
30
+ package.json # optional; only if you publish this skill to npm
31
+ another-skill/
32
+ SKILL.md
33
+ ```
34
+
35
+ **Use a skill locally:** copy or symlink `<repo>/<skill-name>/` into that product’s skills directory (see table below). Example — install `write-a-skill` for your user account on every tool you use:
36
+
37
+ ```bash
38
+ SKILL_SRC="/path/to/this/repo/write-a-skill"
39
+ ln -sf "$SKILL_SRC" ~/.cursor/skills/write-a-skill
40
+ ln -sf "$SKILL_SRC" ~/.claude/skills/write-a-skill
41
+ mkdir -p ~/.config/opencode/skills
42
+ ln -sf "$SKILL_SRC" ~/.config/opencode/skills/write-a-skill
43
+ ln -sf "$SKILL_SRC" ~/.codeium/windsurf/skills/write-a-skill
44
+ # Gemini / Antigravity: confirm current path in product docs, then same pattern, e.g.
45
+ # ln -sf "$SKILL_SRC" ~/.gemini/skills/write-a-skill
46
+ ```
47
+
48
+ Reload or restart each agent after adding a skill.
49
+
50
+ ---
51
+
52
+ ## Install this skill (copy the folder)
53
+
54
+ Same folder works for any agent that loads **Agent Skills** (`SKILL.md` + frontmatter). Typical paths:
55
+
56
+ | Product | Personal (all projects) | Project-only |
57
+ |--------|-------------------------|--------------|
58
+ | **Cursor** | `~/.cursor/skills/write-a-skill/` | `<repo>/.cursor/skills/write-a-skill/` |
59
+ | **Claude Code** | `~/.claude/skills/write-a-skill/` | `<repo>/.claude/skills/write-a-skill/` |
60
+ | **OpenCode** | `~/.config/opencode/skills/write-a-skill/` | `<repo>/.opencode/skills/write-a-skill/` |
61
+ | **Windsurf** | `~/.codeium/windsurf/skills/write-a-skill/` | `<repo>/.windsurf/skills/write-a-skill/` |
62
+ | **Antigravity / Gemini** | Often under `~/.gemini/skills/` or `~/.gemini/antigravity/skills/` — confirm in current docs | `<repo>/.agent/skills/write-a-skill/` (common) |
63
+
64
+ Each location must contain this directory with `SKILL.md` inside. Restart or reload the agent if it does not pick up a new skill immediately.
65
+
66
+ **From npm:** after `npm install write-a-skill`, copy or symlink `node_modules/write-a-skill/` to one of the paths above (folder must contain `SKILL.md`).
67
+
68
+ **Lovable:** does not use agent skill folders. This skill is for authoring **Agent Skills**; no `LOVABLE.md` is expected here. UI skills that support Lovable add **`LOVABLE.md`** next to `SKILL.md` (examples elsewhere: accessibility-review, design-engineering, family-taste).
69
+
70
+ For the open standard, see [Agent Skills](https://agentskills.io). For Claude Code–only options (subagents, `allowed-tools`, `context: fork`, `$ARGUMENTS`), see [Claude Code skills](https://code.claude.com/docs/en/skills). When authoring for **many agents**, prefer portable frontmatter (`name`, `description`, optional `argument-hint`) and add tool-specific keys only where needed.
71
+
72
+ ---
73
+
74
+ ## Step 1 — Establish context (ask if unclear)
75
+
76
+ **Audience**
77
+
78
+ - Engineer (Cursor, Claude Code, Windsurf, OpenCode, Antigravity, etc.) → primary deliverable is `skill-name/SKILL.md` (+ optional files).
79
+ - Non-technical or web builders (Claude.ai, v0, etc.) → add a copy-paste **prompt pack** (no repo-only paths). For **Lovable**, optional **`LOVABLE.md`** in the skill folder (not every skill needs one). See [reference.md](reference.md#prompt-pack-non-repo-users).
80
+
81
+ **Skill vs always-on rule**
82
+
83
+ - If the answer is “what should the agent *always* follow?” → prefer **rules/memory**: `.cursor/rules/`, `CLAUDE.md`, or `AGENTS.md` — not an invoked skill. Say that clearly and offer a short rule snippet instead.
84
+ - If the answer is “what should run when asked / when this task appears?” → **skill**.
85
+
86
+ **Greenfield vs brownfield vs recurring**
87
+
88
+ - One-time setup → setup flow in the skill.
89
+ - Migration → migration steps + verification.
90
+ - Ongoing workflow → checklist + idempotent steps.
91
+
92
+ ---
93
+
94
+ ## Step 2 — Avoid duplication
95
+
96
+ Before drafting:
97
+
98
+ - Extend or link an existing skill instead of cloning.
99
+ - If only a small section fits another skill, add a heading there and link out.
100
+ - Put long tables, full templates, and huge checklists in [reference.md](reference.md), not in this file.
101
+
102
+ ---
103
+
104
+ ## Step 3 — Write the skill
105
+
106
+ 1. **Folder**: `skill-name/` in kebab-case; `name` in frontmatter matches product rules (often same as folder; max **64** chars, lowercase and hyphens where required).
107
+ 2. **Required file**: `SKILL.md` with YAML frontmatter (`name`, `description`) and concise body.
108
+ 3. **Optional siblings**: `reference.md`, `examples.md`, `scripts/`, **`references/`** (schemas, templates, catalogs — link from `SKILL.md` in one hop). See [reference.md](reference.md#supporting-files-beyond-referencemd).
109
+
110
+ **Router-quality `description` (most important)**
111
+
112
+ - Concrete **what** + **when**: real phrases users say.
113
+ - **Guards and handoffs:** when the model should **prefer another skill or step first** (“if ambiguous, use brainstorm first”), or **not** invoke this skill (“side-effect deploys: manual only” via docs + frontmatter on Claude Code).
114
+ - Avoid fluff: not “helps with”, “handles”, “manages”.
115
+ - Aim under ~500 characters if possible; hard max **1024** where enforced. See [reference.md](reference.md#description-with-guards-and-handoffs).
116
+
117
+ **Leaf vs orchestrator**
118
+
119
+ - **Leaf skill:** one clear job (e.g. format a commit message).
120
+ - **Orchestrator skill:** phased workflow that delegates to subagents, other skills, or parallel tasks. Split into multiple skills if phases are independently useful or descriptions become vague. Details: [reference.md](reference.md#leaf-vs-orchestrator-skills).
121
+
122
+ **Arguments and modes (when slash args matter)**
123
+
124
+ - Use **`argument-hint`** for autocomplete. In Claude Code, **`$ARGUMENTS`**, **`$0` / `$1`**, and optional **mode tokens** (e.g. `mode:report-only`) in the body can steer one command with multiple behaviors. Full pattern: [reference.md](reference.md#arguments-modes-and-claude-code-placeholders).
125
+
126
+ Full template, good/bad examples, invariants, and review checklist: [reference.md](reference.md).
127
+
128
+ ---
129
+
130
+ ## Step 4 — Review before done
131
+
132
+ **Structure**
133
+
134
+ - [ ] `SKILL.md` stays focused; heavy detail lives in `reference.md`, `examples.md`, or `references/`
135
+ - [ ] Directory name matches `name` in frontmatter (per product rules)
136
+ - [ ] No stale dates or “before August 20xx” unless in a clearly marked legacy section
137
+
138
+ **Description**
139
+
140
+ - [ ] States capability in the first sentence
141
+ - [ ] Includes “Use when …” **or equivalent** trigger coverage
142
+ - [ ] Adds **handoffs or guards** when mis-routing would waste time (see reference)
143
+ - [ ] No vague-only wording
144
+
145
+ **Content**
146
+
147
+ - [ ] Steps are ordered and verifiable
148
+ - [ ] **Invariants** stated where it matters: paths never to delete, “never run X here”, quality gates (see [reference.md](reference.md#invariants-never-rules-and-quality-gates))
149
+ - [ ] Links to team standards only if paths exist in *this* repo (or say “if present”)
150
+ - [ ] Examples are concrete
151
+
152
+ **Distribution**
153
+
154
+ - [ ] User knows whether to install under personal vs project path (table above)
155
+ - [ ] If non-repo users need it, prompt pack exists (see reference)
156
+ - [ ] If the skill should work on **Lovable**, add or update **`LOVABLE.md`** in the skill folder (condensed if Knowledge **10k** limit applies); most skills do not need this
157
+
158
+ **Multi-product (optional)**
159
+
160
+ - [ ] If the skill references a **blocking user question**, note how other CLIs expose the same idea (see [reference.md](reference.md#cross-product-interactive-prompts)) — or keep wording product-agnostic
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@its-thepoe/write-a-skill",
3
+ "version": "1.0.0",
4
+ "description": "Agent Skill (SKILL.md + reference) for authoring and improving portable Agent Skills across Cursor, Claude Code, OpenCode, Windsurf, and similar tools.",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "agent-skills",
8
+ "cursor",
9
+ "claude-code",
10
+ "skill",
11
+ "prompt",
12
+ "agentskills"
13
+ ],
14
+ "files": ["SKILL.md", "reference.md", "package.json"],
15
+ "exports": {
16
+ ".": "./SKILL.md",
17
+ "./skill": "./SKILL.md",
18
+ "./SKILL.md": "./SKILL.md",
19
+ "./reference": "./reference.md",
20
+ "./reference.md": "./reference.md"
21
+ }
22
+ }
package/reference.md ADDED
@@ -0,0 +1,280 @@
1
+ # Write a skill — reference
2
+
3
+ ## Folder structure
4
+
5
+ ```text
6
+ skill-name/
7
+ ├── SKILL.md # Entry point — required
8
+ ├── reference.md # Long tables, templates, extra checklists (optional)
9
+ ├── examples.md # Before/after samples (optional)
10
+ ├── references/ # Optional: schemas, templates, catalogs (see below)
11
+ │ ├── findings-schema.json
12
+ │ └── ...
13
+ └── scripts/ # Validation or scaffolding only (optional)
14
+ ```
15
+
16
+ **This repo:** each skill is a **top-level folder** next to `README.md` (e.g. `write-a-skill/`, `another-skill/`). Copy or symlink that folder into each agent’s global skills path (Cursor, Claude Code, Windsurf, Gemini / Antigravity — see `SKILL.md` table).
17
+
18
+ Keep `SKILL.md` short; move bulk here.
19
+
20
+ ---
21
+
22
+ ## Plugin or monorepo layout
23
+
24
+ When publishing a **Claude Code plugin** (or similar), skills often live under:
25
+
26
+ ```text
27
+ plugins/<plugin-id>/
28
+ ├── .claude-plugin/ # plugin manifest (product-specific)
29
+ ├── skills/
30
+ │ └── <skill-name>/
31
+ │ └── SKILL.md
32
+ ├── agents/ # optional: subagent definitions
33
+ ├── AGENTS.md # optional: project memory for the plugin
34
+ └── .mcp.json # optional: bundled MCP
35
+ ```
36
+
37
+ The **one-folder-per-skill** rule is unchanged: each `skills/<skill-name>/` directory is a single skill. Names may be **namespaced** by the product (e.g. `plugin-id:skill-name` in menus).
38
+
39
+ ---
40
+
41
+ ## Supporting files beyond `reference.md`
42
+
43
+ For heavier skills, colocate machine- or human-facing artifacts and **link them from `SKILL.md`** with “what this file is / when to load it”:
44
+
45
+ | Artifact | Use case |
46
+ |----------|----------|
47
+ | `references/*.md` | Persona catalogs, diff rules, long policy |
48
+ | `references/*.json` | JSON schema for subagent outputs, merge pipelines |
49
+ | `references/*-template.md` | Subagent prompt shells, output report shells |
50
+ | `examples/*` | Expected output shapes |
51
+
52
+ Avoid dumping 2k+ lines into `SKILL.md` without navigation; mature orchestration skills use an **index body + deep files**.
53
+
54
+ ---
55
+
56
+ ## Leaf vs orchestrator skills
57
+
58
+ **Leaf**
59
+
60
+ - Single outcome, narrow triggers.
61
+ - Body is a short ordered checklist or policy.
62
+ - Example: “write conventional commit message from diff”.
63
+
64
+ **Orchestrator**
65
+
66
+ - Phases (research → decide → write → handoff), **parallel** sub-tasks, or fan-out to **subagents**.
67
+ - Body states **which steps run when**, what can run in **parallel**, and **stop conditions**.
68
+ - Risk: one giant skill with vague `description` → wrong invocations. Mitigation: **split phases into separate skills** when each phase is useful alone, or tighten `description` with **guards** (see below).
69
+
70
+ Orchestrators still benefit from **invariants** and **structured outputs** (e.g. JSON schema) when merging subagent results.
71
+
72
+ ---
73
+
74
+ ## Description with guards and handoffs
75
+
76
+ The `description` is the **router**. Besides “use when …”, strong skills add:
77
+
78
+ 1. **Handoff:** “Prefer **\<other skill>** when …” (ambiguous scope, missing inputs, wrong phase).
79
+ 2. **Guard:** “Do not use for …” or “Requires … before running” (only when it prevents real failures).
80
+
81
+ **Example (pattern only)**
82
+
83
+ ```yaml
84
+ description: >
85
+ Turns an approved requirements doc into a technical implementation plan with
86
+ file-level traceability. Use when the user says "plan this", "technical plan",
87
+ or "break down implementation". Prefer skill "brainstorm-requirements" first
88
+ when goals or scope are still unclear. Does not implement code or run tests —
89
+ use "execute-plan" for implementation.
90
+ ```
91
+
92
+ Stay within product **length limits** (~1024 chars where enforced). Prioritize triggers + the single most important guard.
93
+
94
+ ---
95
+
96
+ ## Arguments, modes, and Claude Code placeholders
97
+
98
+ [Claude Code skills](https://code.claude.com/docs/en/skills) support:
99
+
100
+ - **`argument-hint`:** shown during `/` completion (e.g. `[pr-url] [mode:report-only]`).
101
+ - **`$ARGUMENTS`:** full remainder after `/skill-name`.
102
+ - **`$0`, `$1`, …** or **`$ARGUMENTS[0]`:** positional args.
103
+ - **Mode tokens:** conventionally embed keywords in args (e.g. `mode:autofix`) and strip them in the body before interpreting the rest — yields **one slash command, multiple behaviors**.
104
+
105
+ Document in the skill body: **parse order**, **mutual exclusion**, and **side-effect rules** per mode.
106
+
107
+ Other products may not support these placeholders; for **portable** skills, keep critical behavior in prose and treat `$…` as progressive enhancement for Claude Code.
108
+
109
+ ---
110
+
111
+ ## Cross-product interactive prompts
112
+
113
+ If a step requires **blocking user input**, name the mechanism per product where you know it, e.g.:
114
+
115
+ - Claude Code: interactive question / `AskUserQuestion`
116
+ - Other CLIs: as documented
117
+
118
+ Otherwise stay **product-agnostic**: “Ask one focused question; wait for an answer before continuing.”
119
+
120
+ ---
121
+
122
+ ## Invariants, never-rules, and quality gates
123
+
124
+ **Invariants** — state what must never be violated:
125
+
126
+ - Paths or artifacts that **must not** be deleted or “cleaned up” by subagents.
127
+ - “Never run migrations in this skill — planning only.”
128
+
129
+ **Never-rules** — short bullets the agent must not do (reduces compound errors in long playbooks).
130
+
131
+ **Quality gates** — before delivering output, confirm:
132
+
133
+ - Findings are actionable (not “consider improving…” with no concrete next step).
134
+ - Severities match impact.
135
+ - Line refs / file paths were verified if cited.
136
+
137
+ Use these in **orchestrator** and **review**-style skills especially.
138
+
139
+ ---
140
+
141
+ ## SKILL.md template
142
+
143
+ Use this as a starting point. Most agents accept `name` + `description` (see [Agent Skills](https://agentskills.io)). Claude Code may also use `disable-model-invocation`, `allowed-tools`, `context: fork`, etc. — see [Claude Code skills](https://code.claude.com/docs/en/skills). For skills shared across Cursor, Windsurf, OpenCode, Antigravity, and Claude Code, keep frontmatter minimal unless a key is widely supported.
144
+
145
+ ```yaml
146
+ ---
147
+ name: skill-name
148
+ description: >
149
+ One sentence: what capability this adds. When to use: user phrases and tasks.
150
+ Prefer skill "other-skill" when [guard condition]. Not for [anti-pattern].
151
+ argument-hint: "[optional-args]"
152
+ ---
153
+
154
+ # Human-readable title
155
+
156
+ ## When to use this skill
157
+
158
+ [Who invokes it, project state, boundaries. Handoffs to sibling skills.]
159
+
160
+ ## Standards (if any)
161
+
162
+ Before starting, read if they exist in this repo:
163
+
164
+ - docs/contributing.md
165
+ - AGENTS.md
166
+
167
+ ## Workflow
168
+
169
+ 1. …
170
+ 2. …
171
+
172
+ ## Invariants (if any)
173
+
174
+ - Never …
175
+ - Do not delete …
176
+
177
+ ## Checklist
178
+
179
+ - [ ] …
180
+ - [ ] …
181
+
182
+ ## Additional resources
183
+
184
+ - [reference.md](reference.md) — …
185
+ - [references/schema.json](references/schema.json) — …
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Description rules
191
+
192
+ The **description** is what the model uses to decide whether to load the skill. Make it unambiguous.
193
+
194
+ **Good**
195
+
196
+ > Sets up a new frontend repo with shared tokens, folder layout, and UI primitives. Use when starting a greenfield frontend, scaffolding an app, or when the user says: new project, bootstrap, design tokens, component library, or init frontend.
197
+
198
+ **Bad**
199
+
200
+ > Helps with frontend setup and the design system.
201
+
202
+ ---
203
+
204
+ ## Prompt pack (non-repo users)
205
+
206
+ If the audience does not have the repo, add `prompts/skill-name.md` (or a single section in your docs) with:
207
+
208
+ - One copy-paste block with the rules inlined (no `see ../foo` only paths).
209
+ - One line: when to use it.
210
+ - No dependency on local-only files unless you also paste their content.
211
+
212
+ ---
213
+
214
+ ## Lovable (optional; not every skill)
215
+
216
+ [Lovable](https://lovable.dev) uses [Knowledge](https://docs.lovable.dev/features/knowledge) and root **`AGENTS.md`** / **`CLAUDE.md`** on GitHub-linked projects — not `SKILL.md` folders.
217
+
218
+ Skills that support Lovable add **`LOVABLE.md`** beside `SKILL.md`. Keep each `LOVABLE.md` under the **10,000-character** Knowledge limit where possible, or point `AGENTS.md` at the full `SKILL.md` in the synced repo.
219
+
220
+ ---
221
+
222
+ ## Full review checklist
223
+
224
+ **Structure**
225
+
226
+ - [ ] `SKILL.md` under ~100–200 lines of *instruction* unless it is a deliberate, well-structured orchestrator; split detail to this file or `references/`
227
+ - [ ] Folder name is kebab-case and matches `name` in frontmatter (per product)
228
+ - [ ] No time-sensitive information baked in without a “legacy” label
229
+
230
+ **Description**
231
+
232
+ - [ ] Specific trigger words or scenarios
233
+ - [ ] First sentence = capability; when to use is obvious
234
+ - [ ] Guards or handoffs if mis-routing is costly
235
+ - [ ] Under 1024 characters where enforced
236
+
237
+ **Content**
238
+
239
+ - [ ] Greenfield vs brownfield called out if it changes the workflow
240
+ - [ ] Final checklist the agent can tick
241
+ - [ ] Examples are concrete (not lorem ipsum)
242
+ - [ ] Invariants / never-rules if the skill is high-stakes or delegates to subagents
243
+
244
+ **Distribution**
245
+
246
+ - [ ] Documented install paths for target agents (global vs project; see repo `README.md` for a path table)
247
+ - [ ] Prompt pack created if non-repo or non-engineering tools need the same behavior
248
+ - [ ] If Lovable matters for this skill: `LOVABLE.md` added in the skill folder
249
+
250
+ ---
251
+
252
+ ## Claude Code extras (optional frontmatter)
253
+
254
+ Examples you can add to `SKILL.md` frontmatter when using Claude Code only:
255
+
256
+ ```yaml
257
+ disable-model-invocation: true # only you invoke with /skill-name
258
+ user-invocable: false # hide from / menu; model-only
259
+ allowed-tools: Read, Grep, Glob # restrict tools while skill is active
260
+ context: fork # run in subagent
261
+ agent: Explore # with context: fork
262
+ ```
263
+
264
+ Other agents typically ignore keys they do not support; keep portable skills to `name` and `description` (and optional `argument-hint`) when one folder is shared across many products.
265
+
266
+ **Invocation recap (Claude Code)**
267
+
268
+ | Pattern | Effect |
269
+ |---------|--------|
270
+ | Default | You and the model can invoke; description helps auto-routing |
271
+ | `disable-model-invocation: true` | Manual `/skill` only; use for risky or user-gated workflows |
272
+ | `user-invocable: false` | Model can load; user doesn’t see a friendly `/` action |
273
+
274
+ ---
275
+
276
+ ## Further reading (examples)
277
+
278
+ Mature open-source plugin layouts with phased skills, persona catalogs, and structured review pipelines — useful for **orchestration inspiration**, not mandatory conventions:
279
+
280
+ - [EveryInc/compound-engineering-plugin](https://github.com/EveryInc/compound-engineering-plugin) (`plugins/compound-engineering/skills/`)