skillshop 2.1.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Skillshop
2
2
 
3
- Skillshop installs and manages agent skills. Its CLI includes a bundled skill registry, with the same named install, update, and agent configuration commands as the earlier `skillz` CLI. It also lets project owners export skills from their own npm packages. A skill is a directory containing `SKILL.md` and any supporting files.
3
+ Skillshop installs and manages agent skills. For user-authored skills, a plain folder library is the source of truth. Download individual skills from GitHub, install them into project or global destinations, and sync later source edits across recorded copies. The bundled registry and npm package-library APIs remain available for compatibility. A skill is a directory containing `SKILL.md` and any supporting files.
4
4
 
5
5
  The command is `skillshop`; `sk` runs the same CLI. The previous `skillz` command is no longer an executable alias. Existing `.skillz-lock` and `~/.skillz` state remain readable.
6
6
 
@@ -13,28 +13,43 @@ npm install --global skillshop
13
13
  skillshop init
14
14
  ```
15
15
 
16
- `init` asks which agents you use and saves their destinations in `~/.skillshop/config.json`. Change the selection later with `skillshop config agents`. Codex and OpenCode use `.agents/skills` inside projects and `~/.agents/skills` for user-level installs. Copilot and Claude use their own skill directories. Shared destinations get one copy.
16
+ `skillshop init` asks which agents you use and saves their destinations in `~/.skillshop/config.json`. It is optional for project skill installs: without saved agent selection, Skillshop uses the nearest existing `.agents`, `.github`, or `.codex` directory and falls back to project-root `.agents/skills`. Run `skillshop init` to choose system-wide defaults; change that selection later with `skillshop config agents`. Codex and OpenCode use `.agents/skills` inside projects and `~/.agents/skills` for user-level installs. Copilot and Claude use their own skill directories. Shared destinations get one copy.
17
17
 
18
- ### Install a named skill
19
-
20
- List the skills bundled with Skillshop, then install one:
18
+ ### Use a personal folder library
21
19
 
22
20
  ```bash
23
- skillshop list
24
- skillshop one-shot
25
- # Equivalent: skillshop install one-shot
21
+ skillshop library init # selects ~/skillshop-library
22
+ skillshop library init ./my-skills # selects or adopts an existing folder
23
+ skillshop library list
24
+ skillshop download @alice/review # adds source only
25
+ skillshop install @alice/review # downloads if absent, then installs locally
26
+ skillshop install @alice/review --global
27
+ skillshop install review # installs an existing selected source
28
+ skillshop sync # updates all recorded project and global copies
26
29
  ```
27
30
 
28
- Run a project install inside a Git repository. Skillshop copies the skill into each configured project destination and records managed copies in `.skillshop-lock`. It also installs the `skillshop` guidance skill. The lockfile and managed skill directories go into the repository's local Git exclude file, leaving unrelated skill directories alone.
31
+ `library init` can create a missing folder or select an existing library. It preserves existing skill directories and config; no `package.json`, npm metadata, or version field is required. Without an explicit directory it selects the visible `~/skillshop-library` folder. The library config is `skillshop-library.json`; the default source directory is `skills/`. A skill can contain any regular files and nested folders, including hidden references and executable scripts.
32
+
33
+ `download @owner/skill` reads `https://github.com/owner/skillshop-library.git` and copies only `skills/skill` into the selected personal library. The `@` marks a remote owner/skill reference; it is not part of the GitHub owner or repository URL. Download does not install the skill. `install @owner/skill` downloads when that source is absent, then installs from the library. If the same repository source is already present, local edits are reused without an upstream fetch. `install name` installs a matching skill from the selected library. Once a library is selected, named installs and `skillshop list` use that library; they do not fall back to bundled skills or add bundled guidance. Add `--global` to install into configured user directories. Unprefixed `owner/skill` inputs are rejected; use `@owner/skill` for remote references.
34
+
35
+ `download @owner/skill --force` explicitly replaces the personal source directory after validation. A same-name authored or different-source skill otherwise fails safely. `skillshop sync` copies the current full directory from each recorded personal source to its Skillshop-managed project and global copies. It includes file additions, edits, removals, hidden files, binary contents, and modes; stale extras inside those owned copies are removed. Sync never fetches GitHub and changing the selected library does not redirect existing copies.
29
36
 
