skill-automation-package 0.2.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/LICENSE +21 -0
- package/README.md +441 -0
- package/assets/.claude/skills/project-skill-router/SKILL.md +32 -0
- package/assets/.claude/skills/project-skill-router/skill.json +50 -0
- package/assets/.claude/tests/test_skill_agent.py +508 -0
- package/assets/.claude/tools/skill_agent.py +2501 -0
- package/bin/skill-automation-package.js +402 -0
- package/package.json +42 -0
- package/scripts/install.py +208 -0
- package/scripts/package_layout.py +108 -0
- package/templates/agents_block.md +20 -0
- package/templates/claude_block.md +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yunhyeon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
# Skill Automation Package
|
|
2
|
+
|
|
3
|
+
Portable repo-local skill automation for Codex and Claude Code.
|
|
4
|
+
|
|
5
|
+
This repository ships a Python-installed automation bundle. It is not an npm runtime package; `package.json` is used here as a package manifest for managed assets, versioning, and install metadata.
|
|
6
|
+
|
|
7
|
+
## Why This Exists
|
|
8
|
+
|
|
9
|
+
Most agent sessions can search local files, but they do not automatically build a reusable skill system for the repository they are working in. This package adds that layer.
|
|
10
|
+
|
|
11
|
+
After installation, an agent can:
|
|
12
|
+
|
|
13
|
+
- search for the best existing local skill for a task
|
|
14
|
+
- generate a new reusable skill when no strong match exists
|
|
15
|
+
- refresh the local skill registry automatically
|
|
16
|
+
- track reuse frequency for each local skill
|
|
17
|
+
- archive low-value skills that stay unused long enough to become cleanup candidates
|
|
18
|
+
- route future Codex and Claude Code sessions through the same workflow
|
|
19
|
+
|
|
20
|
+
## What It Installs
|
|
21
|
+
|
|
22
|
+
- `.claude/tools/skill_agent.py`
|
|
23
|
+
- `.claude/skills/project-skill-router/`
|
|
24
|
+
- optional `.claude/tests/test_skill_agent.py`
|
|
25
|
+
- managed automation blocks for `AGENTS.md` and `CLAUDE.md`
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
Install into another repository:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
python3 scripts/install.py --target /path/to/target-repo
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or use the npm wrapper entrypoint:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx skill-automation-package install --target /path/to/target-repo
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
To update an existing target without forcing an unnecessary reinstall when it is already current:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx skill-automation-package update --target /path/to/target-repo
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The npm entrypoint is a thin wrapper around the Python installer. It does not replace the Python core, and Python 3.10 or newer is still required.
|
|
48
|
+
If you already have this repository checked out locally, the direct `python3 scripts/install.py ...` path remains fully supported.
|
|
49
|
+
`install` always allows reinstall. `update` is version-aware and only reinstalls when the target reports an older installed version.
|
|
50
|
+
Before reinstalling, the wrapper checks `.claude/skill-automation-package.json` in the target repo and reports whether the target is not installed, already at the current version, or behind the current package version.
|
|
51
|
+
|
|
52
|
+
The installer copies the packaged assets, updates managed blocks in `AGENTS.md` and `CLAUDE.md` unless skipped, writes `.claude/skill-automation-package.json`, and refreshes `.claude/skills/registry.json`.
|
|
53
|
+
|
|
54
|
+
Then, inside the target repository, start non-trivial work with:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
python3 .claude/tools/skill_agent.py auto "<task>" --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
If you want a preview before writing files:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
python3 .claude/tools/skill_agent.py auto "<task>" --dry-run --json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Example Outcomes
|
|
67
|
+
|
|
68
|
+
Representative `auto` outcomes look like this.
|
|
69
|
+
|
|
70
|
+
Reuse an existing skill:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"action": "reuse",
|
|
75
|
+
"task": "vision extraction error on the OCR screen",
|
|
76
|
+
"match": {
|
|
77
|
+
"name": "ocr-debug",
|
|
78
|
+
"category": "ios",
|
|
79
|
+
"reason": "triggers overlap: extraction, vision, error"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Create a new skill when no strong match exists:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"action": "created",
|
|
89
|
+
"task": "draft a reusable privacy policy update workflow",
|
|
90
|
+
"created_skill": {
|
|
91
|
+
"name": "new-skill-name",
|
|
92
|
+
"category": "docs"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The exact skill name is inferred from the task, but the flow is stable: reuse when there is a strong match, otherwise scaffold a new reusable local skill and refresh the registry immediately.
|
|
98
|
+
|
|
99
|
+
## Installation Guide
|
|
100
|
+
|
|
101
|
+
Use this package when you have the package repository checked out locally and want to install the automation bundle into another repository.
|
|
102
|
+
|
|
103
|
+
### Prerequisites
|
|
104
|
+
|
|
105
|
+
- Python 3.10 or newer
|
|
106
|
+
- for the npm entrypoint, Node.js 18 or newer
|
|
107
|
+
- a target repository where you want repo-local skill automation under `.claude/`
|
|
108
|
+
- write access to the target repository
|
|
109
|
+
|
|
110
|
+
### Standard Install
|
|
111
|
+
|
|
112
|
+
1. Choose the target repository.
|
|
113
|
+
2. Run the installer from this package repository:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
python3 scripts/install.py --target /path/to/target-repo
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
3. The installer will:
|
|
120
|
+
|
|
121
|
+
- copy `.claude/tools/skill_agent.py`
|
|
122
|
+
- copy `.claude/skills/project-skill-router/`
|
|
123
|
+
- optionally copy `.claude/tests/test_skill_agent.py`
|
|
124
|
+
- insert managed automation blocks into `AGENTS.md` and `CLAUDE.md`
|
|
125
|
+
- write `.claude/skill-automation-package.json`
|
|
126
|
+
- refresh `.claude/skills/registry.json`
|
|
127
|
+
|
|
128
|
+
### Why `AGENTS.md` And `CLAUDE.md` Are Updated
|
|
129
|
+
|
|
130
|
+
The installer adds a bounded managed block so future Codex and Claude Code sessions start from the same routing command instead of bypassing the local skill system.
|
|
131
|
+
|
|
132
|
+
If your team wants a less invasive rollout:
|
|
133
|
+
|
|
134
|
+
- use `--skip-agents` to keep `AGENTS.md` untouched
|
|
135
|
+
- use `--skip-claude` to keep `CLAUDE.md` untouched
|
|
136
|
+
- add the generated command guidance manually after you validate the package in that repository
|
|
137
|
+
|
|
138
|
+
### Verify The Install
|
|
139
|
+
|
|
140
|
+
After installation, check the target repository:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
cd /path/to/target-repo
|
|
144
|
+
python3 .claude/tools/skill_agent.py list
|
|
145
|
+
python3 .claude/tools/skill_agent.py auto "find or create the right reusable workflow" --json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
You should see the packaged router skill in the list, and `auto` should return either a reusable local skill match or a generated preview/result.
|
|
149
|
+
|
|
150
|
+
### Common Install Variants
|
|
151
|
+
|
|
152
|
+
- Preview without writing files: `python3 scripts/install.py --target /path/to/target-repo --dry-run`
|
|
153
|
+
- Skip the packaged test file: `python3 scripts/install.py --target /path/to/target-repo --no-tests`
|
|
154
|
+
- Skip managed `AGENTS.md`: `python3 scripts/install.py --target /path/to/target-repo --skip-agents`
|
|
155
|
+
- Skip managed `CLAUDE.md`: `python3 scripts/install.py --target /path/to/target-repo --skip-claude`
|
|
156
|
+
|
|
157
|
+
## Managed File Behavior
|
|
158
|
+
|
|
159
|
+
- If `AGENTS.md` or `CLAUDE.md` does not exist, install creates the file and inserts the managed block.
|
|
160
|
+
- If both package markers already exist, install replaces only the content inside that managed block.
|
|
161
|
+
- If the markers are missing, install appends the managed block to the end of the existing file.
|
|
162
|
+
- `--dry-run` previews the install result without creating the target directory or writing package files, and its status lines use `Would ...` wording for changes that are only being previewed.
|
|
163
|
+
|
|
164
|
+
## Target Repo Git Hygiene
|
|
165
|
+
|
|
166
|
+
Decide up front whether the installed automation should be shared through version control or kept local to one checkout.
|
|
167
|
+
|
|
168
|
+
### Shared Automation In Version Control
|
|
169
|
+
|
|
170
|
+
Use this when the repository wants shared repo-local skills and shared entrypoint guidance.
|
|
171
|
+
|
|
172
|
+
Usually commit:
|
|
173
|
+
|
|
174
|
+
- `.claude/tools/skill_agent.py`
|
|
175
|
+
- `.claude/skills/project-skill-router/`
|
|
176
|
+
- `.claude/tests/test_skill_agent.py` when installed
|
|
177
|
+
- `AGENTS.md` and `CLAUDE.md` when you want the managed guidance blocks shared with the team
|
|
178
|
+
|
|
179
|
+
Usually ignore:
|
|
180
|
+
|
|
181
|
+
```gitignore
|
|
182
|
+
.claude/skills/registry.json
|
|
183
|
+
.claude/skills/usage.json
|
|
184
|
+
.claude/skills/_archived/
|
|
185
|
+
.claude/skill-automation-package.json
|
|
186
|
+
.claude/**/__pycache__/
|
|
187
|
+
.claude/**/*.pyc
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The install manifest is usually not worth committing because it changes on reinstall and mostly records machine-generated install metadata.
|
|
191
|
+
|
|
192
|
+
Do not blindly ignore `.claude/skills/` if you want teammates to share reusable local skills. That would also hide the actual skill definitions.
|
|
193
|
+
|
|
194
|
+
### Local-Only Automation
|
|
195
|
+
|
|
196
|
+
Use this when the install is only for one developer checkout and should not affect the shared repository state.
|
|
197
|
+
|
|
198
|
+
Typical approach:
|
|
199
|
+
|
|
200
|
+
- install with `--skip-agents --skip-claude` if you do not want top-level guidance files touched
|
|
201
|
+
- ignore the installed automation tree and any optional managed docs
|
|
202
|
+
|
|
203
|
+
Example:
|
|
204
|
+
|
|
205
|
+
```gitignore
|
|
206
|
+
.claude/
|
|
207
|
+
AGENTS.md
|
|
208
|
+
CLAUDE.md
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Pick one policy deliberately. Mixing the two usually creates confusion during upgrades.
|
|
212
|
+
|
|
213
|
+
### Reinstall After Updates
|
|
214
|
+
|
|
215
|
+
Upgrade by rerunning the installer from the newer package source:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
python3 scripts/install.py --target /path/to/target-repo
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
If you are consuming the published npm package, the equivalent update path is:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
npx skill-automation-package install --target /path/to/target-repo
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
That npm path is still a reinstall. It uses the existing install metadata to report whether the target is already up to date or whether a newer package version is available before reinstalling.
|
|
228
|
+
If you want a version-aware no-op when the target is already current, use:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
npx skill-automation-package update --target /path/to/target-repo
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Current Wrapper Limitations
|
|
235
|
+
|
|
236
|
+
- `update` is a version-aware reinstall, not a partial update.
|
|
237
|
+
- `update` blocks implicit downgrade attempts; use `install` only when you intentionally want to replace the target with the current package version.
|
|
238
|
+
- If install metadata is malformed, `update` stops and asks you to use `install` for a deliberate reinstall.
|
|
239
|
+
|
|
240
|
+
What gets updated in place:
|
|
241
|
+
|
|
242
|
+
- packaged assets under `.claude/` are copied over the existing installed package files
|
|
243
|
+
- the managed blocks in `AGENTS.md` and `CLAUDE.md` are replaced when their markers already exist
|
|
244
|
+
- `.claude/skill-automation-package.json` is rewritten with the latest package version and install timestamp
|
|
245
|
+
- `.claude/skills/registry.json` is regenerated at the end of install
|
|
246
|
+
|
|
247
|
+
What stays in place:
|
|
248
|
+
|
|
249
|
+
- repo-local skills you created under `.claude/skills/`
|
|
250
|
+
- usage tracking in `.claude/skills/usage.json`
|
|
251
|
+
- archived skills under `.claude/skills/_archived/`
|
|
252
|
+
|
|
253
|
+
Important upgrade caveats:
|
|
254
|
+
|
|
255
|
+
- if you edited shipped files such as `.claude/tools/skill_agent.py` directly, reinstall will overwrite those edits
|
|
256
|
+
- if you removed the managed markers from `AGENTS.md` or `CLAUDE.md`, reinstall will append a new managed block instead of replacing the old text
|
|
257
|
+
- install does not remove older files that are no longer part of the package, so cleanup is still manual when package contents shrink
|
|
258
|
+
|
|
259
|
+
### Default Upgrade Path
|
|
260
|
+
|
|
261
|
+
Use this unless the target repository intentionally manages `AGENTS.md` and `CLAUDE.md` outside this package.
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
python3 scripts/install.py --target /path/to/target-repo --dry-run
|
|
265
|
+
python3 scripts/install.py --target /path/to/target-repo
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
This keeps the packaged `.claude` assets and the managed guidance blocks aligned on every reinstall.
|
|
269
|
+
|
|
270
|
+
For npm releases, `package.json` `version` is the source of truth and the matching git tag should be `vX.Y.Z`.
|
|
271
|
+
Run `npm run release:check` before tagging or publishing.
|
|
272
|
+
|
|
273
|
+
### Upgrade Without Managed Docs
|
|
274
|
+
|
|
275
|
+
Use this variant only when the target repository already manages `AGENTS.md` and `CLAUDE.md` manually and you want to refresh only the packaged `.claude` assets.
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
python3 scripts/install.py --target /path/to/target-repo --dry-run --skip-agents --skip-claude
|
|
279
|
+
python3 scripts/install.py --target /path/to/target-repo --skip-agents --skip-claude
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Installed Agent Flow
|
|
283
|
+
|
|
284
|
+
- `reuse`: open the matched local skill and follow it
|
|
285
|
+
- `created`: use the generated skill immediately
|
|
286
|
+
- `preview-create`: rerun without `--dry-run` to persist the generated skill
|
|
287
|
+
- If a step inside the chosen workflow becomes its own repeatable, non-trivial subtask, rerun `python3 .claude/tools/skill_agent.py auto "<sub-task>" --json` for that step and then return to the parent workflow.
|
|
288
|
+
|
|
289
|
+
Check reuse health:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
python3 .claude/tools/skill_agent.py usage
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Review stale or underspecified skills before patching them:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
python3 .claude/tools/skill_agent.py review
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Apply the safe metadata refreshes for the current candidates:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
python3 .claude/tools/skill_agent.py update --apply
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Preview cleanup candidates:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
python3 .claude/tools/skill_agent.py prune
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Archive the current candidates:
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
python3 .claude/tools/skill_agent.py prune --apply
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Install Options
|
|
320
|
+
|
|
321
|
+
Preview without writing files:
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
python3 scripts/install.py --target /path/to/target-repo --dry-run
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Skip the packaged test file:
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
python3 scripts/install.py --target /path/to/target-repo --no-tests
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Do not update `AGENTS.md`:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
python3 scripts/install.py --target /path/to/target-repo --skip-agents
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Do not update `CLAUDE.md`:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
python3 scripts/install.py --target /path/to/target-repo --skip-claude
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## Package Layout
|
|
346
|
+
|
|
347
|
+
- `assets/.claude/tools/skill_agent.py`: resolver, search, scaffold, usage tracking, refresh review/update, and prune CLI
|
|
348
|
+
- `assets/.claude/skills/project-skill-router/`: default reusable routing skill
|
|
349
|
+
- `scripts/package_layout.py`: shared package manifest loader and asset copy helpers
|
|
350
|
+
- `templates/agents_block.md`: managed block for `AGENTS.md`
|
|
351
|
+
- `templates/claude_block.md`: managed block for `CLAUDE.md`
|
|
352
|
+
- `scripts/install.py`: installer for another repository
|
|
353
|
+
- `scripts/sync_assets.py`: sync packaged assets from the source repository
|
|
354
|
+
- `tests/test_package_layout.py`: verification for grouped asset expansion and executable handling
|
|
355
|
+
|
|
356
|
+
## Architecture Notes
|
|
357
|
+
|
|
358
|
+
The package is split into two main layers:
|
|
359
|
+
|
|
360
|
+
- packaging: install and sync the shipped assets into another repository
|
|
361
|
+
- runtime: `skill_agent.py` resolves, creates, refreshes, and prunes repo-local skills after installation
|
|
362
|
+
|
|
363
|
+
Runtime routing is recursive by design. A parent skill should hand off any reusable, multi-step sub-flow back into the same automation set with `python3 .claude/tools/skill_agent.py auto "<sub-task>" --json` instead of absorbing that logic into one oversized skill.
|
|
364
|
+
|
|
365
|
+
The packaging layer is manifest-driven. `package.json` declares three asset groups:
|
|
366
|
+
|
|
367
|
+
- `managed_assets`: always installed
|
|
368
|
+
- `optional_assets`: installed unless `--no-tests` is used
|
|
369
|
+
- `executable_assets`: copied assets that should receive executable permissions
|
|
370
|
+
|
|
371
|
+
Asset entries can point to either a single file or a directory. Directory entries are expanded recursively, which means related assets can now be grouped under one manifest path instead of repeating every file in multiple scripts.
|
|
372
|
+
|
|
373
|
+
## Extending The Package
|
|
374
|
+
|
|
375
|
+
### Add or change packaged assets
|
|
376
|
+
|
|
377
|
+
1. Put the asset under `assets/`.
|
|
378
|
+
2. Register it in `package.json` under `managed_assets` or `optional_assets`.
|
|
379
|
+
3. If the copied file should be executable, also add the same relative path to `executable_assets`.
|
|
380
|
+
4. Run `python3 scripts/sync_assets.py` if the source-of-truth file lives outside `assets/`.
|
|
381
|
+
5. Verify the installer with `python3 scripts/install.py --target /tmp/skill-automation-package-dry-run --dry-run`.
|
|
382
|
+
|
|
383
|
+
Why this is simpler now:
|
|
384
|
+
|
|
385
|
+
- `scripts/install.py` and `scripts/sync_assets.py` both read the same layout from `scripts/package_layout.py`
|
|
386
|
+
- directory assets expand automatically during copy, so adding a new file inside a managed directory usually does not require code changes
|
|
387
|
+
|
|
388
|
+
### Extend `skill_agent.py`
|
|
389
|
+
|
|
390
|
+
The CLI parser is now command-spec driven. New subcommands are registered through `build_command_specs()` instead of manually growing `build_parser()`.
|
|
391
|
+
|
|
392
|
+
Typical flow for a new command:
|
|
393
|
+
|
|
394
|
+
1. Implement `cmd_<name>(args)`.
|
|
395
|
+
2. Add a `CliCommand(...)` entry in `build_command_specs()`.
|
|
396
|
+
3. Use `cli_argument(...)` entries for parser arguments, or a dedicated `configure=` function when the command needs more setup.
|
|
397
|
+
|
|
398
|
+
This keeps parser wiring declarative and makes command additions lower risk because the registration logic lives in one table.
|
|
399
|
+
|
|
400
|
+
## Maintenance
|
|
401
|
+
|
|
402
|
+
If you update the source package inside a working repository, resync the packaged assets with:
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
python3 scripts/sync_assets.py
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
`sync_assets.py` looks for the nearest matching parent repository that already contains the live `.claude` source tree. If the source-of-truth lives somewhere else, point at it explicitly:
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
python3 scripts/sync_assets.py --source-root /path/to/source-repo
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
Then reinstall into a target repository or regenerate the published package commit as needed.
|
|
415
|
+
|
|
416
|
+
When you need to publish changes from a stale or dirty local checkout, use the documented worktree-based flow in `docs/operations/publish-workflow.md` instead of committing directly on the old checkout.
|
|
417
|
+
|
|
418
|
+
For npm-specific release flow, version/tag rules, and reinstall-based lifecycle notes, see `docs/operations/npm-release-workflow.md`.
|
|
419
|
+
|
|
420
|
+
## Verification
|
|
421
|
+
|
|
422
|
+
From a repository that contains the package source and packaged tests:
|
|
423
|
+
|
|
424
|
+
```bash
|
|
425
|
+
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s .claude/tests -p 'test_*.py'
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
From this package repository, you can also run:
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests -p 'test_*.py'
|
|
432
|
+
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s assets/.claude/tests -p 'test_*.py'
|
|
433
|
+
PYTHONDONTWRITEBYTECODE=1 python3 scripts/install.py --target /tmp/skill-automation-package-dry-run --dry-run
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Equivalent maintenance helpers are also exposed in `package.json` under `test`, `test:assets`, `install:dry-run`, and `sync-assets`.
|
|
437
|
+
Those script wrappers set `PYTHONDONTWRITEBYTECODE=1` so routine verification does not leave Python bytecode behind in the packaged asset tree.
|
|
438
|
+
|
|
439
|
+
## License
|
|
440
|
+
|
|
441
|
+
MIT
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-skill-router
|
|
3
|
+
description: Search, rank, scaffold, and refresh repo-local skills inside .claude/skills. Use when an agent should find an existing reusable workflow before coding, or create a new project skill for work that is likely to repeat.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Project Skill Router
|
|
7
|
+
|
|
8
|
+
## Goal
|
|
9
|
+
|
|
10
|
+
Reuse the smallest suitable local skill first, and create a new one only when the workflow is reusable and no good match already exists.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
1. Start non-trivial work with `python3 .claude/tools/skill_agent.py auto "<task>" --json` so the repo can either reuse an existing skill or generate one immediately.
|
|
15
|
+
2. If `auto` returns `reuse`, open that skill's `SKILL.md` and follow it instead of inventing a new workflow.
|
|
16
|
+
3. If `auto` returns `created`, use the generated skill right away and refine it only if the task reveals a real gap.
|
|
17
|
+
4. If a step inside the current workflow grows into its own repeatable, non-trivial subtask, rerun `python3 .claude/tools/skill_agent.py auto "<sub-task>" --json`, follow the matched or generated sub-skill, then resume the parent workflow.
|
|
18
|
+
5. If the task is novel and you want inspection before writing files, run `python3 .claude/tools/skill_agent.py auto "<task>" --dry-run --json`.
|
|
19
|
+
6. Review reuse health with `python3 .claude/tools/skill_agent.py usage`, inspect refresh candidates with `python3 .claude/tools/skill_agent.py review`, and archive stale skills with `python3 .claude/tools/skill_agent.py prune --apply`.
|
|
20
|
+
7. Use `python3 .claude/tools/skill_agent.py update <skill-name> --apply` when a reused skill needs safer metadata refresh without rewriting the whole workflow.
|
|
21
|
+
8. Use `suggest`, `search`, `bootstrap`, or `create` only when you need more control than the default `auto` flow provides.
|
|
22
|
+
|
|
23
|
+
## Reuse Notes
|
|
24
|
+
|
|
25
|
+
- Local skills live in `.claude/skills/<skill-name>/`.
|
|
26
|
+
- Search by purpose, not only by name; the registry indexes category, tags, triggers, summary, and workflow steps.
|
|
27
|
+
- Keep `SKILL.md` concise and procedural. Put structured metadata in the companion `skill.json`, including validation and example requests when available.
|
|
28
|
+
- `auto` refreshes the registry after generating a new skill, so future sessions can find it immediately.
|
|
29
|
+
- During execution, route reusable sub-steps back through `python3 .claude/tools/skill_agent.py auto "<sub-task>" --json` instead of expanding the parent skill indefinitely.
|
|
30
|
+
- Reuse frequency is tracked in `.claude/skills/usage.json`; low-value skills are archived into `.claude/skills/_archived/`.
|
|
31
|
+
- Reused skills with thin or stale metadata can be reviewed with `review` and safely patched with `update`; use `management_mode: "locked"` in `skill.json` to opt a skill out.
|
|
32
|
+
- Prefer creating a skill only for repeatable, multi-step workflows. Do not create one-off skills for a single narrow edit.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"category": "workflow",
|
|
3
|
+
"summary": "Route agents to the best existing local skill, or scaffold a new reusable one.",
|
|
4
|
+
"tags": [
|
|
5
|
+
"skills",
|
|
6
|
+
"registry",
|
|
7
|
+
"search",
|
|
8
|
+
"reuse",
|
|
9
|
+
"automation",
|
|
10
|
+
"subtask"
|
|
11
|
+
],
|
|
12
|
+
"triggers": [
|
|
13
|
+
"find the right local skill for this task",
|
|
14
|
+
"search reusable workflow",
|
|
15
|
+
"create a new repo-local skill",
|
|
16
|
+
"refresh the skill registry",
|
|
17
|
+
"preview a generated skill",
|
|
18
|
+
"automatically resolve or create a local skill",
|
|
19
|
+
"review skill usage health",
|
|
20
|
+
"archive stale skills",
|
|
21
|
+
"review stale skill metadata",
|
|
22
|
+
"update a reused local skill",
|
|
23
|
+
"route a workflow step into the skill automation set",
|
|
24
|
+
"resolve a reusable subtask while following a parent workflow"
|
|
25
|
+
],
|
|
26
|
+
"steps": [
|
|
27
|
+
"Start non-trivial tasks with the auto resolver so the repo can reuse or generate a skill.",
|
|
28
|
+
"Reuse the best-matching skill when the score is strong enough.",
|
|
29
|
+
"If a workflow step grows into its own repeatable subtask, rerun the auto resolver for that subtask before expanding the parent flow.",
|
|
30
|
+
"Preview generated skills before writing them when the task is new.",
|
|
31
|
+
"Create a new skill only for repeatable multi-step work.",
|
|
32
|
+
"Review usage and cleanup candidates before the skill catalog grows stale.",
|
|
33
|
+
"Review stale or thin metadata before patching a frequently reused skill.",
|
|
34
|
+
"Refresh the registry after skill changes."
|
|
35
|
+
],
|
|
36
|
+
"validation": [
|
|
37
|
+
"Confirm the generated skill includes reusable workflow steps and validation guidance.",
|
|
38
|
+
"Refresh the registry after skill changes so the new skill is searchable.",
|
|
39
|
+
"Check usage reports before archiving any low-value skill.",
|
|
40
|
+
"Preview refresh candidates before applying metadata updates to an existing skill."
|
|
41
|
+
],
|
|
42
|
+
"examples": [
|
|
43
|
+
"Automatically resolve or create the right local skill for a new task.",
|
|
44
|
+
"Preview a new local skill from a task description before saving it.",
|
|
45
|
+
"Search existing local skills and reuse the best match instead of inventing a new workflow.",
|
|
46
|
+
"While following a parent workflow, route a reusable subtask through the automation set.",
|
|
47
|
+
"Review reuse frequency and archive stale local skills.",
|
|
48
|
+
"Inspect refresh candidates and update a stale but still useful skill."
|
|
49
|
+
]
|
|
50
|
+
}
|