skill-land 1.6.0 → 1.7.1

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/README.md +254 -136
  2. package/package.json +4 -5
  3. package/skill-land.mjs +131 -13
package/README.md CHANGED
@@ -1,48 +1,64 @@
1
- # skill-land
1
+ <h1 align="center">skill-land</h1>
2
2
 
3
- Install an agent skill to the directory the agent **actually reads**, then verify it landed.
4
- Exits non-zero if it didn't.
3
+ <p align="center">
4
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"/>
5
+ <a href="https://github.com/Magithar/skill-land/releases"><img src="https://img.shields.io/github/v/release/Magithar/skill-land?label=release" alt="Release"/></a>
6
+ <a href="https://www.npmjs.com/package/skill-land"><img src="https://img.shields.io/npm/v/skill-land" alt="npm version"/></a>
7
+ <a href="https://www.npmjs.com/package/skill-land"><img src="https://img.shields.io/npm/dt/skill-land" alt="npm downloads"/></a>
8
+ <a href="https://github.com/Magithar/skill-land/actions/workflows/check.yml"><img src="https://github.com/Magithar/skill-land/actions/workflows/check.yml/badge.svg" alt="CI"/></a>
9
+ </p>
5
10
 
6
- ```bash
7
- npx skill-land Magithar/SKILLmama --for codex,antigravity
8
- npx skill-land Magithar/SKILLmama --for codex --verify # audit an existing install
9
- ```
11
+ <p align="center">
12
+ Installs an agent skill to the directory the agent <b>actually reads</b>, then reads every file back and exits non-zero if it didn't land. Built because <code>npx skills add -g</code> reports success while writing somewhere 13 agents never look. It also audits skills you already have, whatever installed them, and can ask a fresh agent session whether it really sees the skill.<br/><br/>
13
+ Works with <a href="#supported-agents">Claude Code</a>, <a href="#supported-agents">OpenAI Codex</a>, <a href="#antigravity">Antigravity</a>, <a href="#supported-agents">Gemini CLI</a>, <a href="#supported-agents">Cursor</a>, <a href="#supported-agents">GitHub Copilot</a> and <a href="#supported-agents">more</a>.
14
+ </p>
10
15
 
