skillshop 0.0.0-stage → 2.1.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.
Files changed (63) hide show
  1. package/README.md +280 -2
  2. package/agents-content/000_communication-writing.block.md +11 -0
  3. package/agents-content/001_external-actions.block.md +9 -0
  4. package/agents-content/AGENTS.md +11 -0
  5. package/package.json +28 -4
  6. package/skills-content/architecture-scanner/SKILL.md +274 -0
  7. package/skills-content/architecture-scanner/files.json +10 -0
  8. package/skills-content/architecture-scanner/scan.sh +823 -0
  9. package/skills-content/change-review/SKILL.md +76 -0
  10. package/skills-content/change-review/agents/openai.yaml +4 -0
  11. package/skills-content/changelog/SKILL.md +99 -0
  12. package/skills-content/changeset/changeset.md +80 -0
  13. package/skills-content/code-buddy/SKILL.md +136 -0
  14. package/skills-content/design-system-catalog/SKILL.md +106 -0
  15. package/skills-content/design-system-catalog/extract-components.mjs +441 -0
  16. package/skills-content/design-system-catalog/generate-catalog.sh +255 -0
  17. package/skills-content/flare/SKILL.md +96 -0
  18. package/skills-content/grilling/SKILL.md +31 -0
  19. package/skills-content/install-sigmap/SKILL.md +97 -0
  20. package/skills-content/one-shot/SKILL.md +51 -0
  21. package/skills-content/release/SKILL.md +128 -0
  22. package/skills-content/shadow-clone/SKILL.md +228 -0
  23. package/skills-content/shadow-clone/extract-signatures.mjs +202 -0
  24. package/skills-content/shadow-clone/scan-repo.mjs +343 -0
  25. package/skills-content/ship/SKILL.md +95 -0
  26. package/skills-content/shots/SKILL.md +89 -0
  27. package/skills-content/shots/agents/openai.yaml +4 -0
  28. package/skills-content/skillshop/SKILL.md +104 -0
  29. package/skills-content/skillz/SKILL.md +15 -0
  30. package/skills-content/transcript-clean/SKILL.md +55 -0
  31. package/skills-content/transcript-edit/SKILL.md +80 -0
  32. package/skills-content/vitest/GENERATION.md +5 -0
  33. package/skills-content/vitest/SKILL.md +52 -0
  34. package/skills-content/vitest/references/advanced-environments.md +264 -0
  35. package/skills-content/vitest/references/advanced-projects.md +300 -0
  36. package/skills-content/vitest/references/advanced-type-testing.md +237 -0
  37. package/skills-content/vitest/references/advanced-vi.md +249 -0
  38. package/skills-content/vitest/references/core-cli.md +166 -0
  39. package/skills-content/vitest/references/core-config.md +174 -0
  40. package/skills-content/vitest/references/core-describe.md +193 -0
  41. package/skills-content/vitest/references/core-expect.md +219 -0
  42. package/skills-content/vitest/references/core-hooks.md +244 -0
  43. package/skills-content/vitest/references/core-test-api.md +233 -0
  44. package/skills-content/vitest/references/features-concurrency.md +250 -0
  45. package/skills-content/vitest/references/features-context.md +238 -0
  46. package/skills-content/vitest/references/features-coverage.md +207 -0
  47. package/skills-content/vitest/references/features-filtering.md +211 -0
  48. package/skills-content/vitest/references/features-mocking.md +265 -0
  49. package/skills-content/vitest/references/features-snapshots.md +207 -0
  50. package/skills-content/workleaf/SKILL.md +77 -0
  51. package/skills-content/worklog/SKILL.md +145 -0
  52. package/skills-content/worklog/references/summary-format.md +114 -0
  53. package/skills-content/worktree/SKILL.md +71 -0
  54. package/src/agents-instructions.js +219 -0
  55. package/src/cli.js +160 -0
  56. package/src/export.js +113 -0
  57. package/src/import.js +139 -0
  58. package/src/index.js +5 -0
  59. package/src/legacy-agents-content.js +36 -0
  60. package/src/legacy-cli.js +1234 -0
  61. package/src/library.js +259 -0
  62. package/src/specifier.js +27 -0
  63. package/src/user-install.js +48 -0