30
- To install a named skill for your user account instead:
37
+ `sync` is also the explicit migration step for older tracked bundled installs. `library init` does not migrate them. If a selected library already has a skill, that source wins and tracked bundle copies are synchronized from it. Otherwise, Skillshop imports a missing source only when every surviving tracked project and global copy agrees across full paths, bytes, and modes. Divergent copies and unreadable ownership state are reported. Unknown source kinds, unmanaged directories, and imported snapshots are left untouched; if they prevent a complete consensus decision, sync reports that conflict. Missing recorded destinations are pruned, never recreated. Keep durable edits in the personal source; sync intentionally replaces local edits inside an owned installed copy.
38
+
39
+ ### Install a bundled registry skill (compatibility mode)
40
+
41
+ When no personal library is selected, the bundled registry remains available:
31
42
 
32
43
  ```bash
44
+ skillshop list
45
+ skillshop one-shot
46
+ # Equivalent: skillshop install one-shot
33
47
  skillshop one-shot --global
34
- # Equivalent: sk install one-shot --global
35
48
  ```
36
49
 
37
- For Codex or OpenCode, this writes `~/.agents/skills/one-shot`. A global install replaces an existing skill directory with that name, including local edits and extra files. Global installs use `~/.skillshop/global-skills.json` for bookkeeping. Each CLI run reconciles recorded installations; it does not install the entire bundled registry.
50
+ Run project installs inside a Git repository. Skillshop records copies in `.skillshop-lock` and adds only its managed paths to the repository's local Git exclude file. In this compatibility mode it also installs bundled `skillshop` guidance. A global bundled install writes `~/.skillshop/global-skills.json`; for Codex or OpenCode it targets `~/.agents/skills`.
51
+
52
+ In bundled compatibility mode, most ordinary commands reconcile recorded bundled installations. When a personal library is selected, `list` and named installs join library, download, qualified install, sync, upgrade, and agent instruction commands in bypassing that legacy reconciliation. Upgrade refreshes changed-version bundled copies from the newly installed package in a fresh process. Same-version bundled copies keep local edits; a changed-version replacement overwrites edits in that managed copy. To keep durable local changes, initialize a personal library, use `skillshop sync` to adopt tracked bundled copies where their contents agree, edit the library source, then sync it to owned copies. Personal-library copies are excluded from bundled refresh.
38
53
 
39
54
  ### Update or remove skills
40
55
 
@@ -46,236 +61,138 @@ skillshop uninstall one-shot
46
61
  skillshop uninstall one-shot --global
47
62
  ```
48
63
 
49
- `update` replaces skills managed in the current project's lockfile. `update --push` updates registered projects. Neither command updates global copies; reinstall a global skill by name with `--global`. Project uninstall removes only a skill recorded in `.skillshop-lock`. Global uninstall removes the named skill from configured user directories.
64
+ `update` refreshes skills managed in the current project's lockfile from their recorded source. `update --push` updates registered projects. Use `skillshop sync` to propagate personal-library changes to recorded local and global copies. Project uninstall removes only a skill recorded in `.skillshop-lock`. Global uninstall removes the named skill from configured user directories.
50
65
 
51
- An exact version such as `skillshop one-shot@2026.8.21` checks the currently bundled version. It does not fetch a historical release. Use `skillshop migrate` to discover older lockfiles and register their repositories.
52
-
53
- ### Manage agent instructions
54
-
55
- ```bash
56
- skillshop agents
57
- skillshop agents --global
58
- ```
59
-
60
- The local command updates a managed block in the nearest existing `AGENTS.md`. The global command updates the supported user instruction files. Sibling `*.block.md` fragments are composed in filename order. Text outside Skillshop's managed blocks is preserved.
61
-
62
- ### Use skills from another package
63
-
64
- A distributor can declare which exported skills a global npm install should place in your user skill directory:
66
+ ### Upgrade Skillshop
65
67
 
66
68
  ```bash
