Skip to content

Commit 4d76aca

Browse files
authored
feat: naming and consumer scripts (#18)
* feat: naming and consumer scripts * bump version
1 parent 54eae37 commit 4d76aca

28 files changed

Lines changed: 1240 additions & 66 deletions

.github/scripts/publish-changed-skills.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# * Skips skill@version pairs already published to the registry.
1414
# * Publishes with `--tag latest` so the `latest` dist-tag always points at
1515
# the just-shipped version alongside the immutable version coordinate.
16-
# Consumers can then `npm install @bcgov/skill-<name>` (no version) to
16+
# Consumers can then `npm install @bcgov/<name>` (no version) to
1717
# track the most recent release.
1818
# * Keeps going after a per-skill failure and reports them all at the end,
1919
# then exits non-zero so the workflow turns red. (One bad skill should not

.github/skills/skill-author/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ description: Scaffolds a new skill profile in this repo and fills in the require
2020
2. Copy `templates/SKILL.md` and `templates/package.json` into that folder.
2121
3. Fill the frontmatter (`name`, `description`) and write the H1 title line.
2222
4. Complete all seven sections: Use When, Don't Use When, Workflow, Rules, Examples, Edge Cases, References.
23-
5. Set the package `name` to `@bcgov/skill-<skill-name>` and `version` to `0.1.0` in `package.json`.
23+
5. Set the package `name` to `@bcgov/<skill-name>` (matching the manifest `name`) and `version` to `0.1.0` in `package.json`.
2424
6. Run `uv run python scripts/validate_skill.py skills/<skill-name>/SKILL.md` and fix any errors.
2525

2626
## Rules
2727
- Always set the new skill's starting `version` to `0.1.0` in `package.json`, never in the `SKILL.md` frontmatter. (Why: version lives only in package.json to avoid drift between two sources of truth.)
28-
- Always keep the package `name` scoped as `@bcgov/skill-<skill-name>` matching the folder. (Why: the publish workflow derives the npm package identity from this and consumers install by it.)
28+
- Always keep the package `name` as `@bcgov/<skill-name>` — same as the folder and the manifest `name`. (Why: consumers wire skills into their agent by folder name; matching keeps `node_modules/@bcgov/<name>/` usable as-is with no rename step.)
2929
- Never invent a new section order or rename a section. (Why: the validator matches the seven section titles exactly and the PR check will fail.)
3030
- Always keep `## Use When` as situational triggers (when to reach for this skill at all) and `## Workflow` as the numbered procedure (how to do the work). Never let a Use When bullet paraphrase a Workflow step — if a bullet starts with "Always ship…", "Set X to Y", or restates a procedural detail, it belongs in Workflow, not Use When. (Why: the two sections serve different reader intents — routing vs. execution — and duplicating content between them bloats the agent's context, makes routing fuzzier, and drifts out of sync on every edit.)
3131

.github/skills/skill-release/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ description: Bumps a skill's version and ships it as an npm package when a contr
1919
1. Decide the change size: patch (fix/wording), minor (compatible capability), major (breaking).
2020
2. From the skill folder, run `npm version patch|minor|major` to bump `package.json`.
2121
3. Validate with `uv run python scripts/validate_skill.py skills/<name>/SKILL.md`.
22-
4. Open a PR; on merge to `main` the publish workflow reads `name` + `version` and runs `npm publish --tag latest`. The `--tag latest` keeps the `latest` dist-tag pointed at the version this run shipped, so consumers who `npm install @bcgov/skill-<name>` (no version) get the new release.
22+
4. Open a PR; on merge to `main` the publish workflow reads `name` + `version` and runs `npm publish --tag latest`. The `--tag latest` keeps the `latest` dist-tag pointed at the version this run shipped, so consumers who `npm install @bcgov/<name>` (no version) get the new release.
2323
5. Confirm the release: the workflow skips any version already published, so only a bumped version ships.
2424

2525
## Rules
2626
- Always bump the `version` in `package.json` for any release. (Why: the publish workflow skips already-published versions, so an unbumped merge ships nothing.)
2727
- Always choose the semver level by impact on consumers, not effort. (Why: a tiny but breaking change is still a major; consumers rely on semver ranges to upgrade safely.)
2828
- Never hand-edit a version to one that was already published. (Why: npm registry versions are immutable and the publish will fail.)
29-
- Never bypass the `--tag latest` behaviour for a normal forward release. (Why: the publish script ships every changed skill with `npm publish --tag latest`, which is what makes `npm install @bcgov/skill-<name>` resolve to the newest version. Backport publishes on an older line are the only case that wants a different dist-tag, and they belong in a follow-up `npm dist-tag` step rather than an edit to the publish script.)
29+
- Never bypass the `--tag latest` behaviour for a normal forward release. (Why: the publish script ships every changed skill with `npm publish --tag latest`, which is what makes `npm install @bcgov/<name>` resolve to the newest version. Backport publishes on an older line are the only case that wants a different dist-tag, and they belong in a follow-up `npm dist-tag` step rather than an edit to the publish script.)
3030

3131
## Examples
3232
- "I fixed a typo in the example skill, release it" → `npm version patch`, validate, open PR.
3333
- "This skill now supports a new lookup, ship it" → `npm version minor`, validate, open PR.
3434
- "Why didn't my merge publish anything?" → check whether `version` was bumped; an unchanged version is skipped by design.
35-
- "How do consumers pick up my release without pinning a version?" → `npm install @bcgov/skill-<name>` resolves to the `latest` dist-tag, which the publish workflow updates on every release.
35+
- "How do consumers pick up my release without pinning a version?" → `npm install @bcgov/<name>` resolves to the `latest` dist-tag, which the publish workflow updates on every release.
3636

3737
## Edge Cases
3838
- If the user is unsure of the level → ask whether existing consumers would break; if yes it's major, if it only adds it's minor, otherwise patch.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ and match the skill's directory name; `description` must be ≤1024 chars with n
100100
angle brackets. Keep the manifest under 500 lines and any `scripts/`,
101101
`references/`, or `assets/` directory flat (one level deep).
102102

103-
`package.json` holds the published package `name` (`@bcgov/skill-<name>`) and
103+
`package.json` holds the published package `name` (`@bcgov/<name>`) and
104104
the `version`. **The version lives only here — not in `SKILL.md`** — so there's
105105
one source of truth and no drift. See the spec for the full definition.
106106

README.md

Lines changed: 131 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,17 @@ agent-skills/
7676
│ └── SKILL_SPEC.md # authoritative manifest spec
7777
├── templates/
7878
│ ├── SKILL.md # copy this to start a new skill
79-
│ └── package.json # copy this — holds the skill's name + version
79+
│ ├── package.json # copy this — holds the skill's name + version
80+
│ └── references/
81+
│ └── REFERENCE.md # template for an optional reference doc
8082
8183
├── skills/ # contributed skills — validated AND published
8284
│ └── <skill>/ # one folder per skill (browse the live site for the catalogue)
8385
8486
├── scripts/
85-
│ └── validate_skill.py # the spec validator (CI + local)
87+
│ ├── validate_skill.py # the spec validator (CI + local)
88+
│ ├── install-skill.sh # consumer installer (macOS / Linux)
89+
│ └── install-skill.ps1 # consumer installer (Windows / PowerShell)
8690
├── tests/
8791
│ └── test_validate_skill.py
8892
@@ -118,6 +122,86 @@ Worth flagging about the layout above:
118122
Skills install like any other npm dependency, so your existing
119123
`npm` / `npx` / `npm update` flow already manages them, upgrades included.
120124

125+
### Quick install (recommended)
126+
127+
One line. The installer checks for the GitHub CLI (and installs it if missing),
128+
adds the `read:packages` scope, writes the project `.npmrc`, runs `npm install`,
129+
**and offers to wire the skill into your agent** (GitHub Copilot, Claude Code,
130+
or a custom location for Codex / Cursor / Cline / etc.). Re-run any time to
131+
install another skill or upgrade an existing one.
132+
133+
> **Supply-chain note &mdash; pin to an immutable ref in production.**
134+
> The forms below default to `main`, which is mutable: the installer code can
135+
> change between when you read it and when you run it. For CI, scripted setup,
136+
> or any environment where reproducibility matters, replace `main` with a
137+
> 40-char commit SHA you have audited &mdash; pick the latest green commit from
138+
> [bcgov/agent-skills/commits/main/scripts](https://github.com/bcgov/agent-skills/commits/main/scripts).
139+
> This is the same advice our own [`github-actions`](skills/github-actions/SKILL.md)
140+
> skill gives for third-party Actions.
141+
142+
**macOS / Linux** (interactive prompts work because of process substitution):
143+
144+
```bash
145+
# Pinned (recommended) -- replace <SHA> with a 40-char commit you have reviewed:
146+
bash <(curl -fsSL https://raw.githubusercontent.com/bcgov/agent-skills/<SHA>/scripts/install-skill.sh)
147+
148+
# Rolling (convenient for one-off installs -- may change without notice):
149+
bash <(curl -fsSL https://raw.githubusercontent.com/bcgov/agent-skills/main/scripts/install-skill.sh)
150+
```
151+
152+
**Windows (PowerShell)** &mdash; works on PS 5.1 and PS 7, no `ExecutionPolicy`
153+
change needed (in-memory scriptblocks aren't restricted):
154+
155+
```powershell
156+
# Pinned (recommended) -- replace <SHA> with a 40-char commit you have reviewed:
157+
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/bcgov/agent-skills/<SHA>/scripts/install-skill.ps1)))
158+
159+
# Rolling (convenient for one-off installs -- may change without notice):
160+
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/bcgov/agent-skills/main/scripts/install-skill.ps1)))
161+
```
162+
163+
Prefer to audit the script before running it? Pin to a SHA, download, read,
164+
then run. **When you pin to a commit SHA, GitHub serves the exact blob that
165+
was committed at that ref &mdash; the SHA itself is the integrity anchor; there
166+
is no separate published hash to compare against.** Recording a `sha256sum`
167+
is useful for your own change-management trail (so re-deploys can detect
168+
drift), not as a first-time verification step.
169+
170+
```bash
171+
# macOS / Linux
172+
curl -fsSL https://raw.githubusercontent.com/bcgov/agent-skills/<SHA>/scripts/install-skill.sh -o install-skill.sh
173+
less install-skill.sh # review the code
174+
sha256sum install-skill.sh # optional: record with your deploy ticket
175+
bash install-skill.sh
176+
```
177+
178+
```powershell
179+
# Windows (PowerShell)
180+
irm https://raw.githubusercontent.com/bcgov/agent-skills/<SHA>/scripts/install-skill.ps1 -OutFile install-skill.ps1
181+
Get-Content install-skill.ps1 | more # review the code
182+
Get-FileHash install-skill.ps1 -Algorithm SHA256 # optional: record with your deploy ticket
183+
.\install-skill.ps1
184+
```
185+
186+
Non-interactive form (CI or scripted setup &mdash; passing a positional skill
187+
name skips the wire-up prompt automatically):
188+
189+
```bash
190+
bash <(curl -fsSL https://raw.githubusercontent.com/bcgov/agent-skills/<SHA>/scripts/install-skill.sh) azure-networking 0.1.1
191+
```
192+
```powershell
193+
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/bcgov/agent-skills/<SHA>/scripts/install-skill.ps1))) -Skill azure-networking -Version 0.1.1
194+
```
195+
196+
**Agent compatibility today** &mdash; only Copilot and Claude Code load `SKILL.md`
197+
natively via the [agentskills.io](https://agentskills.io) standard. For Codex
198+
CLI, Cursor, Cline, Continue.dev, and others, pick "Custom location" and the
199+
script symlinks the skill into the folder your tool already scans.
200+
201+
Prefer to understand or run each step yourself? The manual flow is below.
202+
203+
### Manual install
204+
121205
**1. Point the `@bcgov` scope at GitHub Packages** by adding an `.npmrc` next
122206
to your agent's `package.json`:
123207

@@ -186,27 +270,60 @@ public packages, so `NODE_AUTH_TOKEN` needs a credential with the
186270
**3. Install.** Pin a version for reproducible pulls:
187271
188272
```bash
189-
npm install @bcgov/skill-<name>@0.1.0
273+
npm install @bcgov/<name>@0.1.0
190274
```
191275

192276
Or omit the version to track the `latest` dist-tag, which the publish
193277
workflow updates on every release:
194278

195279
```bash
196-
npm install @bcgov/skill-<name>
280+
npm install @bcgov/<name>
197281
```
198282

199-
It installs to `node_modules/@bcgov/skill-<name>/` with `SKILL.md` plus
200-
whatever else the skill ships, exactly as it lives in this repo. Point your
201-
agent's skill loader at that directory; the on-disk layout is preserved, so
202-
there's no extra wiring.
283+
It installs to `node_modules/@bcgov/<name>/` with `SKILL.md` at the root
284+
plus whatever else the skill ships, exactly as it lives in this repo.
285+
286+
**4. Wire it into your agent.** The SKILL.md format follows the
287+
[agentskills.io](https://agentskills.io) open standard, so GitHub Copilot,
288+
Claude Code, Cursor, and other compatible agents can all read it. Because the
289+
package name (`@bcgov/<name>`) already matches the manifest `name`, you have
290+
two options:
291+
292+
- **Point your agent at the whole scope (recommended).** Set the skills
293+
location to `node_modules/@bcgov/` once and every installed `@bcgov/*` skill
294+
shows up &mdash; no per-skill wiring, new installs picked up automatically:
295+
296+
```jsonc
297+
// .vscode/settings.json &mdash; GitHub Copilot in VS Code
298+
{ "chat.agentSkillsLocations": ["node_modules/@bcgov"] }
299+
```
300+
301+
```bash
302+
# Claude Code (project session)
303+
claude --add-dir node_modules/@bcgov
304+
```
305+
306+
- **Symlink one skill at a time.** If your agent only scans a fixed folder
307+
(`.github/skills/`, `.claude/skills/`, `.agents/skills/`), symlink each
308+
installed package in. Folder name and package name match, so the link is
309+
one-to-one:
310+
311+
```bash
312+
ln -s ../../node_modules/@bcgov/azure-networking .github/skills/azure-networking
313+
ln -s ../../node_modules/@bcgov/azure-networking .claude/skills/azure-networking
314+
```
315+
316+
For anything else, point the loader directly at
317+
`node_modules/@bcgov/<name>/SKILL.md`. See
318+
[Consume &rarr; Step 4](https://bcgov.github.io/agent-skills/consume.html#step-4-wire-up)
319+
for PowerShell snippets, the GitHub Actions form, and troubleshooting.
203320

204-
**4. Upgrade.** Because skills are plain npm packages:
321+
**5. Upgrade.** Because skills are plain npm packages:
205322

206323
```bash
207-
npm outdated @bcgov/skill-<name> # see what's newer
208-
npm update @bcgov/skill-<name> # move within your semver range
209-
npm install @bcgov/skill-<name>@0.2.0 # jump to an exact version
324+
npm outdated @bcgov/<name> # see what's newer
325+
npm update @bcgov/<name> # move within your semver range
326+
npm install @bcgov/<name>@0.2.0 # jump to an exact version
210327
```
211328

212329
Use a semver range (e.g. `"^0.1.0"`) to pick up compatible updates on
@@ -228,7 +345,7 @@ Once you have access set up, the loop looks like this:
228345
2. **Fill in** the `SKILL.md` frontmatter and all seven sections; see
229346
[`spec/SKILL_SPEC.md`](spec/SKILL_SPEC.md).
230347
3. **Set the package name and version** in `package.json`
231-
(`@bcgov/skill-<your-skill>`, starting at `0.1.0`). The published version
348+
(`@bcgov/<your-skill>`, starting at `0.1.0`). The published version
232349
lives only here; there is no `version` field in `SKILL.md` for it to drift
233350
from.
234351
4. **Validate locally:**
@@ -259,7 +376,7 @@ When a PR merges to `main`, [`publish.yml`](.github/workflows/publish.yml):
259376
`npm publish --tag latest`**unless that exact version is already
260377
published**, in which case it's skipped. The `--tag latest` keeps the
261378
`latest` dist-tag pointed at whatever this run shipped, so consumers who
262-
`npm install @bcgov/skill-<name>` (no version) get the most recent release.
379+
`npm install @bcgov/<name>` (no version) get the most recent release.
263380

264381
Three things shape how this works:
265382

docs/_pages/architecture.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h2 id="overview">Lifecycle at a glance</h2>
1515
publish workflow
1616
1717
18-
@bcgov/skill-&lt;name&gt;@x.y.z
18+
@bcgov/&lt;name&gt;@x.y.z
1919
on GitHub Packages</code></pre>
2020
</div>
2121

@@ -52,7 +52,7 @@ <h2 id="publish-workflow">Publish workflow: <code>.github/workflows/publish.yml<
5252
<li>Install <code>uv</code> (third-party action, SHA-pinned per the policy below).</li>
5353
<li><strong>Re-validate every skill</strong> with <code>uv run python scripts/validate_skill.py --all</code>, the final check before any package bytes leave the repo.</li>
5454
<li>Set up Node with the registry pointed at <code>https://npm.pkg.github.com</code> and the <code>@bcgov</code> scope. (The exact Node version lives in the workflow file.)</li>
55-
<li>Run <a href="https://github.com/bcgov/agent-skills/blob/main/.github/scripts/publish-changed-skills.sh" target="_blank" rel="noopener"><code>.github/scripts/publish-changed-skills.sh</code></a>, which diffs <code>BEFORE_SHA</code> against <code>HEAD_SHA</code>, walks each changed skill, and runs <code>npm publish --tag latest</code> with <code>NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}</code>. The <code>--tag latest</code> keeps the <code>latest</code> dist-tag pointed at the just-shipped version, so <code>npm install @bcgov/skill-&lt;name&gt;</code> (no version) always pulls the most recent release.</li>
55+
<li>Run <a href="https://github.com/bcgov/agent-skills/blob/main/.github/scripts/publish-changed-skills.sh" target="_blank" rel="noopener"><code>.github/scripts/publish-changed-skills.sh</code></a>, which diffs <code>BEFORE_SHA</code> against <code>HEAD_SHA</code>, walks each changed skill, and runs <code>npm publish --tag latest</code> with <code>NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}</code>. The <code>--tag latest</code> keeps the <code>latest</code> dist-tag pointed at the just-shipped version, so <code>npm install @bcgov/&lt;name&gt;</code> (no version) always pulls the most recent release.</li>
5656
</ol>
5757
</div>
5858

docs/_pages/catalog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h2 id="published">Published skills</h2>
2323
<h3 style="margin: 0; color: var(--bc-blue);">Browse published skills on GitHub Packages</h3>
2424
<span class="badge badge-gold">live</span>
2525
</div>
26-
<p>The full catalogue of published <code>@bcgov/skill-*</code> packages is browsable on GitHub. Each package links back to its <code>SKILL.md</code> source in this repo.</p>
26+
<p>The full catalogue of published <code>@bcgov/*</code> packages is browsable on GitHub. Each package links back to its <code>SKILL.md</code> source in this repo.</p>
2727
<p style="margin-top: 1rem;">
2828
<a href="https://github.com/orgs/bcgov/packages?repo_name=agent-skills" target="_blank" rel="noopener"><strong>Open packages for <code>bcgov/agent-skills</code></strong></a>
2929
&nbsp;·&nbsp;

0 commit comments

Comments
 (0)