package/README.md CHANGED
@@ -1,3 +1,281 @@
1
- # Temporary Holding Version
1
+ # Skillshop
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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.
4
+
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
+
7
+ ## For users: manage skills
8
+
9
+ ### Install and configure Skillshop
10
+
11
+ ```bash
12
+ npm install --global skillshop
13
+ skillshop init
14
+ ```
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.
17
+
18
+ ### Install a named skill
19
+
20
+ List the skills bundled with Skillshop, then install one:
21
+
22
+ ```bash
23
+ skillshop list
24
+ skillshop one-shot
25
+ # Equivalent: skillshop install one-shot
26
+ ```
27
+
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.
29
+
30
+ To install a named skill for your user account instead:
31
+
32
+ ```bash
33
+ skillshop one-shot --global
34
+ # Equivalent: sk install one-shot --global
35
+ ```
36
+
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.
38
+
39
+ ### Update or remove skills
40
+
41
+ ```bash
42
+ skillshop update
43
+ skillshop update one-shot
44
+ skillshop update --push
45
+ skillshop uninstall one-shot
46
+ skillshop uninstall one-shot --global
47
+ ```
48
+
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.
50
+
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:
65
+
66
+ ```bash
67
+ npm install --global @example/skill-library
68
+ ```
69
+
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.
71
+
72
+ To copy one exported skill into a project instead:
73
+
74
+ ```bash
75
+ npm install @example/skill-library skillshop
76
+ npx skillshop import @example/skill-library:review
77
+ ```
78
+
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
82
+
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:
84
+
85
+ ```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.
120
+ ```
121
+
122
+ Keep any references or scripts needed by the skill beside its `SKILL.md`; Skillshop copies the whole directory.
123
+
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
+ ```
132
+
133
+ This writes `skillshop.library.json`:
134
+
135
+ ```json
136
+ {
137
+ "schemaVersion": 1,
138
+ "exports": {
139
+ "skill:review": "./.agents/skills/review",
140
+ "skill:triage": "./.agents/skills/triage"
141
+ }
142
+ }
143
+ ```
144
+
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
148
+
149
+ To copy selected skills during a global npm install, add `skillshop.userInstall` and the generic lifecycle command to the distributor's `package.json`:
150
+
151
+ ```json
152
+ {
153
+ "name": "@example/skill-library",
154
+ "version": "1.0.0",
155
+ "dependencies": {
156
+ "skillshop": "^2.1.0"
157
+ },
158
+ "files": [],
159
+ "scripts": {
160
+ "prepack": "skillshop build",
161
+ "postinstall": "skillshop install-user . --if-global"
162
+ },
163
+ "skillshop": {
164
+ "userInstall": ["skill:review"]
165
+ }
166
+ }
167
+ ```
168
+
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.
170
+
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.
172
+
173
+ ### 3. Check and pack the package
174
+
175
+ ```bash
176
+ npx skillshop library list
177
+ npx skillshop validate
178
+ npx skillshop build
179
+ npm pack --dry-run
180
+ ```
181
+
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.
183
+
184
+ After checking the tarball, publish the package with `npm publish`. Use `npm publish --access public` for a public scoped package.
185
+
186
+ ### Example: what happens after publication
187
+
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:
189
+
190
+ ```bash
191
+ npm install --global @example/skill-library
192
+ # ~/.agents/skills/review/SKILL.md now comes from the package
193
+ ```
194
+
195
+ An application that needs `skill:triage` can install the package locally and copy that exported skill into its own repository:
196
+
197
+ ```bash
198
+ cd ~/work/sample-app
199
+ npm install @example/skill-library skillshop
200
+ npx skillshop import @example/skill-library:triage
201
+ ```
202
+
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.
204
+
205
+ ### Re-export a skill from another library
206
+
207
+ A package can expose a selected upstream skill under its own name:
208
+
209
+ ```bash
210
+ npm install @example/upstream
211
+ npx skillshop export skill:review --from @example/upstream --skill skill:review
212
+ ```
213
+
214
+ The resulting export in `skillshop.library.json` is:
215
+
216
+ ```json
217
+ {
218
+ "skill:review": {
219
+ "from": "@example/upstream",
220
+ "skill": "skill:review"
221
+ }
222
+ }
223
+ ```
224
+
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.
226
+
227
+ ## CLI and JavaScript API
228
+
229
+ ```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>]
250
+ ```
251
+
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.
253
+
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';
260
+ ```
261
+
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
+ ```
278
+
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.
280
+
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`.
@@ -0,0 +1,11 @@
1
+ ## Communication and writing
2
+
3
+ - Write directly and concisely. Prefer short, distinct sentences over long compound ones.
4
+ - Do not overuse em dashes. There are periods, commas, semicolons, and exclamation marks. Use them.
5
+ - Remove hedges and filler that add no information. Keep technical terms when they add precision.
6
+ - Avoid exact counts unless the number matters. "All the callers" is usually better than "all 4 callers."
7
+ - Short, natural reactions are fine. Use "Good catch!" rather than an inflated response.
8
+ - Avoid throat clearing, restating the question, routine process narration, and closing offers. Brief accountability or correction is fine when it helps the reader.
9
+ - Do not explain in prose what a table or diff already makes clear.
10
+ - State genuine uncertainty briefly. Do not add defensive caveats or pre-empt objections nobody raised.
11
+ - Brevity must not hide important behavior, risk, uncertainty, or evidence.
@@ -0,0 +1,9 @@
1
+ ### Approval for external actions
2
+
3
+ All external actions require explicit approval before proceeding. Even on autopilot mode, do not post without explicit written authorizaton from the user.
4
+
5
+ - Before posting or editing a PR comment, review reply, issue comment, Slack message, or other external message, show me the exact draft and get an explicit OK. This includes edits to existing messages.
6
+ - Before resolving review threads, requesting reviewers, or changing other visible review state, describe the exact action and get an explicit OK.
7
+ - Create an issue, epic, or PR only when I explicitly request it. Before opening one, show me its proposed title and body and get an explicit OK.
8
+ - A direct request to update an existing PR or issue body authorizes that update without another approval. Fetch the latest body from the host immediately before editing it.
9
+ - Pushing requested commits does not require another approval.
@@ -0,0 +1,11 @@
1
+ ### Baseline tone
2
+
3
+ This applies to every text that you write.
4
+
5
+ Adopt a skeptical, questioning approach. Don't default to praise, criticize my ideas, provide counterpoints, dig deeper. I need you to find the blind spots in my thinking and account for them, in a straight shooting and constructive way.
6
+
7
+ Don't overuse adjectives, don't compliment or criticize my arguments in a personalized way, just attend to the facts and topics. Tell it like it is; don't sugar-coat responses. Also don't explicitly mention you're NOT praising me or actively say you're “getting to the point”. Don't comment on your tone at all.
8
+
9
+ When explaining things, provide depth of concepts, be extensive, with context, clarity and explanation of concepts along the way.
10
+
11
+ {{ blocks }}
package/package.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "skillshop",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.1.0",
4
+ "description": "Build, export, resolve, and install portable agent skill libraries",
5
+ "type": "module",
6
+ "bin": {
7
+ "skillshop": "./src/cli.js",
8
+ "sk": "./src/cli.js"
9
+ },
10
+ "exports": {
11
+ ".": "./src/index.js",
12
+ "./library": "./src/library.js",
13
+ "./export": "./src/export.js",
14
+ "./import": "./src/import.js",
15
+ "./user-install": "./src/user-install.js",
16
+ "./specifier": "./src/specifier.js"
17
+ },
18
+ "files": [
19
+ "agents-content/",
20
+ "skills-content/",
21
+ "src/",
22
+ "README.md"
23
+ ],
24
+ "scripts": {
25
+ "test": "node --test"
26
+ },
27
+ "engines": {
28
+ "node": ">=18"
29
+ }
30
+ }
@@ -0,0 +1,274 @@
1
+ ---
2
+ name: architecture-scanner
3
+ description: Architecture scanner and documentation generator. Use when scanning the codebase architecture, updating architecture docs, or generating architecture documentation.
4
+ metadata:
5
+ author: Daniel Fosco
6
+ version: "2026.8.30"
7
+ ---
8
+
9
+ # Architecture Scanner Skill
10
+
11
+ > Triggered by: "scan the codebase architecture", "update the architecture", "update arch", "generate architecture docs", "scan arch", "full update", "full architecture update", "full refresh architecture"
12
+
13
+ ## What This Does
14
+
15
+ Generates documentation files in `.agents/architecture/` that describe every architecturally significant file in the codebase. The system has two layers:
16
+
17
+ - **`architecture.index.md`** — The architectural overview. Groups files by category (ordered and configured via the `categories` array in `files.json`) and includes prose summaries. Categories with `"priority": "critical"` get 2-3x more detailed overviews. A reader should be able to understand the system's architecture from this file alone.
18
+ - **Per-file docs** (`{filepath}.md`) — Detailed documentation for individual files, including what they do, how they work (with code samples), their dependencies, and dependents. Every file reference is cross-linked to its architecture doc.
19
+
20
+ ## How to Execute
21
+
22
+ The scanner handles repository mechanics. The agent handles architectural interpretation and writing. The primary modes are:
23
+
24
+ ```bash
25
+ .agents/skills/architecture-scanner/scan.sh --full
26
+ ```
27
+
28
+ - Runs: discovery -> placeholder creation -> index skeleton creation -> verify
29
+ - Existing authored docs and an existing authored index are preserved.
30
+
31
+ After `--full`, run `--enrich-all` for a first scan or `--enrich` for an incremental scan, then perform the writing pass described below. The command output is a worklist for the agent, not final documentation.
32
+
33
+ ```bash
34
+ .agents/skills/architecture-scanner/scan.sh --enrich
35
+ ```
36
+
37
+ - Runs: agent-enrichment planning only (no file writes)
38
+ - The script prints a JSON worklist (`create`, `update`, `delete`) with per-file targets and manual next steps.
39
+ - Use an agent action to write/refresh each listed `.agents/architecture/{path}.md` using goal-first narrative and architectural context.
40
+ - The JSON worklist includes these fields per target: `path`, `doc`, `category`, `importance`, `exports`, `hint_dependencies`, `hint_dependents`, `enrichment_focus`, and optional `existing_goal_preview`.
41
+
42
+ ```bash
43
+ .agents/skills/architecture-scanner/scan.sh --enrich-all
44
+ ```
45
+
46
+ - Runs: agent-enrichment planning for every non-low file in `files.json`, even if unchanged.
47
+ - `--enrich-all` is useful when the user requests a full rewrite, style reset, or comprehensive prose refresh.
48
+ - For unchanged files, tasks are returned with `reason: full_rewrite`, not `source_changed`.
49
+ - The output remains an agent-only plan (`create`, `update`, `delete`) with no file writes.
50
+
51
+ ```bash
52
+ .agents/skills/architecture-scanner/scan.sh --steps "discover,docs,index,verify"
53
+ ```
54
+
55
+ - Runs only selected steps in order. Supported step names:
56
+ - `discover` (scan and refresh `files.json`)
57
+ - manifest/docs (print full manifest / create missing placeholders)
58
+ - `stale` (print changed/removed manifest)
59
+ - `enrich` (agent-enrichment plan: changed files only)
60
+ - `enrich-all` (agent-enrichment plan: all non-low files)
61
+ - `index` (index from existing docs)
62
+ - `verify` (coverage/linkback consistency check)
63
+
64
+ ### Step 0: Inventory repository topology (required)
65
+
66
+ Before discovery, inspect tracked manifests and workspace configuration for the repository's actual ecosystems. Examples include `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, and language-specific workspace files. Use `git ls-files` or the repository's workspace tooling so generated dependency directories and external worktrees are not mistaken for packages.
67
+
68
+ Read every relevant root and workspace manifest to understand package names, responsibilities, entry points, and internal dependencies. Do not assume a `packages/*` layout or that one manifest represents the entire repository.
69
+
70
+ ### Step 1: Discover files
71
+
72
+ ```bash
73
+ .agents/skills/architecture-scanner/scan.sh --discover
74
+ ```
75
+
76
+ This scans the repo using discovery rules and creates or updates `files.json` in the skill folder. If `files.json` doesn't exist yet, it creates it with default priorities. If it already exists, it **adds new files** and **removes deleted files**, but **preserves user-set `importance` values** — those are never overwritten.
77
+
78
+ Discovery includes common root and workspace manifests. Review and extend `DISCOVERY_RULES` when the repository uses another ecosystem or layout; a scanner cannot infer architectural importance from filenames alone.
79
+
80
+ Run this first to ensure the file list is current.
81
+
82
+ ### Step 2: Determine what needs to be done
83
+
84
+ Run `--stale` to get the incremental manifest when you want change-aware updates. For scripted full flows, use `--full` or `--steps` directly.
85
+
86
+ ```bash
87
+ .agents/skills/architecture-scanner/scan.sh --stale
88
+ ```
89
+
90
+ This uses **git history** to detect changes: it finds the most recent commit that touched `.agents/architecture/`, then diffs against `HEAD` to identify changed source files, and also includes uncommitted (staged/unstaged) changes.
91
+
92
+ `--stale` returns a JSON object with three incremental buckets:
93
+
94
+ - **`files`** — docs to create/update:
95
+ - `"missing"` = source exists but doc does not (added/new file docs)
96
+ - `"stale"` = source changed since last architecture update
97
+ - **`removed`** — docs to delete because source was removed/moved or is no longer tracked
98
+ - **`index`** — whether `architecture.index.md` should be regenerated (`"status": "stale"`) and why
99
+
100
+ If `files` and `removed` are both empty and `index.status` is `"fresh"`, docs are up to date.
101
+
102
+ **When `--stale` suggests a full scan:** If more than 50% of documented files need updates, output includes `"suggestion": "full_scan"` and a message. In this case, switch to a full scan:
103
+
104
+ ```bash
105
+ .agents/skills/architecture-scanner/scan.sh --manifest
106
+ ```
107
+
108
+ You can also force a full scan explicitly with:
109
+
110
+ ```bash
111
+ .agents/skills/architecture-scanner/scan.sh --full
112
+ ```
113
+
114
+ This outputs every non-low file regardless of change status. Use this for:
115
+ - **First-time runs** (no architecture docs exist yet)
116
+ - **Template changes** (when the doc format itself changed, so all docs need regeneration)
117
+ - **When `--stale` suggests it** (many files changed across multiple commits)
118
+ - **When the user explicitly requests a full scan**
119
+ - **When the user says natural-language variants like "full update" / "full refresh"**
120
+
121
+ **Low importance files are excluded from both manifests and should NOT get architecture docs.**
122
+
123
+ ### Step 3: Agent writes the documentation
124
+
125
+ The scanner creates only missing placeholder files. For each entry in `files` (from `--stale`) or each entry in the full manifest (`--manifest`/`--full`), the agent must read the actual source and write the architecture document at:
126
+
127
+ ```
128
+ .agents/architecture/{filepath}.md
129
+ ```
130
+
131
+ For example:
132
+ - `src/application/core/loader.js` → `.agents/architecture/src/application/core/loader.js.md`
133
+ - `vite.config.js` → `.agents/architecture/vite.config.js.md`
134
+
135
+ #### For NEW files (status `"missing"`, or first full scan):
136
+
137
+ The placeholder already has the required headings. Read the source, then replace every agent comment with source-grounded prose. The manifest's `doc` field contains the exact relative path to use.
138
+
139
+ #### For STALE files (status `"stale"`):
140
+
141
+ The doc already exists but the source file has changed. Follow this process:
142
+
143
+ 1. **Read the source file** to understand what changed
144
+ 2. **Read the existing doc file** to see what's already documented
145
+ 3. **Use the edit tool** to update only the sections that are affected by the source changes — preserve accurate authored context
146
+ 4. Do NOT recreate the file from scratch — make surgical updates
147
+
148
+ #### For REMOVED files (status `"removed"` in `removed` array):
149
+
150
+ Delete the stale architecture doc file referenced by the entry's `doc` field. If any docs are deleted, regenerate the index in Step 4.
151
+
152
+ **What to check when updating a stale doc:**
153
+ - Has the file's purpose changed? → Update **Meaning**
154
+ - Have exports/functions/components changed? → Update **Composition**
155
+ - Have imports changed? → Update **Dependencies**
156
+ - Have downstream consumers changed? → Update **Dependents** (re-grep)
157
+ - Any new edge cases or behavior changes? → Update **Notes**
158
+
159
+ #### Doc template
160
+
161
+ Each doc file MUST follow this template:
162
+
163
+ ```markdown
164
+ # `{filepath}`
165
+
166
+ <!--
167
+ source: {filepath}
168
+ category: {category}
169
+ importance: {importance}
170
+ -->
171
+
172
+ > [← Architecture Index](../architecture.index.md)
173
+
174
+ (Adjust the relative path based on nesting depth — e.g., `../../architecture.index.md` for files 2 levels deep like `src/application/core/loader.js.md`)
175
+
176
+ ## Meaning
177
+
178
+ {1-2 paragraph architectural summary: what this file means in the system, why it exists, what responsibility it owns, and what would break or become unclear without it. This must be readable by someone unfamiliar with the codebase.}
179
+
180
+ ## Composition
181
+
182
+ {Detailed description of the file's structure: what it exports, key functions/components, internal organization, type signatures, parameter details. Include code samples from the actual source file to illustrate key exports, signatures, and patterns — don't just describe them in prose.}
183
+
184
+ ## Dependencies
185
+
186
+ {List of significant imports — what this file depends on, and why}
187
+
188
+ ## Dependents
189
+
190
+ {What depends on this file — who imports it, derived by grepping}
191
+
192
+ ## Notes
193
+
194
+ {Any non-obvious behavior, edge cases, circular dependency considerations, or architectural decisions worth noting. Omit this section if there's nothing notable.}
195
+ ```
196
+
197
+ **Rules for writing docs:**
198
+ - Read each file's actual content before writing its doc — do NOT guess
199
+ - The **Meaning** section is the most important — it should be a clear, standalone conceptual summary (1-2 paragraphs), not a restatement of the filename or category
200
+ - The remaining sections (Composition, Dependencies, Dependents, Notes) are all top-level headings — do NOT wrap them in a `<details>` element
201
+ - **Include code samples** — when describing exports, function signatures, component props, data shapes, or usage patterns, include actual code snippets from the source file. This makes docs scannable and concrete.
202
+ - **Cross-link file references** — every time a file path is mentioned anywhere in the documentation (Goal, Composition, Dependencies, Dependents, Notes, or the index), it MUST be a markdown hyperlink to that file's architecture doc. Use relative paths from the current doc to the target doc. For example, in a doc at `.agents/architecture/src/application/context.jsx.md`, a reference to the loader would be written as [`src/application/core/loader.js`](./core/loader.js.md). If the referenced file has no architecture doc (e.g., low-importance files), link to the source file on GitHub or leave it as plain text with a backtick code span.
203
+ - The "Dependents" section should be derived by grepping for imports of this file
204
+ - For `medium` importance files, keep it concise — shorter Meaning, fewer code samples
205
+ - For `high` importance files, write a thorough Meaning (2 paragraphs), comprehensive Composition with multiple code samples, and complete dependency/dependent lists
206
+
207
+ ### Step 4: Agent writes the index
208
+
209
+ ```bash
210
+ .agents/skills/architecture-scanner/scan.sh --index
211
+ ```
212
+
213
+ This creates `architecture.index.md` only when it is missing. If it already exists, the script preserves it. The agent must read and update the index after writing file docs.
214
+
215
+ When the index is missing, `--index` creates its structural skeleton. When `--stale` reports `index.status: "stale"` because files changed, added, or were removed, the agent edits the existing index directly so its authored overview and concepts are preserved.
216
+
217
+ The agent MUST write the repository overview and category concepts. Read the `categories` array in `files.json` to determine category order, display names, and priority levels. The final index should follow this structure:
218
+
219
+ ```markdown
220
+ # Architecture Index
221
+
222
+ > Architecture guide for this repository. The scanner maintains structure; the agent maintains meaning.
223
+
224
+ ## Repository overview
225
+
226
+ {2-4 paragraphs explaining what the repository is for, the packages or modules and runtime surfaces it contains, the central user/system concepts, and the major flow between them. Base this on every relevant manifest and the source graph.}
227
+
228
+ ## {Category Name}
229
+
230
+ {Conceptual overview: what this category represents, why it exists, what it owns, and how it relates to other categories.}
231
+
232
+ - [`path/to/file.js`](./path/to/file.js.md) — {one-line description}
233
+ - [`path/to/other.js`](./path/to/other.js.md) — {one-line description}
234
+
235
+ ## {Next Category}
236
+ ...
237
+ ```
238
+
239
+ **Category configuration** is defined in `files.json` under the `categories` array:
240
+
241
+ ```json
242
+ "categories": [
243
+ { "id": "application", "name": "Application Core", "priority": "critical", "order": 1 },
244
+ { "id": "config", "name": "Configuration", "priority": "normal", "order": 5 }
245
+ ]
246
+ ```
247
+
248
+ - **`order`** — Controls the display order of categories in the index (ascending)
249
+ - **`name`** — The display heading used in the index (`## {name}`)
250
+ - **`priority`** — Controls the depth of the overview:
251
+ - **`critical`** — The overview for this category should be 2-3x longer than normal. Write 3-4 paragraphs covering key concepts, data flow, architectural decisions, and how the parts interact. Include code samples or diagrams in the overview itself when helpful. These are the categories a new contributor must deeply understand.
252
+ - **`normal`** — Standard 1-2 paragraph overview explaining purpose, key patterns, and relationships between files.
253
+
254
+ **Rules for the index:**
255
+ - Category sections are ordered by the `order` field in the `categories` array
256
+ - Each category section gets an architectural overview — length determined by `priority`
257
+ - Each link gets a brief one-line meaning statement, written from the file's Meaning section
258
+ - **Cross-link file references** — every file path mentioned in the overview text must link to its architecture doc (same rule as per-file docs)
259
+ - The opening architecture narrative must reflect the **full repository inventory** from Step 0, not just the packages or modules currently documented in one category
260
+ - Write for someone unfamiliar with the codebase — the index is the entry point to understanding the architecture
261
+
262
+ ### Step 5: Verify
263
+
264
+ - Confirm every file in the manifest has a corresponding `.md` doc
265
+ - Confirm every entry in `removed` had its doc file deleted
266
+ - Confirm `architecture.index.md` links to all docs
267
+ - Confirm every doc has a backlink to the index
268
+
269
+ ### Step 6: Commit
270
+
271
+ ```bash
272
+ git add .agents/architecture/ .agents/skills/architecture-scanner/
273
+ git commit -m "Update architecture documentation"
274
+ ```
@@ -0,0 +1,10 @@
1
+ {
2
+ "categories": [
3
+ { "id": "config", "name": "Configuration", "priority": "normal", "order": 1 },
4
+ { "id": "entry", "name": "Entry Points", "priority": "critical", "order": 2 },
5
+ { "id": "interface", "name": "Interfaces", "priority": "normal", "order": 3 },
6
+ { "id": "core", "name": "Core Implementation", "priority": "critical", "order": 4 },
7
+ { "id": "test", "name": "Tests", "priority": "low", "order": 5 }
8
+ ],
9
+ "files": []
10
+ }