67
- npm install --global @example/skill-library
69
+ skillshop upgrade
68
70
  ```
69
71
 
70
- Those declared skills are copied during the package's install script. This package installer targets `~/.agents/skills` by default, independently of the agents selected with `skillshop init`. Updating the package replaces the same named user skills. If scripts are disabled, run `skillshop install-user /path/to/installed-package` manually.
72
+ The command upgrades the npm installation that supplied the invoked CLI. A project-local installation updates Skillshop in the owning npm project and preserves the dependency section where it is already declared. It refreshes only that project's recorded Skillshop-managed skill copies. A global installation updates its npm prefix, then refreshes recorded global copies and copies in registered projects; it does not update those projects' package manifests. Running from a source checkout keeps the historical global-install behavior and does not edit the checkout's package manifest.
71
73
 
72
- To copy one exported skill into a project instead:
74
+ After npm succeeds, the newly installed CLI runs in a fresh process and refreshes only existing copies recorded in `.skillshop-lock` or `~/.skillshop/global-skills.json` whose bundled skill version changed. Same-version copies retain local edits. A changed-version replacement overwrites local edits in that managed copy. For durable local changes, initialize a personal library, explicitly sync to adopt tracked bundled copies when their surviving copies agree, then edit the library source and sync. Deleted paths are pruned from ownership records instead of recreated. Unmanaged directories and package-import snapshots are not adopted. An npm install failure stops before copy refresh; a later refresh failure reports that Skillshop was upgraded and gives a nonzero result with the partial-refresh summary.
73
75
 
74
- ```bash
75
- npm install @example/skill-library skillshop
76
- npx skillshop import @example/skill-library:review
77
- ```
76
+ `skillshop init` is optional. It configures agent destinations and is not required to upgrade Skillshop. The upgrade command never initializes, renders, or rewrites project `AGENTS.md` files or instruction templates.
78
77
 
79
- The `library:skill` argument names an installed package and one skill it exports. The command copies the skill to `.agents/skills/review` in the current project. Use `--to` for another destination or `--global` to copy it to `~/.agents/skills/review`. This is a snapshot. Reimport with `--force` to replace an existing project copy. `skillshop resolve @example/skill-library:review` reports its source location without copying it.
80
-
81
- ### Example: one user, two scopes
78
+ An exact version such as `skillshop one-shot@2026.8.21` checks the currently bundled version. It does not fetch a historical release. Use `skillshop migrate` to discover older lockfiles and register their repositories.
82
79
 
83
- Suppose you use Codex and work in `~/work/sample-app`, which is already a Git repository. Select Codex when `skillshop init` prompts, then install one bundled skill for every project and another only for this app:
80
+ ### Manage agent instructions
84
81
 
85
82
  ```bash
86
- skillshop init
87
- skillshop one-shot --global
88
- cd ~/work/sample-app
89
- skillshop changelog
90
- ```
91
-
92
- The global command writes `~/.agents/skills/one-shot/SKILL.md`. The project command writes `.agents/skills/changelog/SKILL.md` and `.agents/skills/skillshop/SKILL.md` inside `sample-app`, then records both managed skills in `.skillshop-lock`. It does not copy `one-shot` into the project. Running `skillshop update` in `sample-app` refreshes the locked project skills; run `skillshop one-shot --global` again to replace the global copy.
93
-
94
- Package imports are separate from this lockfile workflow. `import` copies a snapshot from another package; `skillshop update` does not refresh that snapshot. `export` names a skill for consumers of a package and does not install it anywhere.
95
-
96
- ## For project owners: distribute skills
97
-
98
- ### 1. Export the skills
99
-
100
- In an npm package, put each skill in a directory with a `SKILL.md`. For example:
101
-
102
- ```text
103
- my-library/
104
- package.json
105
- .agents/skills/review/SKILL.md
106
- .agents/skills/triage/SKILL.md
107
- ```
108
-
109
- For example, `.agents/skills/review/SKILL.md` could contain:
110
-
111
- ```markdown
112
- ---
113
- name: review
114
- description: Review a proposed code change
115
- ---
116
-
117
- # Review
118
-
119
- Read the diff, identify concrete defects, and cite the affected files.
83
+ skillshop agents
84
+ skillshop agents init
85
+ skillshop agents --check
86
+ skillshop agents --global
120
87
  ```
121
88
 
122
- Keep any references or scripts needed by the skill beside its `SKILL.md`; Skillshop copies the whole directory.
89
+ There are two local modes. Plain `skillshop agents` keeps the bounded legacy behavior for an uninitialized project: it updates the nearest existing `AGENTS.md` within the selected boundary, or creates one at the boundary root if none exists. After project sources are initialized, plain `skillshop agents` renders them instead. The global command remains separate and updates the supported user instruction files.
123
90
 
124
- Add Skillshop, initialize the export list, and name the skill you want to publish:
125
-
126
- ```bash
127
- npm install skillshop
128
- npx skillshop library init
129
- npx skillshop export skill:review ./.agents/skills/review
130
- npx skillshop export skill:triage ./.agents/skills/triage
131
- ```
91
+ Initialize project-owned instructions with `skillshop agents init`. The neutral starter template is `.agents/instructions/AGENTS.template.md`; put source blocks beside it as `*.block.md`. Skillshop renders these sources into a distinct managed region in the project-root `AGENTS.md`. Existing user text and prior Skillshop managed guidance are preserved. Edit the template and source blocks, not the generated region. Repeated `skillshop agents init` leaves existing sources alone. If an initialized project's template is removed, `skillshop agents` reports an error rather than restoring bundled personal guidance. Symlinked source, template, block, or output path components are rejected, including dangling links.
132
92
 
133
- This writes `skillshop.library.json`:
93
+ The default boundary is the nearest Git repository or worktree root. Outside Git, the current working directory is the boundary. Use `--project <directory>` to choose another boundary; a relative path is resolved from the command's current directory. This is required when a nested project inside a larger repository should own its own output. Put all three explicit-boundary scripts in `packages/app/package.json` so init, rendering, and checking stay in that package:
134
94
 
135
95
  ```json
