diff --git a/misc/docs/skill-management-best-practices.md b/misc/docs/skill-management-best-practices.md index 5281420..2905095 100644 --- a/misc/docs/skill-management-best-practices.md +++ b/misc/docs/skill-management-best-practices.md @@ -1,5 +1,7 @@ # Skills Management — Decision Record (2026-06) +> **Amended 2026-11-23** by `skill-placement-methods.md` ([addaix/skill#8](https://github.com/addaix/skill/issues/8)): placement methods now have names, and the default for every repository, pip packages included, is `repo-skills` (top-level `skills/`). The `{pkg}/data/skills/` row below is the `package-data-skills` method, still supported but no longer the default for pip packages. Everything else here stands. + How AI agent skills are organized and distributed across the package ecosystem, now that `gh skill` (GitHub CLI ≥ v2.90.0, shipped 2026-04-16) is the cross-agent standard. This is the capstone decision; the option analysis is in diff --git a/misc/docs/skill-placement-methods.md b/misc/docs/skill-placement-methods.md new file mode 100644 index 0000000..e833f4e --- /dev/null +++ b/misc/docs/skill-placement-methods.md @@ -0,0 +1,49 @@ +# Skill placement methods — decision record (2026-11-23) + +Decides [addaix/skill#8](https://github.com/addaix/skill/issues/8): the named methods for where a Python package's agent skills live, which one is the default, and how a user on each agent host installs them. **Amends** `skill-management-best-practices.md` (2026-06), whose rule put a pip package's skills in `{pkg}/data/skills/` by default; the layout rules it set (one real location, the `.claude/skills/` symlink bridge, spec-clean frontmatter, `gh skill` as the primary channel) all still hold. + +## The methods + +Each name describes the method, not its status, so the default can change without renaming anything. + +| Method | Real files | In the wheel? | How a user gets the skills | +|---|---|---|---| +| **`repo-skills`** (the default) | `skills//` at the repository root | no | `gh skill install / --agent `, or `skill install` / `skill link-skills ` | +| **`package-data-skills`** | `{pkg}/data/skills//` | yes, as package data | the same `gh skill` command (the nested `**/skills/*` glob finds it), or from the installed package (see below) | +| **`wheel-included-skills`** | `skills//` at the repository root, copied into the wheel at build time (for example `[tool.hatch.build.targets.wheel.force-include] "skills" = "{pkg}/_skills"`) | yes, copied at build | the same `gh skill` command, or from the installed package | +| **`plugin-marketplace`** (additive, Claude Code only) | any of the above, plus `.claude-plugin/` manifests | as the base method | `/plugin install` in Claude Code | + +In every method the real files live in exactly one non-hidden place in the repository, and `.claude/skills/` is a relative per-skill symlink to it. `wheel-included-skills` names its in-wheel folder something other than `skills` (`_skills` above) only for clarity: the copy exists in the built wheel, never in the repository, so `gh skill` never sees two. + +## The default: `repo-skills` + +Chosen as the maintainer proposed in the issue, because: + +- **It is where the cross-host tooling looks first.** `gh skill` discovers `**/skills/*/SKILL.md`, and top-level `skills/` is the convention the wider ecosystem's examples use (`skill_distribution_analysis.md`, Option 2). `{pkg}/data/skills/` is discovered too, but only through the nested glob. +- **A wheel is the wrong channel into an agent host.** pip has no post-install hook, so a skill in the wheel still needs a command to reach `.claude/skills/`, `.agents/skills/` or `~/.copilot/skills/`. Bundling saves nobody that step; it only adds bytes to every install, including servers and CI that never run an agent. +- **No ecosystem installs skills automatically with a package.** The closest is npm's opt-in `skills-npm` (a dev tool that links skills on `npm install`), and it is opt-in. Telling the user to install the skills explicitly, per host, is the clean story; `pip install pkg` followed by one `gh skill install` line from the README is it. +- **Skills and code version together anyway.** `gh skill install / @vX.Y.Z` pins the skills to the same tag the package was released from. + +`package-data-skills` stays fully supported: a package that wants its skills to travel inside the wheel (offline installs, a host with no `gh`) keeps them there. `wheel-included-skills` is the middle way when a package wants both the conventional repository layout and skills in the wheel; it needs only build configuration. + +## Install story per host + +What each host reads natively, from the research in this folder (`Cross-agent skill format compatibility and translation.md`, `gh-skill-reference.md`, and the agent targets in `skill/install.py`). Items the research marked unverified are marked so. + +| Host | Reads skills from | Install command | +|---|---|---| +| Claude Code | `.claude/skills/` (project), `~/.claude/skills/` (user) | `gh skill install o/r name --agent claude-code`, or `skill link-skills ` | +| GitHub Copilot | `.github/skills/` (project), `~/.copilot/skills/` (user) | `gh skill install o/r name` (Copilot is `gh skill`'s default agent) | +| OpenAI Codex | `.agents/skills/` from the working directory up to the repository root, `~/.agents/skills/` | `gh skill install o/r name --agent codex` | +| Cursor | `.agents/skills/` (project), `~/.cursor/skills/` (user) | `gh skill install o/r name --agent cursor` | +| Gemini CLI | `.agents/skills/` (project), `~/.gemini/skills/` (user); older notes say `.gemini/skills/` (unverified which is current) | `gh skill install o/r name --agent gemini` | +| Others (Windsurf, Roo, Cline) | `.windsurf/skills/`, `.roo/skills/`, `.agents/skills/` | `skill install` with that agent target; `gh skill`'s full `--agent` list is unverified | + +`gh skill` needs gh 2.90.0 or later. A README's "Skills" section gives one `gh skill install` line per skill and the `--agent` flag for non-Copilot hosts (`skill-docs` generates it). + +## What this spawns + +- A CLI path from an installed package to a host: `skill install --from-package ` that finds the skills of an installed distribution (`package-data-skills` and `wheel-included-skills` layouts, through `importlib.resources`) and links them for a chosen host; and `install_from_github` exposed on the CLI with `--scope`. Filed as an issue in this repository. +- The `wheel-included-skills` recipe as a tested snippet (hatch `force-include`, plus a check that the wheel holds the skills and the repository holds them once). Filed as an issue in this repository. +- `skill-package-setup` (this repository's `skills/`) now teaches `repo-skills` as the default and the other methods by name; `wads-skillify` defers to it and is aligned through an issue in its repository. +- No fleet sweep: the 27 repositories that use `{pkg}/data/skills/` today are already a supported method (`package-data-skills`) and move only on touch, if their maintainer wants the default. diff --git a/skills/skill-enable/SKILL.md b/skills/skill-enable/SKILL.md index ae4e641..1d01682 100644 --- a/skills/skill-enable/SKILL.md +++ b/skills/skill-enable/SKILL.md @@ -24,6 +24,8 @@ how to decide which skills qualify. Layout and spec compliance are owned by the ## Where pip-shipped skills go (and why it just works) +> Shipping skills in the wheel is opt-in: the default placement method is `repo-skills` (top-level `skills/`, installed with `gh skill install`). This section is the `package-data-skills` method, for when the maintainer wants skills in the wheel (`misc/docs/skill-placement-methods.md`, addaix/skill#8). + To ride along with `pip install`, skill files must live **inside the importable package**: `{pkg}/data/skills//`. That's the only place a wheel reliably ships non-code data. diff --git a/skills/skill-package-setup/SKILL.md b/skills/skill-package-setup/SKILL.md index 2b94e6e..9c3c349 100644 --- a/skills/skill-package-setup/SKILL.md +++ b/skills/skill-package-setup/SKILL.md @@ -46,12 +46,19 @@ everyone, though: Claude Code reads only `.claude/skills/`. Hence the rule. ## The rule (memorize this) **Real skill files live in exactly ONE non-hidden location, with relative -per-skill symlinks in `.claude/skills/`.** Pick the location: +per-skill symlinks in `.claude/skills/`.** Pick a named placement method +(decision record: `misc/docs/skill-placement-methods.md`, addaix/skill#8): -| Repo kind | Canonical real-files location | -|---|---| -| Pip-installable package whose skills should ship with `pip install` | **`{pkg}/data/skills//`** — ships via pip AND `gh skill`-discoverable. One location serves both channels. | -| Everything else (apps, skill-only repos, dev/maintainer-only skills) | **`skills//`** at the repo root — the ecosystem convention. | +| Method | Real-files location | In the wheel? | +|---|---|---| +| **`repo-skills`** — the default, for every repo, pip packages included | **`skills//`** at the repo root — the ecosystem convention | no: users run `gh skill install` | +| **`package-data-skills`** — only when the maintainer wants skills inside the wheel | `{pkg}/data/skills//` — ships via pip AND `gh skill`-discoverable | yes | +| **`wheel-included-skills`** — repo layout, plus a build-time copy into the wheel | `skills//` at the root; hatch `force-include` copies it to `{pkg}/_skills` | yes | + +pip has no post-install hook, so no method puts skills into an agent host by +itself: the README's `gh skill install … --agent ` line is the install +story for every host. Don't move an existing `{pkg}/data/skills/` repo unless +its maintainer asks: `package-data-skills` is a supported method. - **Never both.** Real files in both `skills/` and `{pkg}/data/skills/` means `gh skill` reports duplicate skills. The Step-0 `find` in the runbook is your @@ -71,8 +78,8 @@ per-skill symlinks in `.claude/skills/`.** Pick the location: ## Flow A — new package -1. Pick the canonical location per the rule (pip-shipped → `{pkg}/data/skills/`, - else `skills/`). +1. Pick the placement method per the rule (default `repo-skills`: `skills/`; + `{pkg}/data/skills/` only if the maintainer asks for `package-data-skills`). 2. Scaffold `…/-quickstart/SKILL.md` with spec-valid frontmatter (`name` == folder name, lowercase `[a-z0-9-]`; `description` ≤ 1024 chars, packed with trigger keywords). Use **skill-build**/**skill-creator** for content. @@ -80,7 +87,8 @@ per-skill symlinks in `.claude/skills/`.** Pick the location: 4. Classify audience (consumer vs developer) — reuse **skill-enable**'s signal lists. Prefix maintainer skills `-dev-…`; put `metadata.audience` in frontmatter. -5. If pip-shipping, wire package-data (**skill-enable** owns the mechanics). +5. Only for `package-data-skills` / `wheel-included-skills`: wire the wheel + (package-data, or hatch `force-include`; **skill-enable** owns the mechanics). 6. README "Skills" section with `gh skill install / ` lines (**skill-docs** can generate it). 7. Validate (`gh skill publish --dry-run`, or `skill validate`/`skills-ref diff --git a/skills/skill-package-setup/references/canonical-layout-and-distribution.md b/skills/skill-package-setup/references/canonical-layout-and-distribution.md index aabab07..4deb4be 100644 --- a/skills/skill-package-setup/references/canonical-layout-and-distribution.md +++ b/skills/skill-package-setup/references/canonical-layout-and-distribution.md @@ -52,7 +52,7 @@ holds one relative symlink per skill.** |---|---|---| | Audience | Users of the package (esp. their agents) | People working *on* the package | | Examples | `vd-ingest`, `pdfdol-read` | `vd-add-backend`, "release this pkg" | -| Real-files location | `{pkg}/data/skills/` if pip-shipping, else `skills/` | `skills/` (no reason to bundle in the wheel) | +| Real-files location | `skills/` (`repo-skills`, the default); `{pkg}/data/skills/` only under `package-data-skills` | `skills/` (no reason to bundle in the wheel) | | Naming | `-` | `-dev-` + `metadata.audience: developers` | Use **skill-enable**'s signal lists to classify ambiguous cases. A package can diff --git a/skills/skill-package-setup/references/migration-runbook.md b/skills/skill-package-setup/references/migration-runbook.md index cdd6ad5..4c8d006 100644 --- a/skills/skill-package-setup/references/migration-runbook.md +++ b/skills/skill-package-setup/references/migration-runbook.md @@ -29,8 +29,8 @@ must be consolidated to one. | Repo kind | Location | |---|---| -| Pip package whose skills should ship with `pip install` | `/data/skills/` | -| Everything else / dev-only skills | `skills/` (repo root) | +| Default (`repo-skills`), pip packages included | `skills/` (repo root) | +| `package-data-skills`: only when the maintainer wants skills inside the wheel | `/data/skills/` | `gh skill` discovers both; only `/data/skills/` also ships in the wheel.