返回 CodeWhale
SKILLS.md
根目录 / docs / SKILLS.md
1 # Skills Manager
2
3 In the terminal, `/skills` opens **Extensions → Skills**. Enter on a skill opens the dedicated manager, also available directly through `/skills manage`, for existing install, update, remove, and trust operations. `/skill <name>` still activates a skill, and the explicit inspection, remote, sync, and suggestion subcommands remain available.
4
5
6 > 阅读简体中文版:[zh_hans/SKILLS.md](zh_hans/SKILLS.md)
7
8 Skills are reusable `SKILL.md` instruction packs. Codewhale discovers them from
9 several roots, but **only Codewhale-owned directories are writable**. The unified
10 `/skills manage` manager is the interactive surface for audit and mutation; slash
11 aliases share the same write path.
12
13 For Claude Code plugin boundaries, see [CLAUDE_PLUGIN_COMPAT.md](CLAUDE_PLUGIN_COMPAT.md).
14 For `skills_dir` and `[skills]` config keys, see [CONFIGURATION.md](CONFIGURATION.md).
15
16 ## Architecture (four layers)
17
18 | Layer | Role |
19 | --- | --- |
20 | **Root catalog** | Single source of precedence and ownership (`SkillRootCatalog`). |
21 | **Audit** | Read-only, unmerged on-disk inventory (status, digest, actions). |
22 | **Mutation controller** | Only writer for install / import / update / remove / trust. |
23 | **Skills manager view** | TUI: emits events only; never writes files itself. |
24
25 Runtime discovery (`SkillRegistry`) still merges skills for the model. Audit
26 intentionally does **not** merge — it shows every on-disk copy so conflicts and
27 shadowing stay visible.
28
29 ## Ownership and roots
30
31 **Writable (Codewhale-owned)**
32
33 | Scope | Path |
34 | --- | --- |
35 | Project | `<workspace>/.codewhale/skills/` |
36 | Global | `~/.codewhale/skills/` |
37
38 **Read-only compatible** (discover / import source only — never mutated in place)
39
40 Examples: `<workspace>/.agents/skills`, `./skills`, `.claude/skills`,
41 `.cursor/skills`, `.opencode/skills`, `~/.agents/skills`, `~/.claude/skills`,
42 and similar harness layouts.
43
44 **Audit-only (not runtime-active)**
45
46 - `.codex/skills` appears in **compatible** audit scans so operators can see it.
47 It does **not** join the runtime discovery set.
48
49 Configured `skills_dir` that is not one of the owned Codewhale roots stays
50 read-only. Discovery and the manager can list it; mutations still target owned
51 project/global roots only.
52
53 ## Slash commands
54
55 | Command | Behavior |
56 | --- | --- |
57 | `/skills` | Opens Extensions → Skills (owned-only scan, **no network**). |
58 | `/skills manage` | Opens the dedicated Skills Manager for audit and mutation. |
59 | `/skills <prefix>` | Text list filtered by name prefix. |
60 | `/skills inspect` | Text discovery mode, searched directories, and source paths. |
61 | `/skills --remote` | Explicit registry listing (network). |
62 | `/skills suggest <task>` | Rank up to three remote skills for a task, with matching evidence and an explicit install command (network; no install). |
63 | `/skills sync` | Explicit registry → local cache sync (network). |
64 | `/skill <name>` | Activate a skill for the next turn. |
65 | `/skill install [--project\|--global] <spec>` | Install via mutation controller. |
66 | `/skill update [--project\|--global] <name>` | Update a managed skill from its registry provenance. |
67 | `/skill uninstall [--project\|--global] <name>` | Remove a managed skill. |
68 | `/skill trust [--project\|--global] <name>` | Write digest-bound advisory trust. |
69
70 Notes:
71
72 - There is **no** `/skills audit` subcommand. Use the manager (and `c` to toggle
73 compatible roots) or `/skills inspect` for discovery details.
74 - Bare `/skill install <spec>` (no scope flag) installs into the Codewhale
75 **global** owned root.
76 - `/skills suggest` only reads the curated registry through the existing
77 network policy. It never downloads, trusts, enables, or activates a skill;
78 each result gives a separate `/skill install <name>` command for the user to
79 choose.
80 - If the same name exists in both project and global owned roots, update /
81 uninstall / trust require `--project` or `--global`.
82 - If a name exists only under a compatible external root, writes are refused;
83 import it through `/skills manage` instead of editing harness directories.
84
85 ## Skills Manager (TUI)
86
87 Direct manager path: type `/skills manage` and confirm. The surface is zero-network on
88 open (owned-only audit).
89
90 | Key | Action |
91 | --- | --- |
92 | `↑`/`↓` or `j`/`k` | Move selection |
93 | `Enter` | Primary available action / confirm pending prompt |
94 | `i` | Import (external → owned) |
95 | `u` | Update (managed + registry provenance) |
96 | `r` | Remove (managed; confirms first) |
97 | `t` | Trust (managed; digest-bound) |
98 | `s` | Toggle import target: project ↔ global |
99 | `c` | Toggle scan: owned-only ↔ compatible (still local disk only) |
100 | `Esc` | Cancel confirm, or close the manager |
101
102 The view never calls install helpers or touches the filesystem. It emits a
103 mutation request; the host runs the controller, shows a receipt, and rebuilds
104 the inventory.
105
106 ## Bundled catalog tiers
107
108 Codewhale presents its shipped skills in two compact tiers so agentic workflows
109 are not buried under document and integration helpers:
110
111 - **Core agentic** — planning, implementation, debugging, review, verification,
112 delegation, Fleet, release, and `best-of-n` comparison workflows.
113 - **Format & tooling** — document formats, data visualization, frontend and web
114 testing, and skill/plugin/MCP authoring helpers.
115
116 Workspace, user, and compatible-harness skills stay labeled **custom**; Codewhale
117 does not guess their intent from their name. The shipped pack also does not
118 advertise capabilities the runtime lacks. In particular, image understanding
119 is available, but an image-generation skill is not bundled until a real
120 image-generation tool exists.
121
122 Repository-maintenance and release-operator helpers (the `gh-*` skills and
123 `codew-release-qa-sweep` under [`skills/`](skills/README.md)) are **not** part
124 of the end-user starter pack and are never auto-installed; a catalog-matrix
125 test pins that boundary. Shipping them as an optional bundle is plugin-delivery
126 work tracked separately in
127 [#4836](https://github.com/Hmbown/CodeWhale/issues/4836).
128
129 ### Invocation and alias metadata
130
131 Bundled and user skills may declare two runtime-routing fields in frontmatter:
132
133 | Field | Meaning |
134 | --- | --- |
135 | `invocation: model+user` | The default; the skill appears in the model's compact catalogue and can be loaded by the model or user. |
136 | `invocation: explicit-only` | The skill remains loadable by an explicit name, but is omitted from the model catalogue so opt-in instructions do not become ambient context. |
137 | `aliases-for: name, other-name` | Additional lookup names for the same canonical skill. Aliases are not separate catalogue entries and do not duplicate prompt content. |
138
139 Missing or unknown invocation values retain the historical `model+user`
140 behavior. Canonical names win over aliases when a collision exists. Loading a
141 skill reports its canonical invocation and aliases so receipts remain
142 inspectable.
143
144 ### Starter-pack parity decisions
145
146 The v0.9.2 parity audit in [#4698](https://github.com/Hmbown/CodeWhale/issues/4698)
147 compared the five `xai-grok-memory` / `xai-grok-shell` reference skills with
148 the actual Codewhale bundle. This is a decision matrix, not a request to copy
149 reference text or advertise unsupported tools:
150
151 | Reference skill | Codewhale decision | Runtime grounding |
152 | --- | --- | --- |
153 | `check-work` | Canonical alias/compatibility mapping to `verify` | `verify` is the shipped evidence-collection workflow. |
154 | `code-review` | Canonical alias/compatibility mapping to `review` | `review` is the shipped read-only correctness workflow. |
155 | `create-skill` | Canonical alias/compatibility mapping to `skill-creator` | `skill-creator` is the shipped authoring workflow. |
156 | `help` | Bounded `invocation: explicit-only` router, not an ambient manual | Routes to `/help`, `/skills`, `/config`, `doctor`, and the installed `docs/` tree; it embeds no manual text. |
157 | `imagine` | Intentionally out of scope | Codewhale has no image-generation/edit tool, so the starter pack must not advertise one. |
158
159 Notes on the two non-alias decisions:
160
161 - **`help`** ships as a bundled skill (generation 7) but is `explicit-only`, so
162 it never appears in the model catalogue and costs zero ambient prompt budget.
163 Its body is a routing card — which surface owns which fact — and explicitly
164 forbids pasting a command list or settings table into context. A checked
165 invariant keeps it under 80 lines and requires it to name the `/help`,
166 `/skills`, `/config`, and `doctor` surfaces.
167 - **`imagine`** stays out. The shipped runtime exposes image *understanding*,
168 not image generation or edit, so no bundled skill may advertise it. The
169 catalog matrix asserts that `imagine`, `image`, and `image-gen` are absent
170 from the bundle and resolve to nothing.
171
172 No reference skill body is copied by this compatibility slice. The explicit
173 aliases and invocation metadata are bounded routing facts; the full skill body
174 still enters context only through `load_skill`.
175
176 ### Catalog fixture matrix (provider-free)
177
178 [`crates/tui/assets/skills-catalog-matrix.json`](../crates/tui/assets/skills-catalog-matrix.json)
179 is an **authored** expectation table covering every bundled skill: canonical
180 name, tier, invocation, aliases, whether it renders as an ambient catalogue
181 entry, and which of its aliases are shadowed by another canonical name. The
182 tests in `crates/tui/src/skills/catalog_matrix.rs` assert a bijection between
183 that fixture and `BUNDLED_SKILLS`, so the shipped pack cannot change without an
184 explicit fixture update.
185
186 What those tests do and do not claim:
187
188 - They validate **deterministic registry / catalog / resolver behavior**:
189 install, parse, eligibility, explicit load, non-activation, alias resolution,
190 explicit-only exclusion, collision precedence, and prompt budget.
191 - They validate **nothing about semantic LLM routing**. Whether a model chooses
192 `debug` for a stack trace is a live-provider question; see
193 [LIVE_SMOKE.md](LIVE_SMOKE.md).
194
195 Collision and prompt-budget invariants asserted today:
196
197 | Invariant | Meaning |
198 | --- | --- |
199 | Canonical wins | A canonical bundled name always beats another skill's alias (`docx` → `docx`, never `documents`). |
200 | Single alias owner | No two bundled skills may claim the same alias. |
201 | No duplicate entries | Each canonical name renders at most one catalogue line; aliases render zero. |
202 | Budget headroom | The shipped pack alone renders under the window-scaled skills budget (25 600 chars at the default 128k window; 2 400-char floor) with **no** "additional skills omitted" line, so user skills are never silently displaced. |
203 | No context poisoning | Descriptions stay single-line and are truncated to `MAX_SKILL_DESCRIPTION_CHARS` (280) before entering the prompt. |
204
205 ### Locale-aware routing metadata
206
207 `description_<tag>` frontmatter is supported (exact tag, then primary subtag,
208 then the canonical description — with Traditional Chinese excluded from the
209 Simplified `zh` fallback). **No bundled skill ships a localized routing
210 description**, and none is fabricated. The shipped contract is therefore an
211 explicit, tested fallback:
212
213 - For every skill in the bundle × every locale in `Locale::shipped()` — all 15
214 of `en`, `ja`, `zh-Hans`, `zh-Hant`, `pt-BR`, `es-419`, `vi`, `ko`, `ca`,
215 `de`, `fr`, `id`, `hi`, `ru`, `uk` (`crates/localization/src/lib.rs:70-88`) —
216 `description_for_locale` returns the canonical English description.
217 - The rendered catalogue block is byte-identical across all shipped locales.
218 - Exact-tag match, primary-subtag fallback (`pt-BR` → `description_pt`), and
219 English fallback are covered against a synthetic authored fixture, so the
220 resolution paths stay tested even while the bundle itself is English-only.
221
222 If a bundled skill later ships localized routing metadata, the parity test
223 fails until source-backed coverage is added for it — the fallback contract
224 cannot silently absorb a translation.
225
226 ## Audit statuses
227
228 Each audited row carries precedence and relationship flags:
229
230 | Status | Meaning |
231 | --- | --- |
232 | **Active** | Highest-precedence copy for that canonical name in the scan. |
233 | **Shadowed** | Same name exists at a higher-precedence root. |
234 | **Duplicate** | Same canonical name and same package digest as another copy. |
235 | **Conflict** | Same canonical name, different package digest. |
236
237 External skills with no owned peer (and a valid digest) are **import
238 candidates**. Externals that conflict with or exactly duplicate an owned copy
239 can still offer Import — duplicate → already present; conflict → confirm replace
240 in the selected import scope.
241
242 ## Provenance and markers
243
244 Managed installs write schema **v2** metadata under the skill directory:
245
246 **`.installed-from` (v2)** — written last on successful install/import:
247
248 ```json
249 {
250 "schema_version": 2,
251 "spec": "github:owner/repo",
252 "url": "https://…",
253 "source_checksum": "…",
254 "content_digest": "…",
255 "installed_name": "my-skill",
256 "registry_version": null
257 }
258 ```
259
260 - `content_digest` is a bounded package tree hash (not SKILL.md alone).
261 - Display of URLs strips userinfo, query, and fragment.
262 - Imports use a local `import:…` provenance and **cannot** be updated from a
263 registry; re-import or remove them instead.
264 - Legacy v1 markers are recognized as managed with
265 `LegacyMetadataUnknown` integrity until refreshed.
266
267 **`.trusted` (v2)** — advisory, digest-bound:
268
269 ```json
270 {
271 "schema_version": 2,
272 "content_digest": "…"
273 }
274 ```
275
276 Trust records review intent. It does **not** sandbox the skill or auto-approve
277 tools. Content updates clear trust so a stale marker cannot outlive the bytes.
278
279 Manual skills (owned root, no managed marker) are visible but not
280 update/remove/trust through the managed actions.
281
282 ## Package digest and safety
283
284 Audit and mutation share a bounded package digest:
285
286 - Regular files only; symlinks that escape the skill root or cycle → fail closed.
287 - Caps on total size, file count, and depth.
288 - Mutations re-check an expected digest before write (TOCTOU).
289 - Import/replace keeps a `.bak` until digest + marker finalize succeed; failure
290 restores the previous owned package.
291
292 ## Readiness
293
294 The audit model has a readiness field and optional provider hook for a future
295 readiness cache ([#4407](https://github.com/Hmbown/CodeWhale/issues/4407)).
296 Today, when no cache is wired, readiness is always **`Unknown`**. The manager
297 does not run readiness probes and does not block mutations on readiness.
298
299 ## Config knobs
300
301 ```toml
302 # Optional override for discovery preference (not automatically a write target
303 # unless it is the Codewhale project/global owned path).
304 skills_dir = "/path/to/skills"
305
306 [skills]
307 # When true, runtime discovery skips cross-tool roots (.claude, .agents, …).
308 # Owned Codewhale roots and an explicit skills_dir override still apply.
309 scan_codewhale_only = false
310
311 # Optional registry / install size overrides used by --remote, sync, and install.
312 # registry_url = "https://…"
313 # max_install_size_bytes = 5242880
314 ```
315
316 See [CONFIGURATION.md](CONFIGURATION.md) for the full config surface.
317
318 ## Operator checklist
319
320 1. Prefer `/skills manage` for day-to-day management; keep `--remote` / `sync` explicit.
321 2. Never hand-edit `.claude` / `.agents` / `.cursor` trees to “install” for
322 Codewhale — import into `.codewhale/skills` instead.
323 3. Treat `.trusted` as advisory documentation of review, not a security boundary.
324 4. After registry updates that change content, re-trust if you still want the
325 advisory marker.
326 5. Dual project+global copies of the same name need an explicit scope flag on
327 CLI mutations.
328
328 lines MARKDOWN