136
96
  {
137
- "schemaVersion": 1,
138
- "exports": {
139
- "skill:review": "./.agents/skills/review",
140
- "skill:triage": "./.agents/skills/triage"
97
+ "scripts": {
98
+ "agents": "skillshop agents --project .",
99
+ "agents:init": "skillshop agents init --project .",
100
+ "agents:check": "skillshop agents --check --project ."
141
101
  }
142
102
  }
143
103
  ```
144
104
 
145
- The `exports` map is an explicit allowlist. Skillshop does not scan your repository for other skills. `skillshop export` also builds the library; run `skillshop build` after editing the JSON by hand. The build generates `skillshop.manifest.mjs`, adds the package's `./skillshop` export, and includes declared local skill directories in `package.json#files` when that field exists. Commit the resulting package files with your source.
146
-
147
- ### 2. Declare user-level installation, if needed
105
+ For a local project dependency, add Skillshop as a development dependency and opt into rendering through explicit scripts:
148
106
 
149
- To copy selected skills during a global npm install, add `skillshop.userInstall` and the generic lifecycle command to the distributor's `package.json`:
107
+ ```bash
108
+ npm install --save-dev skillshop
109
+ ```
150
110
 
151
111
  ```json
152
112
  {
153
- "name": "@example/skill-library",
154
- "version": "1.0.0",
155
- "dependencies": {
156
- "skillshop": "^2.1.0"
157
- },
158
- "files": [],
159
113
  "scripts": {
160
- "prepack": "skillshop build",
161
- "postinstall": "skillshop install-user . --if-global"
162
- },
163
- "skillshop": {
164
- "userInstall": ["skill:review"]
114
+ "agents": "skillshop agents",
115
+ "agents:init": "skillshop agents init",
116
+ "agents:check": "skillshop agents --check"
165
117
  }
166
118
  }
167
119
  ```
168
120
 
169
- Every `userInstall` entry must be unique and appear in `skillshop.library.json`. In this example, `skill:review` installs for the user on a global npm install. `skill:triage` remains available for explicit project imports. The runtime dependency makes the `skillshop` command available to npm's `postinstall` script. `--if-global` skips the user copy on a project-local install. npm's `--ignore-scripts` skips `postinstall` entirely.
121
+ Run `npm run agents:init` once, edit the project sources, then run `npm run agents`. `npm run agents:check` exits successfully when the generated region in the working tree matches the current sources; it does not inspect Git's index or commit. CI can run `npm ci` followed by `npm run agents:check`. Commit the npm manifest and lockfile, `.agents/instructions/AGENTS.template.md`, its source blocks, and the rendered root `AGENTS.md`. There is no install hook: initialization and rendering happen only when the scripts are run.
170
122
 
171
- An install replaces each declared destination directory. If a later release removes a name from `userInstall`, Skillshop does not delete a copy previously installed in a user's directory.
123
+ Project and bundled source templates support explicit includes:
172
124
 
173
- ### 3. Check and pack the package
125
+ ```markdown
126
+ {{ include "020_testing.block.md" }}
174
127
 
175
- ```bash
176
- npx skillshop library list
177
- npx skillshop validate
178
- npx skillshop build
179
- npm pack --dry-run
128
+ {{ blocks }}
180
129
  ```
181
130
 
182
- Check that the npm package contains `skillshop.manifest.mjs`, every exported `SKILL.md`, and any assets those skills need. The export list controls what Skillshop can resolve; it does not prevent your own broad `files` patterns from publishing other files. A real `npm pack` and global install from its tarball are useful checks before a release.
131
+ Use `{{ include "020_testing.block.md" }}` or `{{ include '020_testing.block.md' }}` for named blocks. The older `{{ fragments["020_testing.block.md"] }}` and single-quoted lookup forms remain supported. `{{ blocks }}` inserts the remaining fragments in filename order, excluding every explicitly included file even when its include appears later in the template. Repeated includes render at each position. Fragment contents are inserted literally; placeholder-looking text inside a block is not evaluated recursively. Invalid expressions and missing fragments fail before generated output is written.
183
132
 
184
- After checking the tarball, publish the package with `npm publish`. Use `npm publish --access public` for a public scoped package.
133
+ These expressions apply to source templates only. Skillshop does not interpret them in destination instruction files or sibling fragments.
185
134
 
186
- ### Example: what happens after publication
135
+ ### Use skills from another package
187
136
 
188
- With the two-skill package above published as `@example/skill-library`, a global install copies only the declared `skill:review` to the user's skill directory:
137
+ A distributor can declare which exported skills a global npm install should place in your user skill directory:
189
138
 
190
139
  ```bash
191
140
  npm install --global @example/skill-library
192
- # ~/.agents/skills/review/SKILL.md now comes from the package
193
141
  ```
194
142
 
195
- An application that needs `skill:triage` can install the package locally and copy that exported skill into its own repository:
143
+ Those declared skills are copied during the package's install script. This package installer targets `~/.agents/skills` by default, independently of the agents selected with `skillshop init`. Updating the package replaces the same named user skills. If scripts are disabled, run `skillshop install-user /path/to/installed-package` manually.
144
+
145
+ To copy one exported skill into a project instead:
196
146
 
197
147
  ```bash
198
- cd ~/work/sample-app
199
148
  npm install @example/skill-library skillshop
200
- npx skillshop import @example/skill-library:triage
149
+ npx skillshop import @example/skill-library:review
201
150
  ```
202
151
 
203
- After the distributor publishes an update, reinstalling the package globally replaces the user's `review` directory. The application's `triage` snapshot stays as it was until the application updates the package and imports again with `--force`. The two installation paths are independent.
152
+ The `library:skill` argument names an installed package and one skill it exports. The command copies the skill to `.agents/skills/review` in the current project. Use `--to` for another destination or `--global` to copy it to `~/.agents/skills/review`. This is a snapshot. Reimport with `--force` to replace an existing project copy. `skillshop resolve @example/skill-library:review` reports its source location without copying it.
204
153
 
205
- ### Re-export a skill from another library
154
+ ### Example: one user, two scopes
206
155
 
207
- A package can expose a selected upstream skill under its own name:
156
+ Suppose you use Codex and work in `~/work/sample-app`, which is already a Git repository. Select Codex when `skillshop init` prompts, then install one bundled skill for every project and another only for this app:
208
157
 
209
158
  ```bash
210
- npm install @example/upstream
211
- npx skillshop export skill:review --from @example/upstream --skill skill:review
159
+ skillshop init
160
+ skillshop one-shot --global
161
+ cd ~/work/sample-app
162
+ skillshop changelog
212
163
  ```
213
164
 
214
- The resulting export in `skillshop.library.json` is:
165
+ The global command writes `~/.agents/skills/one-shot/SKILL.md`. The project command writes `.agents/skills/changelog/SKILL.md` and `.agents/skills/skillshop/SKILL.md` inside `sample-app`, then records both managed skills in `.skillshop-lock`. It does not copy `one-shot` into the project. Running `skillshop update` in `sample-app` refreshes the locked project skills; run `skillshop one-shot --global` again to replace the global copy.
215
166
 
216
- ```json
217
- {
218
- "skill:review": {
219
- "from": "@example/upstream",
220
- "skill": "skill:review"
221
- }
222
- }
223
- ```
167
+ Package imports are separate from this lockfile workflow. `import` copies a snapshot from another package; `skillshop update` does not refresh that snapshot. `export` names a skill for consumers of a package and does not install it anywhere.
168
+
169
+ ## For project owners: distribute skills
224
170
 
225
- That object is one entry inside the manifest's `exports` map. The upstream package must be a runtime dependency or a non-optional peer dependency. Re-exporting is explicit; depending on another library does not expose all of its skills.
171
+ ### Personal skills: share a folder through GitHub
226
172
 
227
- ## CLI and JavaScript API
173
+ The recommended authoring format is a normal folder. Fork the bundled template at [`templates/skillshop-library`](templates/skillshop-library) or create the same layout in a GitHub repository named `skillshop-library`:
228
174
 
229
175
  ```text
230
- skillshop init
231
- skillshop config agents
232
- skillshop list
233
- skillshop <name> [--global]
234
- skillshop install <name> [--global]
235
- skillshop update [name]
236
- skillshop update --push
237
- skillshop uninstall <name> [--global]
238
- skillshop agents [--global]
239
- skillshop migrate [root ...]
240
- skillshop library init
241
- skillshop library list
242
- skillshop export skill:<name> <directory>
243
- skillshop export skill:<name> --from <package> [--skill skill:<source-name>]
244
- skillshop unexport skill:<name>
245
- skillshop validate
246
- skillshop build
247
- skillshop resolve <library>:<skill>
248
- skillshop import <library>:<skill> [--global] [--to <directory>] [--force]
249
- skillshop install-user [package-dir] [--if-global] [--to <skills-dir>]
176
+ skillshop-library/
177
+ skillshop-library.json
178
+ skills/
179
+ review/
180
+ SKILL.md
181
+ references/
182
+ scripts/
250
183
  ```
251
184
 
252
- `init` and `list` keep their bundled-registry meanings. `library init`, `library list`, `validate`, and `build` operate on the package library in the current directory. In a `library:skill` reference, `library` can be an installed package name or a local package directory. `import` defaults to `.agents/skills/<skill>`; `--global` replaces `~/.agents/skills/<skill>`. `unexport` changes the package's public skill list; it does not delete the source directory. Remove a skill from `userInstall` before unexporting it.
185
+ The config declares the relative source directory. Each skill needs a standard `SKILL.md` with `name` and `description`; author/version metadata is optional. Put references, scripts, and other assets beside it. Skillshop downloads the complete directory and preserves executable modes.
253
186
 
254
- Applications can use the same operations without invoking the CLI:
255
-
256
- ```js
257
- import { exportSkill, reexportSkill, buildSkillLibrary } from 'skillshop/export';
258
- import { resolveSkill, importSkill } from 'skillshop/import';
259
- import { installDeclaredUserSkills } from 'skillshop/user-install';
187
+ ```bash
188
+ skillshop download @alice/review
189
+ skillshop install @alice/review
190
+ skillshop install @alice/review --global
191
+ skillshop sync
260
192
  ```
261
193
 
262
- For example, an application can read an exported skill directly from an installed package, or copy it into a workspace it manages:
263
-
264
- ```js
265
- import { readFile } from 'node:fs/promises';
266
- import { resolveSkill, importSkill } from 'skillshop/import';
267
-
268
- const reference = '@example/skill-library:triage';
269
- const { manifestPath } = await resolveSkill({ reference });
270
- const instructions = await readFile(manifestPath, 'utf8');
271
- // Pass instructions to your agent runtime.
272
-
273
- await importSkill({
274
- reference,
275
- overwrite: true,
276
- });
277
- ```
194
+ `download @owner/skill` adds a source to the personal folder library without installing it. `install @owner/skill` downloads if needed and installs from that source; subsequent local edits are reused. `install name` uses a bare name for an existing library source. `sync` updates recorded local and global copies from the saved source roots. It never fetches upstream. See [the forkable library template](templates/skillshop-library/README.md) for its full layout and command details.
278
195
 
279
- `resolveSkill` leaves the skill inside the installed package. `importSkill` copies its complete directory, including files alongside `SKILL.md`. Set `overwrite: true` only when the application intends to replace an existing destination.
196
+ ### Existing package API compatibility
280
197
 
281
- `importSkill({ overwrite: true })` replaces a destination. Its optional `merge: true` mode overlays packaged files and preserves unrelated destination files. User-level installation always uses replacement, even when called through `installDeclaredUserSkills`.
198
+ The published npm export/import APIs remain supported for existing consumers. Their authoring, lifecycle, and JavaScript API guide is in [Package library compatibility](docs/package-library-compatibility.md). New user-authored libraries can use the folder and GitHub workflow above without npm packaging.
@@ -0,0 +1,194 @@
1
+ # Package library compatibility
2
+
3
+ This guide documents the existing npm package export/import APIs. It is retained for consumers of those published APIs. It is not required for personal folder libraries or GitHub skill sharing.
4
+
5
+ ### Package API compatibility: export skills from npm packages
6
+
7
+ The npm export/import API remains supported for existing package-based libraries. It is not required for personal skill authoring.
8
+
9
+ #### 1. Export the skills
10
+
11
+ In an npm package, put each skill in a directory with a `SKILL.md`. For example:
12
+
13
+ ```text
14
+ my-library/
15
+ package.json
16
+ .agents/skills/review/SKILL.md
17
+ .agents/skills/triage/SKILL.md
18
+ ```
19
+
20
+ For example, `.agents/skills/review/SKILL.md` could contain:
21
+
22
+ ```markdown
23
+ ---
24
+ name: review
25
+ description: Review a proposed code change
26
+ ---
27
+
28
+ # Review
29
+
30
+ Read the diff, identify concrete defects, and cite the affected files.
31
+ ```
32
+
33
+ Keep any references or scripts needed by the skill beside its `SKILL.md`; Skillshop copies the whole directory.
34
+
35
+ Add Skillshop, initialize the export list, and name the skill you want to publish:
36
+
37
+ ```bash
38
+ npm install skillshop
39
+ npx skillshop library init
40
+ npx skillshop export skill:review ./.agents/skills/review
41
+ npx skillshop export skill:triage ./.agents/skills/triage
42
+ ```
43
+
44
+ This writes `skillshop.library.json`:
45
+
46
+ ```json
47
+ {
48
+ "schemaVersion": 1,
49
+ "exports": {
50
+ "skill:review": "./.agents/skills/review",
51
+ "skill:triage": "./.agents/skills/triage"
52
+ }
53
+ }
54
+ ```
55
+
56
+ The `exports` map is an explicit allowlist. Skillshop does not scan your repository for other skills. `skillshop export` also builds the library; run `skillshop build` after editing the JSON by hand. The build generates `skillshop.manifest.mjs`, adds the package's `./skillshop` export, and includes declared local skill directories in `package.json#files` when that field exists. Commit the resulting package files with your source.
57
+
58
+ ### 2. Declare user-level installation, if needed
59
+
60
+ To copy selected skills during a global npm install, add `skillshop.userInstall` and the generic lifecycle command to the distributor's `package.json`:
61
+
62
+ ```json
63
+ {
64
+ "name": "@example/skill-library",
65
+ "version": "1.0.0",
66
+ "dependencies": {
67
+ "skillshop": "^2.1.0"
68
+ },
69
+ "files": [],
70
+ "scripts": {
71
+ "prepack": "skillshop build",
72
+ "postinstall": "skillshop install-user . --if-global"
73
+ },
74
+ "skillshop": {
75
+ "userInstall": ["skill:review"]
76
+ }
77
+ }
78
+ ```
79
+
80
+ Every `userInstall` entry must be unique and appear in `skillshop.library.json`. In this example, `skill:review` installs for the user on a global npm install. `skill:triage` remains available for explicit project imports. The runtime dependency makes the `skillshop` command available to npm's `postinstall` script. `--if-global` skips the user copy on a project-local install. npm's `--ignore-scripts` skips `postinstall` entirely.
81
+
82
+ An install replaces each declared destination directory. If a later release removes a name from `userInstall`, Skillshop does not delete a copy previously installed in a user's directory.
83
+
84
+ ### 3. Check and pack the package
85
+
86
+ ```bash
87
+ npx skillshop library list
88
+ npx skillshop validate
89
+ npx skillshop build
90
+ npm pack --dry-run
91
+ ```
92
+
93
+ Check that the npm package contains `skillshop.manifest.mjs`, every exported `SKILL.md`, and any assets those skills need. The export list controls what Skillshop can resolve; it does not prevent your own broad `files` patterns from publishing other files. A real `npm pack` and global install from its tarball are useful checks before a release.
94
+
95
+ After checking the tarball, publish the package with `npm publish`. Use `npm publish --access public` for a public scoped package.
96
+
97
+ ### Example: what happens after publication
98
+
99
+ With the two-skill package above published as `@example/skill-library`, a global install copies only the declared `skill:review` to the user's skill directory:
100
+
101
+ ```bash
102
+ npm install --global @example/skill-library
103
+ # ~/.agents/skills/review/SKILL.md now comes from the package
104
+ ```
105
+
106
+ An application that needs `skill:triage` can install the package locally and copy that exported skill into its own repository:
107
+
108
+ ```bash
109
+ cd ~/work/sample-app
110
+ npm install @example/skill-library skillshop
111
+ npx skillshop import @example/skill-library:triage
112
+ ```
113
+
114
+ After the distributor publishes an update, reinstalling the package globally replaces the user's `review` directory. The application's `triage` snapshot stays as it was until the application updates the package and imports again with `--force`. The two installation paths are independent.
115
+
116
+ ### Re-export a skill from another library
117
+
118
+ A package can expose a selected upstream skill under its own name:
119
+
120
+ ```bash
121
+ npm install @example/upstream
122
+ npx skillshop export skill:review --from @example/upstream --skill skill:review
123
+ ```
124
+
125
+ The resulting export in `skillshop.library.json` is:
126
+
127
+ ```json
128
+ {
129
+ "skill:review": {
130
+ "from": "@example/upstream",
131
+ "skill": "skill:review"
132
+ }
133
+ }
134
+ ```
135
+
136
+ That object is one entry inside the manifest's `exports` map. The upstream package must be a runtime dependency or a non-optional peer dependency. Re-exporting is explicit; depending on another library does not expose all of its skills.
137
+
138
+ ## CLI and JavaScript API
139
+
140
+ ```text
141
+ skillshop init
142
+ skillshop config agents
143
+ skillshop list
144
+ skillshop <name> [--global]
145
+ skillshop install <name> [--global]
146
+ skillshop update [name]
147
+ skillshop update --push
148
+ skillshop uninstall <name> [--global]
149
+ skillshop agents init [--project <directory>]
150
+ skillshop agents [--project <directory>] [--check]
151
+ skillshop agents --global
152
+ skillshop migrate [root ...]
153
+ skillshop library init
154
+ skillshop library list
155
+ skillshop export skill:<name> <directory>
156
+ skillshop export skill:<name> --from <package> [--skill skill:<source-name>]
157
+ skillshop unexport skill:<name>
158
+ skillshop validate
159
+ skillshop build
160
+ skillshop resolve <library>:<skill>
161
+ skillshop import <library>:<skill> [--global] [--to <directory>] [--force]
162
+ skillshop install-user [package-dir] [--if-global] [--to <skills-dir>]
163
+ ```
164
+
165
+ `init` and `list` keep their bundled-registry meanings. `library init`, `library list`, `validate`, and `build` operate on the package library in the current directory. In a `library:skill` reference, `library` can be an installed package name or a local package directory. `import` defaults to `.agents/skills/<skill>`; `--global` replaces `~/.agents/skills/<skill>`. `unexport` changes the package's public skill list; it does not delete the source directory. Remove a skill from `userInstall` before unexporting it.
166
+
167
+ Applications can use the same operations without invoking the CLI:
168
+
169
+ ```js
170
+ import { exportSkill, reexportSkill, buildSkillLibrary } from 'skillshop/export';
171
+ import { resolveSkill, importSkill } from 'skillshop/import';
172
+ import { installDeclaredUserSkills } from 'skillshop/user-install';
173
+ ```
174
+
175
+ For example, an application can read an exported skill directly from an installed package, or copy it into a workspace it manages:
176
+
177
+ ```js
178
+ import { readFile } from 'node:fs/promises';
179
+ import { resolveSkill, importSkill } from 'skillshop/import';
180
+
181
+ const reference = '@example/skill-library:triage';
182
+ const { manifestPath } = await resolveSkill({ reference });
183
+ const instructions = await readFile(manifestPath, 'utf8');
184
+ // Pass instructions to your agent runtime.
185
+
186
+ await importSkill({
187
+ reference,
188
+ overwrite: true,
189
+ });
190
+ ```
191
+
192
+ `resolveSkill` leaves the skill inside the installed package. `importSkill` copies its complete directory, including files alongside `SKILL.md`. Set `overwrite: true` only when the application intends to replace an existing destination.
193
+
194
+ `importSkill({ overwrite: true })` replaces a destination. Its optional `merge: true` mode overlays packaged files and preserves unrelated destination files. User-level installation always uses replacement, even when called through `installDeclaredUserSkills`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "skillshop",
3
- "version": "2.1.0",
4
- "description": "Build, export, resolve, and install portable agent skill libraries",
3
+ "version": "4.0.0",
4
+ "description": "Install and sync agent skills from personal folder libraries",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "skillshop": "./src/cli.js",
@@ -18,6 +18,8 @@
18
18
  "files": [
19
19
  "agents-content/",
20
20
  "skills-content/",
21
+ "templates/",
22
+ "docs/",
21
23
  "src/",
22
24
  "README.md"
23
25
  ],