11
- [![npm](https://img.shields.io/npm/v/skill-land)](https://www.npmjs.com/package/skill-land)
16
+ ---
12
17
 
13
- ## Why this exists
18
+ <p align="center">
19
+ <a href="#install">Install</a> • <a href="#usage">Usage</a> • <a href="#why-this-exists">Why</a> • <a href="#what-verified-means">Verified</a> • <a href="#auditing-a-whole-directory">Auditing</a> • <a href="#does-the-agent-actually-load-it---discover">Discover</a> • <a href="#security-scan">Security Scan</a> • <a href="#antigravity">Antigravity</a> • <a href="#skill-discovery">Skill Discovery</a> • <a href="#what-skill-land-is-not">Is Not</a> • <a href="#project-structure">Project Structure</a> • <a href="#releasing">Releasing</a> • <a href="#related">Related</a>
20
+ </p>
14
21
 
15
- `npx skills add -a <agent> -g` reports success while writing to the wrong directory
16
- for 13 agents, including Codex, Antigravity, Cursor, GitHub Copilot, Gemini CLI and
17
- opencode. Reproduced against `skills@1.5.22` (latest) on 2026-08-08:
22
+ ---
18
23
 
19
- ```
20
- $ npx skills add Magithar/SKILLmama -a codex -g -y
21
- copy → Codex
22
- ✓ SKILLmama (copied)
23
- → ~/.agents/skills/skillmama
24
- Done!
25
- $ echo $?
26
- 0
27
- $ ls ~/.codex/skills/
28
- # empty. Codex never sees it.
24
+ ## Install
25
+
26
+ No install step. Run it with `npx`:
27
+
28
+ ```bash
29
+ npx skill-land Magithar/SKILLmama --for codex,antigravity # install, then verify
30
+ npx skill-land Magithar/SKILLmama --for codex --verify # audit an existing install
29
31
  ```
30
32
 
31
- The correct path is in the CLI's own registry and never read. `isUniversalAgent()`
32
- (`dist/cli.mjs:1678`) classifies any agent whose *project* directory is
33
- `.agents/skills` as "universal", and `getAgentBaseDir()` then routes it to the
34
- canonical store, discarding `globalSkillsDir`:
33
+ The examples throughout use [SKILLmama](https://github.com/Magithar/SKILLmama), a capability
34
+ discovery skill by the same author. Any GitHub repo, local folder or `SKILL.md` works as a source.
35
35
 
36
- ```js
37
- function isUniversalAgent(type) {
38
- return agents[type].skillsDir === ".agents/skills";
39
- }
36
+ Or install it globally:
37
+
38
+ ```bash
39
+ npm install -g skill-land
40
40
  ```
41
41
 
42
- Every failure of this kind exits 0. Nothing in the ecosystem checks the install took.
42
+ Node 18 or later. No dependencies.
43
43
 
44
- A second, separate bug: `-a claude-code,antigravity` is rejected as "Invalid agents"
45
- while both names appear in the valid list it prints.
44
+ ### Supported agents
45
+
46
+ | Agent | `--for` | Upstream `skills add -g` |
47
+ |-------|---------|--------------------------|
48
+ | Claude Code | `claude-code` | works |
49
+ | OpenAI Codex | `codex` | writes to the wrong directory |
50
+ | Antigravity | `antigravity` | writes to the wrong directory ([details](#antigravity)) |
51
+ | Antigravity CLI | `antigravity-cli` | writes to the wrong directory |
52
+ | Gemini CLI | `gemini-cli` | writes to the wrong directory |
53
+ | Cursor | `cursor` | writes to the wrong directory |
54
+ | GitHub Copilot | `github-copilot` | writes to the wrong directory |
55
+ | opencode | `opencode` | writes to the wrong directory |
56
+ | Firebender | `firebender` | writes to the wrong directory |
57
+ | Amp | `amp` | writes to the wrong directory |
58
+
59
+ `skill-land --list` prints every agent with the directories it writes to.
60
+
61
+ ---
46
62
 
47
63
  ## Usage
48
64
 
@@ -77,41 +93,43 @@ skill-land Magithar/SKILLmama --for codex --verify
77
93
  skill-land ~/.agents/skills --for antigravity --verify --all
78
94
  ```
79
95
 
80
- ## Auditing a whole directory
96
+ ---
81
97
 
82
- `--all` takes every skill in the source instead of one. It is never the default:
83
- [`selectSkill()`](skill-land.mjs) refuses to guess when a source holds several,
84
- and `--all` is you saying you meant all of them.
98
+ ## Why this exists
85
99
 
86
- The use it was built for is `--verify --all` — checking whether the skills you
87
- already installed are where the agent actually reads, whatever put them there.
88
- That question is unanswerable today even if your setup works, because nothing in
89
- the ecosystem reads an install back:
100
+ `npx skills add -a <agent> -g` reports success while writing to the wrong directory
101
+ for 13 agents, including Codex, Antigravity, Cursor, GitHub Copilot, Gemini CLI and
102
+ opencode. Reproduced against `skills@1.5.22` (latest) on 2026-08-08:
90
103
 
91
104
  ```
92
- $ skill-land ~/.agents/skills --for antigravity --verify --all
105
+ $ npx skills add Magithar/SKILLmama -a codex -g -y
106
+ copy → Codex
107
+ ✓ SKILLmama (copied)
108
+ → ~/.agents/skills/skillmama
109
+ Done!
110
+ $ echo $?
111
+ 0
112
+ $ ls ~/.codex/skills/
113
+ # empty. Codex never sees it.
114
+ ```
93
115
 
94
- source /Users/you/.agents/skills
95
- skills 1 found
96
- impeccable FAIL 0/3
97
- x ~/.gemini/config/skills/impeccable/SKILL.md
98
- file exists: ~/.gemini/config/skills/impeccable/SKILL.md
99
- x ~/.gemini/skills/impeccable/SKILL.md
100
- content matches source: 10401 bytes sha abd76e36cf1d vs 10401 bytes sha a1ea82ce80f4
101
- 1 skill, 3 failed
116
+ The correct path is in the CLI's own registry and never read. `isUniversalAgent()`
117
+ (`dist/cli.mjs:1678`) classifies any agent whose *project* directory is
118
+ `.agents/skills` as "universal", and `getAgentBaseDir()` then routes it to the
119
+ canonical store, discarding `globalSkillsDir`:
120
+
121
+ ```js
122
+ function isUniversalAgent(type) {
123
+ return agents[type].skillsDir === ".agents/skills";
124
+ }
102
125
  ```
103
126
 
104
- That middle line is why the check compares hashes and not sizes: both files are
105
- 10401 bytes and they are not the same file. A copy that drifted after install
106
- looks identical to `ls`.
127
+ Every failure of this kind exits 0. Nothing in the ecosystem checks the install took.
107
128
 
108
- One line per skill, because a report nobody reads verifies nothing; `--verbose`
109
- restores the full per-target output. Failing paths are always named — a summary
110
- you have to re-run to act on is not a summary.
129
+ A second, separate bug: `-a claude-code,antigravity` is rejected as "Invalid agents"
130
+ while both names appear in the valid list it prints.
111
131
 
112
- With `--strict`, a flagged skill is skipped and the rest still install; the run
113
- exits non-zero and lists what it skipped. All-or-nothing across a directory would
114
- let one flagged skill block every clean one.
132
+ ---
115
133
 
116
134
  ## What "verified" means
117
135
 
@@ -134,30 +152,20 @@ Where an agent has several directories it reads, `--verify` counts the skill as
134
152
  it is **complete in any one of them**. Requiring every fallback to hold a copy reports
135
153
  working installs as broken.
136
154
 
137
- ### Does the agent actually load it? `--discover`
155
+ ### Leftover files
138
156
 
139
- Everything above proves the bytes are on disk. It does not prove the agent loads them: it may
140
- need a restart, reject the frontmatter, or read the directory only in some workspaces.
141
- `--discover` starts a fresh non-interactive session from a neutral directory and checks that the
142
- skill name appears in what the agent says it can see.
157
+ Installing copies over the top and never deletes, so a file dropped from a skill stays on disk
158
+ after a reinstall. `--verify` lists anything in the installed directory that the source does not
159
+ have:
143
160
 
144
- ```bash
145
- skill-land Magithar/SKILLmama --for codex,antigravity --discover
161
+ ```
162
+ OK ~/.codex/skills/pack 3/3 files (verify only)
163
+ WARN ~/.codex/skills/pack 1 leftover file not in the source: scripts/old.sh
146
164
  ```
147
165
 
148
- | Agent | Listing used | Kind |
149
- |---|---|---|
150
- | Antigravity | `agy -p /skills` | a real skill list |
151
- | Gemini CLI | `gemini skills list` | a real skill list, with enabled/disabled state |
152
- | Codex | `codex exec "list your skills"` | asks the model |
153
- | Claude Code | `claude -p "list your skills"` | asks the model |
154
-
155
- Each was tested by planting a uniquely named canary skill and confirming it appeared, then with real skills from git. A skill that is listed but switched off (Gemini CLI prints `[Disabled]`) fails: on disk and listed is not the same as loaded. Every other
156
- agent reports `NOT CHECKED`, never a pass: an unknown is not a success. A missing binary or a
157
- timeout is also `NOT CHECKED`; only a completed listing that lacks the skill fails the run.
158
-
159
- The Codex and Claude Code listings go through the model, so they cost an API call and a `FAIL`
160
- is a lead to investigate, not proof. It is opt-in for that reason, and skipped with `--project`.
166
+ This is a warning and does not change the exit code, because an installed directory can also hold
167
+ files a person or the agent added, and nothing here can tell those from stale ones. `skill-land`
168
+ never deletes them. It is skipped for a raw `.md` source, which only knows about `SKILL.md`.
161
169
 
162
170
  ### What it cannot tell you
163
171
 
@@ -167,68 +175,82 @@ Verification assumes the installer **copied**. Some installers **rewrite** on in
167
175
  still report `content matches source` failures, because they genuinely differ from the source.
168
176
  `skill-land` reports the difference and does not guess which side is right.
169
177
 
178
+ **Renamed and removed skills are not detected.** `skill-land` keeps no record of what it installed,
179
+ and the install directory comes from the skill's `name`. After a rename the old directory stays
180
+ next to the new one, and `--verify` only looks at the new one. A skill removed from its source is
181
+ never looked at. There is no uninstall command, so delete the old directory by hand.
182
+
170
183
  Tested against: truncated file, wrong skill in the right place, missing file,
171
184
  unwritable destination, and a real `npx skills add` install (correctly reported FAIL).
172
185
 
173
- ## Antigravity
186
+ ---
174
187
 
175
- Antigravity loads skills at startup, so an install cannot be confirmed live. The
176
- `agy` search path was stated by an Antigravity maintainer on 2026-09-05 in
177
- [antigravity-cli#103](https://github.com/google-antigravity/antigravity-cli/issues/103#issuecomment-5547952239):
188
+ ## Auditing a whole directory
189
+
190
+ `--all` takes every skill in the source instead of one. It is never the default:
191
+ [`selectSkill()`](skill-land.mjs) refuses to guess when a source holds several,
192
+ and `--all` is you saying you meant all of them.
193
+
194
+ The use it was built for is `--verify --all` — checking whether the skills you
195
+ already installed are where the agent actually reads, whatever put them there.
196
+ That question is unanswerable today even if your setup works, because nothing in
197
+ the ecosystem reads an install back:
178
198
 
179
199
  ```
180
- ~/.gemini/config/skills primary; independently confirmed by live testing
181
- ~/.gemini/skills fallback
182
- ~/.gemini/antigravity-cli/skills fallback
200
+ $ skill-land ~/.agents/skills --for antigravity --verify --all
201
+
202
+ source /Users/you/.agents/skills
203
+ skills 1 found
204
+ impeccable FAIL 0/3
205
+ x ~/.gemini/config/skills/impeccable/SKILL.md
206
+ file exists: ~/.gemini/config/skills/impeccable/SKILL.md
207
+ x ~/.gemini/skills/impeccable/SKILL.md
208
+ content matches source: 10401 bytes sha abd76e36cf1d vs 10401 bytes sha a1ea82ce80f4
209
+ 1 skill, 3 failed
183
210
  ```
184
211
 
185
- `--for antigravity` writes to all three and says so. The `language_server` binary
186
- contains `skillsPaths` and `skills_paths`, so this is a configurable list rather than a
187
- single directory, and the maintainer statement covers the CLI — whether the IDE surface
188
- reads the same list is **unverified**.
212
+ That middle line is why the check compares hashes and not sizes: both files are
213
+ 10401 bytes and they are not the same file. A copy that drifted after install
214
+ looks identical to `ls`.
189
215
 
190
- Checked against the shipped binaries (Antigravity 2026-07-30 build, inspected
191
- 2026-09-05). `language_server` contains **no** `.gemini/*/skills` literal at all:
192
- `skills_paths` is a repeated protobuf field, so the client passes the list in, and
193
- skills resolve to `skills/<name>/` under a *customization root*. Both roots we write
194
- to are named in the shipped strings and config:
216
+ One line per skill, because a report nobody reads verifies nothing; `--verbose`
217
+ restores the full per-target output. Failing paths are always named — a summary
218
+ you have to re-run to act on is not a summary.
195
219
 
196
- - `~/.gemini/config/` holds `config.json` and `skills/` — the global root
197
- - `~/.gemini/antigravity-cli/` — "The CLI is configured via
198
- `~/.gemini/antigravity-cli/settings.json`" (`language_server`)
220
+ With `--strict`, a flagged skill is skipped and the rest still install; the run
221
+ exits non-zero and lists what it skipped. All-or-nothing across a directory would
222
+ let one flagged skill block every clean one.
199
223
 
200
- 1.1.0 and earlier also wrote `~/.gemini/antigravity/skills`, on the reasoning that
201
- Antigravity created that directory itself. That reasoning was wrong: `app.asar` defines
202
- `~/.gemini/antigravity` as `IDE_OLD_DATA_DIR`, the **legacy IDE data directory** being
203
- migrated to `~/.gemini/antigravity-ide`. It was never a skills root. No longer written.
224
+ ---
204
225
 
205
- ### Live verification
226
+ ## Does the agent actually load it? `--discover`
206
227
 
207
- Confirmed against **`agy` 1.1.27 on 2026-09-05**, not inferred. A uniquely-named
208
- canary skill was planted in each candidate directory and `agy -p "/skills"` run from
209
- a neutral workspace:
228
+ Everything above proves the bytes are on disk. It does not prove the agent loads them: it may
229
+ need a restart, reject the frontmatter, or read the directory only in some workspaces.
230
+ `--discover` starts a fresh non-interactive session from a neutral directory and checks that the
231
+ skill name appears in what the agent says it can see.
210
232
 
211
- | directory | listed? |
212
- |---|---|
213
- | `~/.gemini/config/skills` | **yes** |
214
- | `~/.gemini/skills` | **yes** |
215
- | `~/.gemini/antigravity-cli/skills` | **yes** |
216
- | `~/.agents/skills` | no |
217
- | `~/.gemini/antigravity/skills` | no |
233
+ ```bash
234
+ skill-land Magithar/SKILLmama --for codex,antigravity --discover
235
+ ```
218
236
 
219
- All three directories `skill-land` writes to are read. The two it does not write to
220
- are not.
237
+ | Agent | Listing used | Kind |
238
+ |---|---|---|
239
+ | Antigravity | `agy -p /skills` | a real skill list |
240
+ | Gemini CLI | `gemini skills list` | a real skill list, with enabled/disabled state |
241
+ | Codex | `codex exec "list your skills"` | asks the model |
242
+ | Claude Code | `claude -p "list your skills"` | asks the model |
221
243
 
222
- `~/.agents/skills` appears **only** when its parent is the active workspace
223
- (`agy --add-dir $HOME`) — that is project-local behaviour, not a global search path,
224
- which is exactly what [#103](https://github.com/google-antigravity/antigravity-cli/issues/103)
225
- is asking to change. Confirmed still open at 1.1.27.
244
+ Each was tested by planting a uniquely named canary skill and confirming it appeared, then with
245
+ real skills from git. A skill that is listed but switched off (Gemini CLI prints `[Disabled]`)
246
+ fails: on disk and listed is not the same as loaded. Every other agent reports `NOT CHECKED`,
247
+ never a pass: an unknown is not a success. A missing binary or a timeout is also `NOT CHECKED`;
248
+ only a completed listing that lacks the skill fails the run.
226
249
 
227
- Two side findings: project-local `.agents/skills` is read only when the directory is
228
- a **registered workspace** — being the current directory was not enough — and
229
- `.antigravity/skills` and `.agy/skills` are not read at all.
250
+ The Codex and Claude Code listings go through the model, so they cost an API call and a `FAIL`
251
+ is a lead to investigate, not proof. It is opt-in for that reason, and skipped with `--project`.
230
252
 
231
- Restart Antigravity fully after installing.
253
+ ---
232
254
 
233
255
  ## Security scan
234
256
 
@@ -320,6 +342,70 @@ security SAFE SAFE, LOW, score 7, 2 issue(s)
320
342
  credentials, which would silently degrade this gate to a no-op for anyone without an API key. A
321
343
  check that did not run must never read as a check that passed.
322
344
 
345
+ ---
346
+
347
+ ## Antigravity
348
+
349
+ Antigravity loads skills at startup, so an install cannot be confirmed live. The
350
+ `agy` search path was stated by an Antigravity maintainer on 2026-09-05 in
351
+ [antigravity-cli#103](https://github.com/google-antigravity/antigravity-cli/issues/103#issuecomment-5547952239):
352
+
353
+ ```
354
+ ~/.gemini/config/skills primary; independently confirmed by live testing
355
+ ~/.gemini/skills fallback
356
+ ~/.gemini/antigravity-cli/skills fallback
357
+ ```
358
+
359
+ `--for antigravity` writes to all three and says so. The `language_server` binary
360
+ contains `skillsPaths` and `skills_paths`, so this is a configurable list rather than a
361
+ single directory, and the maintainer statement covers the CLI — whether the IDE surface
362
+ reads the same list is **unverified**.
363
+
364
+ Checked against the shipped binaries (Antigravity 2026-07-30 build, inspected
365
+ 2026-09-05). `language_server` contains **no** `.gemini/*/skills` literal at all:
366
+ `skills_paths` is a repeated protobuf field, so the client passes the list in, and
367
+ skills resolve to `skills/<name>/` under a *customization root*. Both roots we write
368
+ to are named in the shipped strings and config:
369
+
370
+ - `~/.gemini/config/` holds `config.json` and `skills/` — the global root
371
+ - `~/.gemini/antigravity-cli/` — "The CLI is configured via
372
+ `~/.gemini/antigravity-cli/settings.json`" (`language_server`)
373
+
374
+ 1.1.0 and earlier also wrote `~/.gemini/antigravity/skills`, on the reasoning that
375
+ Antigravity created that directory itself. That reasoning was wrong: `app.asar` defines
376
+ `~/.gemini/antigravity` as `IDE_OLD_DATA_DIR`, the **legacy IDE data directory** being
377
+ migrated to `~/.gemini/antigravity-ide`. It was never a skills root. No longer written.
378
+
379
+ ### Live verification
380
+
381
+ Confirmed against **`agy` 1.1.27 on 2026-09-05**, not inferred. A uniquely-named
382
+ canary skill was planted in each candidate directory and `agy -p "/skills"` run from
383
+ a neutral workspace:
384
+
385
+ | directory | listed? |
386
+ |---|---|
387
+ | `~/.gemini/config/skills` | **yes** |
388
+ | `~/.gemini/skills` | **yes** |
389
+ | `~/.gemini/antigravity-cli/skills` | **yes** |
390
+ | `~/.agents/skills` | no |
391
+ | `~/.gemini/antigravity/skills` | no |
392
+
393
+ All three directories `skill-land` writes to are read. The two it does not write to
394
+ are not.
395
+
396
+ `~/.agents/skills` appears **only** when its parent is the active workspace
397
+ (`agy --add-dir $HOME`) — that is project-local behaviour, not a global search path,
398
+ which is exactly what [#103](https://github.com/google-antigravity/antigravity-cli/issues/103)
399
+ is asking to change. Confirmed still open at 1.1.27.
400
+
401
+ Two side findings: project-local `.agents/skills` is read only when the directory is
402
+ a **registered workspace** — being the current directory was not enough — and
403
+ `.antigravity/skills` and `.agy/skills` are not read at all.
404
+
405
+ Restart Antigravity fully after installing.
406
+
407
+ ---
408
+
323
409
  ## Skill discovery
324
410
 
325
411
  Walks up to 10 levels, skipping only `.git`, `node_modules`, `.venv` and
@@ -338,32 +424,64 @@ $ skill-land product-on-purpose/pm-skills --for codex
338
424
  ...
339
425
  ```
340
426
 
427
+ ---
428
+
429
+ ## What skill-land Is Not
430
+
431
+ - Not a registry or a package manager
432
+ - Not a publisher
433
+ - Not a content transformer: no per-platform rewrites
434
+
435
+ skill-land **installs and verifies**. One `SKILL.md` works across all of these agents; the failure
436
+ mode here is a wrong-path bug, not a content-format problem.
437
+
438
+ ---
439
+
440
+ ## Project Structure
441
+
442
+ ```
443
+ skill-land.mjs the CLI: resolve, scan, copy, read back, discover
444
+ agents.json every agent's skill directories; broken: true marks upstream misroutes
445
+ test.mjs test suite (node test.mjs)
446
+ CHANGELOG.md release notes, one section per version
447
+ .github/workflows/
448
+ check.yml runs the tests on every push and pull request
449
+ publish.yml publishes to npm on a v* tag
450
+ ```
451
+
452
+ ### Adding an agent
453
+
454
+ Edit `agents.json`. `broken: true` marks agents where the upstream CLI misroutes a
455
+ global install, which is what drives the warning note.
456
+
457
+ ---
458
+
341
459
  ## Releasing
342
460
 
343
461
  Published from CI by [trusted publishing](https://docs.npmjs.com/trusted-publishers), so there is
344
462
  no `NPM_TOKEN` in this repo and the npm account keeps 2FA on write actions. npm mints a
345
- short-lived token from the GitHub identity of `.github/workflows/publish-skill-land.yml`.
463
+ short-lived token from the GitHub identity of `.github/workflows/publish.yml`.
346
464
 
347
465
  ```bash
348
- # bump version in package.json, commit, then:
349
- git tag skill-land-v1.0.2
350
- git push origin skill-land-v1.0.2
466
+ # bump version in package.json, add a CHANGELOG section, commit, then:
467
+ git tag v1.8.0
468
+ git push origin v1.8.0
351
469
  ```
352
470
 
353
471
  CI runs the tests, refuses to publish a version that already exists, checks the tag matches
354
- `package.json`, and publishes. The tag is package-scoped so other tools in this repo can release
355
- independently.
472
+ `package.json`, publishes, and creates the GitHub release from that version's CHANGELOG section.
356
473
 
357
- ## Adding an agent
474
+ Releases up to 1.7.0 were made from [Magithar/skills](https://github.com/Magithar/skills), where
475
+ skill-land used to live under `tools/skill-land/`.
358
476
 
359
- Edit `agents.json`. `broken: true` marks agents where the upstream CLI misroutes a
360
- global install, which is what drives the warning note.
477
+ ---
361
478
 
362
- ## Scope
479
+ ## Related
363
480
 
364
- Install and verify only. No registry, no publishing, no per-platform content
365
- transforms. One `SKILL.md` works across all of these agents; the failure mode here is
366
- a wrong-path bug, not a content-format problem.
481
+ - [SKILLmama](https://github.com/Magithar/SKILLmama), capability discovery engine: finds and ranks
482
+ the libraries, SDKs and tools for your stack. The skill used in the examples above.
483
+ - [Magithar/skills](https://github.com/Magithar/skills), agent skills installable as a Claude Code
484
+ plugin, including `dep-egress` and `evidence-loop`.
367
485
 
368
486
  ---
369
487
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skill-land",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "description": "Install an agent skill to the directory the agent actually reads, then verify it landed. Exits non-zero if it didn't.",
5
5
  "keywords": [
6
6
  "agent-skills",
@@ -12,14 +12,13 @@
12
12
  "install",
13
13
  "verify"
14
14
  ],
15
- "homepage": "https://github.com/Magithar/skills/tree/main/tools/skill-land",
15
+ "homepage": "https://github.com/Magithar/skill-land#readme",
16
16
  "bugs": {
17
- "url": "https://github.com/Magithar/skills/issues"
17
+ "url": "https://github.com/Magithar/skill-land/issues"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "git+https://github.com/Magithar/skills.git",
22
- "directory": "tools/skill-land"
21
+ "url": "git+https://github.com/Magithar/skill-land.git"
23
22
  },
24
23
  "author": "Magithar",
25
24
  "license": "MIT",
package/skill-land.mjs CHANGED
@@ -12,7 +12,7 @@
12
12
  import { execFileSync } from "child_process";
13
13
  import { createHash } from "crypto";
14
14
  import {
15
- cpSync, existsSync, mkdirSync, mkdtempSync, readdirSync,
15
+ copyFileSync, existsSync, mkdirSync, mkdtempSync, readdirSync,
16
16
  readFileSync, realpathSync, rmSync, statSync, writeFileSync,
17
17
  } from "fs";
18
18
  import { homedir, tmpdir } from "os";
@@ -35,6 +35,7 @@ const TRUECOLOR = /truecolor|24bit/i.test(process.env.COLORTERM || "");
35
35
  const paintIf = (code) => (s) => COLOR ? `\x1b[${code}m${s}\x1b[0m` : s;
36
36
  const emerald = paintIf(TRUECOLOR ? "38;2;89;195;120" : "38;5;78"); // brand emerald #59C378
37
37
  const red = paintIf(TRUECOLOR ? "38;2;239;83;80" : "38;5;203");
38
+ const amber = paintIf(TRUECOLOR ? "38;2;230;170;60" : "38;5;179");
38
39
  const status = (ok) => ok ? emerald("OK ") : red("FAIL");
39
40
  // Paths under the home directory read as ~/..., the way people type them.
40
41
  const tilde = (p) => p === homedir() || p.startsWith(homedir() + "/") ? "~" + p.slice(homedir().length) : p;
@@ -179,17 +180,36 @@ function collectSkillFiles(skillDir, skillFile) {
179
180
  (a === skillFile ? -1 : b === skillFile ? 1 : 0) || a.localeCompare(b));
180
181
  }
181
182
 
183
+ // CRLF is normalised first: a SKILL.md saved on Windows otherwise has no
184
+ // frontmatter at all, and its skill was installed under a placeholder name.
185
+ // YAML quotes are stripped, so `name: "foo"` is foo, not "foo" (-foo- on disk).
182
186
  function parseFrontmatter(text) {
183
- const m = text.match(/^---\n([\s\S]*?)\n---\n/);
187
+ const m = text.replace(/\r\n/g, "\n").match(/^---\n([\s\S]*?)\n---(\n|$)/);
184
188
  if (!m) return {};
185
189
  const fm = {};
186
190
  for (const line of m[1].split("\n")) {
187
191
  const i = line.indexOf(":");
188
- if (i > 0) fm[line.slice(0, i).trim()] = line.slice(i + 1).trim();
192
+ if (i > 0) fm[line.slice(0, i).trim()] = line.slice(i + 1).trim().replace(/^(["'])(.*)\1$/, "$2");
189
193
  }
190
194
  return fm;
191
195
  }
192
196
 
197
+ // The directory name a skill installs under. Without a frontmatter name this
198
+ // used to be the literal "skill" for every one, so --all wrote several skills
199
+ // into one directory, each over the last, and reported all of them OK. Fall
200
+ // back to the folder the skill lives in, which is what it is called on disk.
201
+ function skillNameOf(skillPath, root) {
202
+ const fm = parseFrontmatter(readFileSync(skillPath, "utf-8"));
203
+ const dir = dirname(skillPath);
204
+ // At the source root the folder is a temp clone; use what the source is called.
205
+ const folder = dir !== root ? basename(dir)
206
+ : src.kind === "repo" ? src.label.split("/")[1]
207
+ : src.kind === "dir" ? basename(src.dir) : "";
208
+ const name = (fm.name || folder || "skill").toLowerCase()
209
+ .replace(/[^a-z0-9._-]+/g, "-").replace(/^[-.]+|-+$/g, "");
210
+ return name || "skill";
211
+ }
212
+
193
213
  // ---------------------------------------------------------------- security
194
214
 
195
215
  // A skill is instructions an agent executes with full permissions, so the one
@@ -324,7 +344,10 @@ function verify(target, expected) {
324
344
  // it read 25266 for a 25546-byte file and would pass two different files
325
345
  // that happened to share a character count.
326
346
  const raw = readFileSync(target);
327
- ok("non-empty", raw.length > 0, `${raw.length} bytes`);
347
+ // Empty only fails when the source was not empty. A skill may ship an empty
348
+ // file on purpose (scripts/__init__.py in anthropics/skills), and calling
349
+ // that a failed install blocked every skill that has one.
350
+ ok("non-empty", raw.length > 0 || expected.bytes === 0, `${raw.length} bytes`);
328
351
  const gotHash = sha256(raw);
329
352
  ok("content matches source", gotHash === expected.hash,
330
353
  `${raw.length} bytes sha ${gotHash.slice(0, 12)} vs ${expected.bytes} bytes sha ${expected.hash.slice(0, 12)}`);
@@ -339,6 +362,26 @@ function verify(target, expected) {
339
362
  return checks;
340
363
  }
341
364
 
365
+ // Reading back the source's files cannot see a file the source no longer has:
366
+ // reinstalling copies over the top and never deletes, so a script dropped from a
367
+ // skill stays on disk and the install still reads as verified.
368
+ //
369
+ // A warning, not a failure, and never a delete: an installed directory can hold
370
+ // files a person or the agent added, and nothing here can tell those from stale
371
+ // ones. A raw .md source knows only SKILL.md, so it cannot judge the rest at all.
372
+ function findLeftovers(destDir, files) {
373
+ if (src.kind === "raw") return [];
374
+ const known = new Set(files.map((f) => f.rel));
375
+ return collectSkillFiles(destDir, "SKILL.md").filter((rel) => !known.has(rel));
376
+ }
377
+
378
+ // Names the files as well as the count: a warning you have to re-run to act on
379
+ // is not much of a warning.
380
+ function leftoverLine(destDir, extras) {
381
+ const more = extras.length > 3 ? ` +${extras.length - 3} more` : "";
382
+ return `${tilde(destDir)} ${extras.length} leftover file${extras.length === 1 ? "" : "s"} not in the source: ${extras.slice(0, 3).join(", ")}${more}`;
383
+ }
384
+
342
385
  // ---------------------------------------------------------------- per skill
343
386
 
344
387
  // One skill, every target path: scan, disclose, write, read back. Factored out
@@ -352,14 +395,41 @@ function runSkill(skillPath, root, quiet) {
352
395
  let skillSkipped = false;
353
396
  const body = readFileSync(skillPath, "utf-8");
354
397
  const fm = parseFrontmatter(body);
355
- const skillName = (fm.name || "skill").toLowerCase().replace(/[^a-z0-9._-]+/g, "-");
398
+ const skillName = skillNameOf(skillPath, root);
356
399
  const rawBody = readFileSync(skillPath);
357
400
 
358
401
  // The skill is the directory SKILL.md sits in. `name` is set only on SKILL.md
359
402
  // so the frontmatter check does not run against scripts and reference docs.
360
403
  const skillDir = dirname(skillPath);
361
404
  const skillFile = basename(skillPath);
362
- const files = collectSkillFiles(skillDir, skillFile).map((rel) => {
405
+ const allRels = collectSkillFiles(skillDir, skillFile);
406
+
407
+ // Symlinks are copied as their contents (see copyFileSync below), so a link must
408
+ // resolve inside the source. Copying the link itself left it pointing into the
409
+ // temp clone, deleted on exit, after it had already read back as verified. And
410
+ // a link out of the source, say to ~/.ssh/id_rsa, would place that file where
411
+ // an agent auto-loads it, whether copied as a link or as bytes. Refuse that
412
+ // for cloned repos, which are untrusted. A local path is the user's own disk,
413
+ // and links out of it are normal (the skills CLI installs by symlink), so
414
+ // there a link only has to reach a real file.
415
+ const rootReal = realpathSync(root);
416
+ const confine = src.kind === "repo";
417
+ const badLinks = allRels.filter((rel) => {
418
+ try {
419
+ const real = realpathSync(join(skillDir, rel));
420
+ const inside = real === rootReal || real.startsWith(rootReal + "/");
421
+ return (confine && !inside) || !statSync(real).isFile();
422
+ } catch { return true; } // dangling
423
+ });
424
+ if (badLinks.length) {
425
+ const shown = badLinks.slice(0, 5).join(", ") + (badLinks.length > 5 ? ` +${badLinks.length - 5} more` : "");
426
+ const why = confine ? "points outside the repo, at a directory, or nowhere" : "points at a directory or nowhere";
427
+ if (quiet) console.log(` ${skillName.slice(0, 28).padEnd(30)}${red("FAIL")} symlink ${why}: ${shown}`);
428
+ else console.error(`\n error ${skillName}: symlink ${why}\n ${shown}\n Nothing was written for this skill.\n`);
429
+ return { name: skillName, fmName: fm.name, failed: 1, skipped: false, leftovers: 0 };
430
+ }
431
+
432
+ const files = allRels.map((rel) => {
363
433
  const raw = readFileSync(join(skillDir, rel));
364
434
  return { rel, bytes: raw.length, hash: sha256(raw),
365
435
  name: rel === skillFile ? fm.name : undefined };
@@ -386,7 +456,7 @@ function runSkill(skillPath, root, quiet) {
386
456
  };
387
457
 
388
458
  if (quiet) {
389
- process.stdout.write(` ${(fm.name || basename(dirname(skillPath))).slice(0, 28).padEnd(30)}`);
459
+ process.stdout.write(` ${(fm.name || skillName).slice(0, 28).padEnd(30)}`);
390
460
  } else {
391
461
  console.log(`\n source ${tilde(src.label)}`);
392
462
  console.log(` skill ${fm.name || "(no frontmatter name)"} [${files.length} file${files.length === 1 ? "" : "s"}, ${fmtBytes(totalBytes)}, SKILL.md sha ${files[0].hash.slice(0,12)}]`);
@@ -453,7 +523,9 @@ function runSkill(skillPath, root, quiet) {
453
523
  if (!verifyOnly) {
454
524
  try {
455
525
  mkdirSync(dirname(target), { recursive: true });
456
- cpSync(join(skillDir, f.rel), target);
526
+ // copyFileSync follows links: install the bytes, never a link back into the
527
+ // source. Links were checked above to stay inside it.
528
+ copyFileSync(join(skillDir, f.rel), target);
457
529
  } catch (e) {
458
530
  writeErr = `${e.code || "error"}: ${e.message.split("\n")[0]}`;
459
531
  }
@@ -467,8 +539,9 @@ function runSkill(skillPath, root, quiet) {
467
539
 
468
540
  const absent = badFiles.length === files.length
469
541
  && badFiles.every((b) => b.checks.some((c) => c.name === "file exists" && !c.pass));
470
- baseResults.push({ destDir, badFiles, passed: badFiles.length === 0, absent });
471
- baseSummaries.push({ destDir, passed: badFiles.length === 0, absent,
542
+ const extras = verifyOnly ? findLeftovers(destDir, files) : [];
543
+ baseResults.push({ destDir, badFiles, passed: badFiles.length === 0, absent, extras });
544
+ baseSummaries.push({ destDir, passed: badFiles.length === 0, absent, extras,
472
545
  n: files.length - badFiles.length });
473
546
  }
474
547
 
@@ -488,11 +561,15 @@ function runSkill(skillPath, root, quiet) {
488
561
  if (!quiet) {
489
562
  for (const r of baseResults) {
490
563
  const n = files.length - r.badFiles.length;
564
+ const warnLeftovers = () => {
565
+ if (r.extras.length) console.log(` ${amber("WARN")} ${leftoverLine(r.destDir, r.extras)}`);
566
+ };
491
567
  // Nothing present at all is one fact, not N failures. Listing every
492
568
  // absent file buries the directories that are partially installed,
493
569
  // which are the ones worth looking at.
494
570
  if (r.absent) {
495
571
  console.log(` ${red("FAIL")} ${tilde(r.destDir)} not installed${verifyOnly ? " (verify only)" : ""}`);
572
+ warnLeftovers();
496
573
  continue;
497
574
  }
498
575
  console.log(` ${status(r.passed)} ${tilde(r.destDir)} ${n}/${files.length} file${files.length === 1 ? "" : "s"}${verifyOnly ? " (verify only)" : ""}`);
@@ -501,6 +578,7 @@ function runSkill(skillPath, root, quiet) {
501
578
  for (const c of b.checks) if (!c.pass) console.log(` ${c.name}: ${c.detail}`);
502
579
  }
503
580
  if (r.badFiles.length > 10) console.log(` ... and ${r.badFiles.length - 10} more file(s)`);
581
+ warnLeftovers();
504
582
  }
505
583
  if (verifyOnly && agentPassed && baseResults.some((r) => !r.passed))
506
584
  console.log(` note complete in at least one directory ${a.display} reads; that is an install`);
@@ -524,8 +602,12 @@ function runSkill(skillPath, root, quiet) {
524
602
  for (const b of baseSummaries.filter((x) => !x.passed)) {
525
603
  console.log(` x ${tilde(b.destDir)} ${b.absent ? "not installed" : `${b.n}/${files.length} files`}`);
526
604
  }
605
+ for (const b of baseSummaries.filter((x) => x.extras.length)) {
606
+ console.log(` ! ${leftoverLine(b.destDir, b.extras)}`);
607
+ }
527
608
  }
528
- return { name: skillName, fmName: fm.name, failed: skillFailed, skipped: skillSkipped };
609
+ const leftovers = baseSummaries.reduce((n, b) => n + b.extras.length, 0);
610
+ return { name: skillName, fmName: fm.name, failed: skillFailed, skipped: skillSkipped, leftovers };
529
611
  }
530
612
 
531
613
  // ---------------------------------------------------------------- discover
@@ -683,6 +765,15 @@ if (argv.includes("--list")) {
683
765
  process.exit(0);
684
766
  }
685
767
 
768
+ // An unknown flag is an error, not ignored. `--verfy` meant "check, write
769
+ // nothing" and ran a full install; `--dryrun` would have written too.
770
+ const BOOL_FLAGS = new Set(["--project", "--dry-run", "--verify", "--discover",
771
+ "--skip-security", "--strict", "--all", "--verbose"]);
772
+ for (const a of argv) {
773
+ if (a.startsWith("-") && !BOOL_FLAGS.has(a) && a !== "--for" && a !== "--skill")
774
+ die(`unknown option "${a}"\n see skill-land --help`);
775
+ }
776
+
686
777
  const flag = (n) => argv.includes(n);
687
778
  const values = (n) => argv.reduce((acc, a, i) =>
688
779
  a === n && argv[i + 1] ? acc.concat(argv[i + 1].split(",")) : acc, []);
@@ -713,6 +804,7 @@ if (allSkills && values("--skill").length)
713
804
  const src = resolveSource(source);
714
805
  const tmp = mkdtempSync(join(tmpdir(), "skill-install-"));
715
806
  let failed = 0;
807
+ let leftovers = 0;
716
808
  const skipped = [];
717
809
  const landed = [];
718
810
 
@@ -722,12 +814,27 @@ try {
722
814
 
723
815
  // With --all the per-skill detail becomes a wall nobody reads, and an unread
724
816
  // report verifies nothing. Collapse to one line each unless asked otherwise.
817
+ // Two skills that install under one directory name would overwrite each other
818
+ // and both read back as verified (each check runs right after its own write).
819
+ // Refuse before writing anything.
820
+ const byName = new Map();
821
+ for (const p of skillPaths) {
822
+ const n = skillNameOf(p, root);
823
+ byName.set(n, [...(byName.get(n) || []), p]);
824
+ }
825
+ const clashes = [...byName].filter(([, ps]) => ps.length > 1);
826
+ if (clashes.length)
827
+ die(`${clashes.length} install name(s) shared by more than one skill; they would overwrite each other:\n` +
828
+ clashes.map(([n, ps]) => ` ${n} ${ps.map((p) => p.replace(root, ".")).join(", ")}`).join("\n") +
829
+ `\n Give each a distinct frontmatter name, or install them one by one with --skill.`);
830
+
725
831
  const quiet = allSkills && !verbose;
726
832
  if (quiet) console.log(`\n source ${src.label}\n skills ${skillPaths.length} found`);
727
833
 
728
834
  for (const skillPath of skillPaths) {
729
835
  const r = runSkill(skillPath, root, quiet);
730
836
  failed += r.failed;
837
+ leftovers += r.leftovers || 0;
731
838
  if (r.skipped) skipped.push(r.name);
732
839
  else if (!r.failed) landed.push(r.fmName || r.name);
733
840
  }
@@ -753,8 +860,19 @@ if (discoverFlag && !dryRun) {
753
860
  }
754
861
  }
755
862
 
756
- if (failed) {
757
- console.error(` ${red(`✗ ${failed} install(s) failed verification`)}\n`);
863
+ // Printed before the verdict so a green "verified" is not the last word on a
864
+ // directory that holds more than the source does.
865
+ if (leftovers) {
866
+ console.log(` ${amber("warn")} ${leftovers} leftover file${leftovers === 1 ? "" : "s"} not in the source. They may be stale, or added by you or the agent.`);
867
+ console.log(` The agent can still read them. Nothing was removed; review and delete by hand.\n`);
868
+ }
869
+
870
+ // A skill --strict refused was not installed, so the run did not do what was
871
+ // asked. It used to print "verified" and exit 0, which a CI gate reads as pass.
872
+ if (failed || skipped.length) {
873
+ if (failed) console.error(` ${red(`✗ ${failed} install(s) failed verification`)}`);
874
+ if (skipped.length) console.error(` ${red(`✗ ${skipped.length} skill(s) not installed: refused by --strict`)} ${skipped.join(", ")}`);
875
+ console.error("");
758
876
  process.exit(1);
759
877
  }
760
878
  // Close on the outcome in plain words: what is ready, and for which agent.