skanvil 0.0.0-stage → 1.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/ARCHITECTURE.md +83 -0
- package/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/README.md +163 -2
- package/agent-skill/skanvil/SKILL.md +157 -0
- package/agent-skill/skanvil/references/REFERENCE.md +96 -0
- package/dist/chunk-TYO4LLN5.js +2112 -0
- package/dist/cli.js +774 -0
- package/dist/index.d.ts +1082 -0
- package/dist/index.js +66 -0
- package/docs/api.md +131 -0
- package/docs/commands.md +219 -0
- package/docs/configuration.md +126 -0
- package/docs/getting-started.md +128 -0
- package/docs/sync.md +117 -0
- package/docs/templates.md +73 -0
- package/docs/validation.md +137 -0
- package/package.json +86 -4
- package/schema.json +171 -0
- package/templates/library/.github/copilot-instructions.md +24 -0
- package/templates/library/.github/workflows/skills.yml +18 -0
- package/templates/library/AGENTS.md +9 -0
- package/templates/library/ARCHITECTURE.md +15 -0
- package/templates/library/README.md +20 -0
- package/templates/library/gitignore +3 -0
- package/templates/library/package.json +26 -0
- package/templates/library/skills/.gitkeep +0 -0
- package/templates/skill/SKILL.md +42 -0
- package/templates/skill/assets/output-template.md +19 -0
- package/templates/skill/references/REFERENCE.md +16 -0
- package/templates/skill/scripts/example-helper.js +12 -0
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
skanvil is a TypeScript ESM package. `tsup` bundles `src/` into `dist/` with two entry points: `dist/cli.js` (the `skanvil` binary) and `dist/index.js` (the programmatic API, typed by `dist/index.d.ts`).
|
|
4
|
+
|
|
5
|
+
## Module map
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
src/
|
|
9
|
+
├── cli.ts commander program: commands, options, error → exit code
|
|
10
|
+
├── index.ts public API (re-exports from core/ and commands/)
|
|
11
|
+
├── commands/ thin CLI layer: options → core call → text or JSON output
|
|
12
|
+
│ ├── shared.ts --cwd handling, diagnostic printing, post-mutation validation
|
|
13
|
+
│ ├── skills.ts add, edit, list (interactive prompts via @inquirer/prompts)
|
|
14
|
+
│ ├── library.ts init, validate, index, doctor, templates eject, install-skill, sync
|
|
15
|
+
│ └── wizard.ts interactive menu-driven assistant on top of the same core calls
|
|
16
|
+
├── core/ all behaviour; no console output, no process exit
|
|
17
|
+
│ ├── config.ts .skanvilrc.json zod schema, default preset, resolution and checks
|
|
18
|
+
│ ├── categories.ts id/alias lookup, longest-prefix inference, name and title building
|
|
19
|
+
│ ├── library.ts Library: paths, skill listing, SKILL.md and README I/O (keeps EOL)
|
|
20
|
+
│ ├── skill.ts SkillFile: frontmatter as a YAML Document (round-trip safe)
|
|
21
|
+
│ ├── readme-index.ts pure functions over the README index (LF text in, LF text out)
|
|
22
|
+
│ ├── validate.ts rule registry and engine → Diagnostic[]
|
|
23
|
+
│ ├── skills.ts scaffoldSkill, editSkill (transactional), removeSkill
|
|
24
|
+
│ ├── reindex.ts rebuildIndex (regenerate) and reconcileIndex (minimal repair)
|
|
25
|
+
│ ├── doctor.ts diagnosis and automatic fixes
|
|
26
|
+
│ ├── templates.ts {{variable}} rendering, template lookup, eject
|
|
27
|
+
│ ├── sync.ts installation into agent folders, manifest, pruning
|
|
28
|
+
│ ├── agent-skill.ts install/update the bundled `skanvil` agent skill
|
|
29
|
+
│ ├── init.ts createLibrary
|
|
30
|
+
│ └── naming.ts kebab-case, title case, sentences
|
|
31
|
+
└── util/ paths (package root via import.meta.url), eol, fs, output
|
|
32
|
+
|
|
33
|
+
agent-skill/skanvil/ the `skanvil` agent skill (SKILL.md + references/) shipped to users
|
|
34
|
+
|
|
35
|
+
templates/
|
|
36
|
+
├── library/ skeleton copied by `init` (gitignore is renamed to .gitignore)
|
|
37
|
+
└── skill/ default skill: SKILL.md + assets/, references/, scripts/
|
|
38
|
+
|
|
39
|
+
tests/ vitest: unit, core end-to-end, and real-CLI suites (tests/setup bundles the CLI)
|
|
40
|
+
scripts/build-schema.mjs writes schema.json from the zod schema after the build
|
|
41
|
+
docs/ user guides (docs/assets is not published to npm)
|
|
42
|
+
.github/workflows/ ci.yml (lint, format, typecheck, build, test) and release.yml (release-please PR + npm publish after green CI on main)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Data flow
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
skanvil add --type front --name x --description y
|
|
49
|
+
│
|
|
50
|
+
▼
|
|
51
|
+
cli.ts ──► commands/skills.ts: addCommand(options)
|
|
52
|
+
│ openLibrary(--cwd) ──► core/library.ts: Library.open
|
|
53
|
+
│ └─ core/config.ts: loadConfig → resolveConfig
|
|
54
|
+
▼
|
|
55
|
+
core/skills.ts: scaffoldSkill(library, …)
|
|
56
|
+
├─ categories.buildName / buildTitle
|
|
57
|
+
├─ templates.resolveSkillTemplate → copyTemplateDir (renderSkillMarkdown)
|
|
58
|
+
├─ SkillFile: apply category metadata
|
|
59
|
+
└─ readme-index.insertEntry → library.writeReadme
|
|
60
|
+
▼
|
|
61
|
+
commands/shared.ts: validateAfter ──► core/validate.ts: validateLibrary
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Every command follows the same pattern:
|
|
65
|
+
|
|
66
|
+
1. The command opens a `Library`, which loads and resolves the config.
|
|
67
|
+
2. It calls a core function.
|
|
68
|
+
3. It prints the result with `Output`, as text or JSON.
|
|
69
|
+
|
|
70
|
+
Core functions accept a `Library`, or a root path, and never print.
|
|
71
|
+
|
|
72
|
+
## Design decisions
|
|
73
|
+
|
|
74
|
+
- **Configuration over constants.** Nothing about a library's conventions is hard-coded: prefixes, README titles, aliases, per-category metadata, required sections and placeholders all live in `.skanvilrc.json`. `DEFAULT_CATEGORIES` is applied when a library has no `categories`.
|
|
75
|
+
- **One prefix-less default category.** A folder belongs to the category with the longest matching prefix, otherwise to the default one. The config loader rejects ambiguous setups: two defaults, a prefix that starts with another prefix, or duplicated aliases or titles.
|
|
76
|
+
- **Plain-markdown README index.** Entries are `- Title` / `\t- Description:` / `` \t- Folder: `skills/x` `` inside `<details><summary><strong>Title</strong></summary>`. `readme-index.ts` works on LF strings only; `Library` detects CRLF on read and restores it on write.
|
|
77
|
+
- **Real YAML, minimal diffs.** `SkillFile` keeps a `yaml` Document. Untouched frontmatter is written back byte for byte, and edited frontmatter is re-serialised without line folding. Template values in the frontmatter are YAML-escaped.
|
|
78
|
+
- **Transactional edits.** `editSkill` computes the new `SKILL.md` and README in memory, writes them, and renames the folder last. On failure it restores both files.
|
|
79
|
+
- **Structured diagnostics.** Each diagnostic carries `rule`, `severity`, `skill`, `message` and `fixable`. This one shape drives text output, `--json`, `doctor --fix` and the sync safety check.
|
|
80
|
+
- **Idempotent sync.** A `.skanvil-sync.json` manifest per target is the only authority on what skanvil may update or delete, so foreign skills are never touched. `--link` uses junctions on Windows, which need no admin rights.
|
|
81
|
+
- **The tool documents itself for agents.** `agent-skill/skanvil` is a normal Agent Skill. A test validates it with skanvil's own default rules, and it must contain no warnings. Installed copies are stamped with `metadata.skanvil-version`; the stamp marks the folder as owned by skanvil, so it can be updated after upgrades.
|
|
82
|
+
- **Templates are data.** Changing how a skill or a library looks never requires touching `src/`.
|
|
83
|
+
- **Supported Node versions drive dependency choices.** Dependencies are pinned to majors that support Node 20: commander 14, @inquirer/prompts 7 and vitest 3.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. Entries are generated by
|
|
4
|
+
[release-please](https://github.com/googleapis/release-please) from
|
|
5
|
+
[Conventional Commits](https://www.conventionalcommits.org/), and versions follow
|
|
6
|
+
[Semantic Versioning](https://semver.org/).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jose Manuel Bargueño López
|
|
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
CHANGED
|
@@ -1,3 +1,164 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/logo.png" alt="skanvil" width="480">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
# skanvil
|
|
6
|
+
|
|
7
|
+
[](https://github.com/JMBargueno/skanvil/actions/workflows/ci.yml)
|
|
8
|
+
[](https://www.npmjs.com/package/skanvil)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
|
|
11
|
+
**Forge, validate and ship libraries of [Agent Skills](https://agentskills.io/specification).**
|
|
12
|
+
|
|
13
|
+
skanvil is a CLI and Node.js library for teams that maintain a shared set of agent skills, such as a frontend review checklist, a backend migration playbook or an internal release workflow. Each skill lives in its own `SKILL.md`. skanvil handles the repetitive work around them:
|
|
14
|
+
|
|
15
|
+
- **Scaffolds** new skills from templates, with the right folder prefix, frontmatter and README entry.
|
|
16
|
+
- **Keeps everything in sync** when you rename, re-categorise or delete a skill.
|
|
17
|
+
- **Validates** every skill against the Agent Skills spec and your own conventions, locally or in CI.
|
|
18
|
+
- **Installs** the skills into the folders that coding agents read (`.claude/skills`, `.github/skills`, `.agents/skills`), in any project.
|
|
19
|
+
- **Teaches agents to use it.** skanvil ships its own `skanvil` agent skill, so Claude Code, Copilot or Codex working in your library run the CLI correctly instead of editing folders and the README by hand.
|
|
20
|
+
|
|
21
|
+
## What is a skills library?
|
|
22
|
+
|
|
23
|
+
A git repository (and optionally an npm package) with this layout:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
my-skills/
|
|
27
|
+
├── skills/
|
|
28
|
+
│ ├── front-api-review/ # one folder per skill
|
|
29
|
+
│ │ ├── SKILL.md # YAML frontmatter + instructions
|
|
30
|
+
│ │ ├── references/ # optional long-form guidance
|
|
31
|
+
│ │ ├── scripts/ # optional helpers
|
|
32
|
+
│ │ └── assets/ # optional templates
|
|
33
|
+
│ └── back-migrations/
|
|
34
|
+
├── .claude/skills/skanvil/ # the skanvil agent skill, installed by `init`
|
|
35
|
+
├── README.md # human-readable index, maintained by skanvil
|
|
36
|
+
└── .skanvilrc.json # categories, validation rules, sync targets
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Skills are grouped into **categories**, and each category has a folder prefix and a README section. Out of the box these are `front-`, `back-`, prefix-less _transversal_ skills and `_internal` skills. You can define your own categories in `.skanvilrc.json`.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install --save-dev skanvil # or run any command with npx skanvil …
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Requires Node.js 20 or later.
|
|
48
|
+
|
|
49
|
+
## Quick start
|
|
50
|
+
|
|
51
|
+
**The easy way: run `npx skanvil`** with no arguments in a terminal. A wizard guides you through it:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
$ npx skanvil
|
|
55
|
+
skanvil 1.0.0 · interactive mode · Ctrl+C to quit
|
|
56
|
+
? This folder (projects) is not a skills library. What do you want to do?
|
|
57
|
+
❯ Create a new skills library
|
|
58
|
+
Install skills from a library into this folder
|
|
59
|
+
Install or update the skanvil agent skill
|
|
60
|
+
Exit
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
What the wizard covers:
|
|
64
|
+
|
|
65
|
+
- **Outside a library:** creating one, with your own categories if you want.
|
|
66
|
+
- **Inside a library:** adding, editing, moving and deleting skills, checking and repairing the library, and installing the skills into a project or for your user. Installs show a preview before anything is written.
|
|
67
|
+
- **Learning the flags:** after each action it prints the equivalent command, ready for scripts and CI.
|
|
68
|
+
|
|
69
|
+
**Author a library with commands:**
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npx skanvil init my-skills --scope acme
|
|
73
|
+
cd my-skills && npm install
|
|
74
|
+
|
|
75
|
+
npx skanvil add --type front --name "API review" \
|
|
76
|
+
--description "Reviews API integration changes for error handling and typing."
|
|
77
|
+
npx skanvil edit front-api-review --rename http-review --type back
|
|
78
|
+
npx skanvil list
|
|
79
|
+
npx skanvil validate --strict
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Use it in a project:**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# from a local checkout
|
|
86
|
+
npx skanvil sync ../my-app -C ./my-skills --target claude,copilot
|
|
87
|
+
|
|
88
|
+
# or from the published package
|
|
89
|
+
cd my-app
|
|
90
|
+
npm install --save-dev @acme/my-skills skanvil
|
|
91
|
+
npx skanvil sync --from @acme/my-skills --target claude
|
|
92
|
+
|
|
93
|
+
# or for every project on your machine (~/.claude/skills, ~/.copilot/skills, ~/.agents/skills)
|
|
94
|
+
npx skanvil sync -C ./my-skills --global --target claude,copilot
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Commands
|
|
98
|
+
|
|
99
|
+
| Command | What it does |
|
|
100
|
+
| ------------------------------ | --------------------------------------------------------------------------------- |
|
|
101
|
+
| `skanvil` / `skanvil wizard` | Interactive assistant (in a terminal; without one, `skanvil` prints the help). |
|
|
102
|
+
| `skanvil init [dir]` | Create a new library. |
|
|
103
|
+
| `skanvil add` | Create a skill from a template and index it (interactive if options are missing). |
|
|
104
|
+
| `skanvil edit <skill>` | Rename, re-categorise, retitle, redescribe or remove a skill. Transactional. |
|
|
105
|
+
| `skanvil list` | Table of skills with category, README presence, validity and description. |
|
|
106
|
+
| `skanvil validate` | Check the spec and conventions. Exits 1 on errors. |
|
|
107
|
+
| `skanvil index` | Regenerate the README index (`--check` for CI). |
|
|
108
|
+
| `skanvil doctor` | Diagnose problems; `--fix` repairs what it can. |
|
|
109
|
+
| `skanvil templates eject` | Copy the skill template into the library to customise it. |
|
|
110
|
+
| `skanvil sync [dest]` | Install skills into agent folders of a project. |
|
|
111
|
+
| `skanvil install-skill [dest]` | Install or update the `skanvil` agent skill in a project. |
|
|
112
|
+
|
|
113
|
+
Every command accepts `--json`, and every command that works on a library accepts `-C, --cwd <path>`. The [command reference](docs/commands.md) lists every option.
|
|
114
|
+
|
|
115
|
+
## The skanvil agent skill
|
|
116
|
+
|
|
117
|
+
skanvil includes an Agent Skill, [`agent-skill/skanvil`](agent-skill/skanvil/SKILL.md), that explains the tool to coding agents. It covers:
|
|
118
|
+
|
|
119
|
+
- how to recognise a skills library;
|
|
120
|
+
- the golden rules: use `add`/`edit` instead of touching folders or the README, and pass every option in non-interactive shells;
|
|
121
|
+
- recipes for common tasks;
|
|
122
|
+
- how to write good skill content;
|
|
123
|
+
- a table from each validation diagnostic to its fix.
|
|
124
|
+
|
|
125
|
+
`skanvil init` installs it into new libraries, in the configured sync targets (`.claude/skills` by default). To add or refresh it in any repository:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npx skanvil install-skill --target claude,copilot,agents # in the current project
|
|
129
|
+
npx skanvil install-skill --global --target claude # for every project
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Installed copies are stamped with the skanvil version, so running the command again after upgrading updates them. A `skanvil` folder you wrote yourself is never overwritten without `--force`.
|
|
133
|
+
|
|
134
|
+
## Documentation
|
|
135
|
+
|
|
136
|
+
| Guide | |
|
|
137
|
+
| ------------------------------------------ | ---------------------------------------------------------------------- |
|
|
138
|
+
| [Getting started](docs/getting-started.md) | Build, validate, publish and consume a library, step by step. |
|
|
139
|
+
| [Commands](docs/commands.md) | Every command, option and exit code. |
|
|
140
|
+
| [Configuration](docs/configuration.md) | `.skanvilrc.json` reference: categories, validation, templates, sync. |
|
|
141
|
+
| [Validation rules](docs/validation.md) | Every rule, its severity and how to tune it. CI recipes. |
|
|
142
|
+
| [Templates](docs/templates.md) | Customising the skill template per library or category. |
|
|
143
|
+
| [Sync](docs/sync.md) | Installing skills into Claude Code, GitHub Copilot and Codex projects. |
|
|
144
|
+
| [API](docs/api.md) | Using skanvil from Node.js. |
|
|
145
|
+
| [Architecture](ARCHITECTURE.md) | How the code is organised. |
|
|
146
|
+
| [Contributing](CONTRIBUTING.md) | Development setup and conventions. |
|
|
147
|
+
|
|
148
|
+
## Programmatic API
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
import { Library, scaffoldSkill, validateLibrary, syncSkills } from "skanvil";
|
|
152
|
+
|
|
153
|
+
const lib = await Library.open("./my-skills");
|
|
154
|
+
await scaffoldSkill(lib, { type: "front", name: "a11y", description: "Audits accessibility." });
|
|
155
|
+
|
|
156
|
+
const { errors, diagnostics } = await validateLibrary(lib);
|
|
157
|
+
if (errors === 0) await syncSkills(lib, { dest: "../my-app", targets: ["claude"] });
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Every export is fully typed and documented; see the [API guide](docs/api.md).
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
|
|
164
|
+
[MIT](LICENSE) © Jose Manuel Bargueño López. See the [changelog](CHANGELOG.md) for release notes.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skanvil
|
|
3
|
+
description: Operate skanvil, the CLI that manages libraries of Agent Skills (a skills/ folder of SKILL.md files, a README index and a .skanvilrc.json). Use it whenever you create, rename, re-categorise, delete, validate or index skills in a repository that has a .skanvilrc.json or depends on skanvil, when fixing skanvil validation errors, or when installing skills into a project's .claude/skills, .github/skills or .agents/skills folders.
|
|
4
|
+
metadata:
|
|
5
|
+
author: skanvil
|
|
6
|
+
version: "1.0"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# skanvil
|
|
10
|
+
|
|
11
|
+
## Objective
|
|
12
|
+
|
|
13
|
+
Change skills libraries through the `skanvil` CLI, so that skill folders, the `SKILL.md` frontmatter, the README index and the library conventions stay consistent and validation stays green.
|
|
14
|
+
|
|
15
|
+
## When to Activate This Skill
|
|
16
|
+
|
|
17
|
+
- The repository has a `.skanvilrc.json`, a `skills/` folder of `SKILL.md` files, or `skanvil` in its `package.json`.
|
|
18
|
+
- The user asks to add, write, rename, move, retitle, redescribe, delete, list, validate or index skills.
|
|
19
|
+
- `skanvil validate`, `npm test` or CI fails with skanvil diagnostics.
|
|
20
|
+
- The user wants a library's skills available to Claude Code, GitHub Copilot or Codex in another project.
|
|
21
|
+
|
|
22
|
+
## Instructions
|
|
23
|
+
|
|
24
|
+
### 1. Orient yourself
|
|
25
|
+
|
|
26
|
+
1. Read `.skanvilrc.json`. It defines the categories (`id`, folder `prefix`, README `title`, `aliases`), the required sections, placeholders and rule severities. A missing file means the default preset: `front-`, `back-`, prefix-less `transversal` (the default) and `_internal`.
|
|
27
|
+
2. Run `npx skanvil list --json` to see every skill with its category, README presence and validity.
|
|
28
|
+
3. Run `npx skanvil validate --json` before changing anything, so you know which problems already existed.
|
|
29
|
+
|
|
30
|
+
### 2. Golden rules
|
|
31
|
+
|
|
32
|
+
- **Never rename, move or delete skill folders by hand, and never hand-edit the README index.** Use `skanvil edit`, which keeps the folder, the frontmatter `name`, the `# heading` and the README entry in sync, and rolls back on failure.
|
|
33
|
+
- **Never create skill folders by hand.** Use `skanvil add`, which applies the category prefix, the template, the frontmatter metadata and the README entry.
|
|
34
|
+
- **Always pass every option in non-interactive shells.** `add` needs `--type`, `--name` and `--description`. `edit --remove` needs `--yes`. Otherwise the command prompts, or fails without a TTY.
|
|
35
|
+
- **Never run `skanvil` without arguments or `skanvil wizard`.** They open an interactive menu meant for humans. Use the explicit commands below. If the user prefers menus, suggest they run `npx skanvil` themselves.
|
|
36
|
+
- Add `--json` whenever you need to parse output. Data goes to stdout; warnings and errors go to stderr.
|
|
37
|
+
- Run `npx skanvil validate` after every change and finish with no errors. Exit code `1` means errors, or warnings when `--strict` is used.
|
|
38
|
+
- Prefix every command with `npx` unless `skanvil` is on PATH. Use `-C <path>` to target a library in another folder.
|
|
39
|
+
|
|
40
|
+
### 3. Common tasks
|
|
41
|
+
|
|
42
|
+
**Create a skill, then write its content.**
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx skanvil add --type <category> --name "<short name>" \
|
|
46
|
+
--description "<what it does>. Use when <trigger situations>."
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then edit `skills/<prefix><name>/SKILL.md`:
|
|
50
|
+
|
|
51
|
+
- Fill every required section with concrete, actionable content.
|
|
52
|
+
- Replace all the generic template sentences. Until you do, `validate` reports a `template-unchanged` warning, and `validate --strict` (the library's `npm test`) fails.
|
|
53
|
+
- Move long material into `references/`, and link only to files that exist (`broken-references`).
|
|
54
|
+
|
|
55
|
+
Use `--no-scripts`, `--no-assets` or `--no-references` when those folders would stay empty. Use `--template <name>` for a custom template in `.skanvil/templates/`.
|
|
56
|
+
|
|
57
|
+
**Rename or move a skill.**
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx skanvil edit <skill> --rename <new-name> # prefix is re-applied automatically
|
|
61
|
+
npx skanvil edit <skill> --type <other-category> # new prefix, README section, metadata
|
|
62
|
+
npx skanvil edit <skill> --title "<Title>" --description "<text>"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`--rename` takes the base name: `edit front-a --rename b` gives `front-b`.
|
|
66
|
+
|
|
67
|
+
**Delete a skill.** Confirm with the user first; this is permanent.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx skanvil edit <skill> --remove --yes
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Fix validation errors.**
|
|
74
|
+
|
|
75
|
+
1. Run `npx skanvil doctor --fix`. It repairs README entries, `name` mismatches, tabs in the frontmatter and converts `tools` to `allowed-tools`.
|
|
76
|
+
2. Fix what remains by editing `SKILL.md`. Use the diagnostic table below.
|
|
77
|
+
3. Run `npx skanvil validate` again.
|
|
78
|
+
|
|
79
|
+
**Rebuild the README index** after changing category titles in `.skanvilrc.json`:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx skanvil index # rewrites the index sections
|
|
83
|
+
npx skanvil index --check # verify only (CI)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Install the skills into a project.**
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx skanvil sync <project-dir> -C <library-dir> --target claude,copilot --dry-run # preview
|
|
90
|
+
npx skanvil sync <project-dir> -C <library-dir> --target claude,copilot
|
|
91
|
+
npx skanvil sync --from @scope/package --target agents # installed package
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Targets:
|
|
95
|
+
|
|
96
|
+
- `claude` installs into `.claude/skills`;
|
|
97
|
+
- `copilot` installs into `.github/skills`;
|
|
98
|
+
- `agents` and `codex` install into `.agents/skills`.
|
|
99
|
+
- A custom path must be a folder inside the project.
|
|
100
|
+
- `--global` (with no project dir) installs into the user's `~/.claude/skills`, `~/.copilot/skills` or `~/.agents/skills` instead. Only use it when the user asks for skills available in every project.
|
|
101
|
+
|
|
102
|
+
How sync behaves:
|
|
103
|
+
|
|
104
|
+
- It never overwrites folders it did not install.
|
|
105
|
+
- It prunes skills that were removed from the library.
|
|
106
|
+
- It skips skills with validation errors unless `--force` is given.
|
|
107
|
+
- It never publishes `_internal` skills.
|
|
108
|
+
|
|
109
|
+
**Add or change categories.** Edit `categories` in `.skanvilrc.json`:
|
|
110
|
+
|
|
111
|
+
- exactly one category has `"default": true` and no prefix;
|
|
112
|
+
- every other category has a prefix that is `_` or kebab-case ending in `-`;
|
|
113
|
+
- no prefix may start with another prefix.
|
|
114
|
+
|
|
115
|
+
Then move existing skills with `edit --type`, and run `skanvil index`.
|
|
116
|
+
|
|
117
|
+
### 4. Write good skill content
|
|
118
|
+
|
|
119
|
+
- **`description`** says _what_ the skill does and _when_ to use it, with the trigger keywords an agent would see. It must be at most 1024 characters.
|
|
120
|
+
- **`name`** equals the folder name: lowercase letters, digits and single hyphens, at most 64 characters.
|
|
121
|
+
- **Body:** keep `SKILL.md` under 500 lines. Write instructions as numbered, verifiable steps, and put examples, edge cases and long checklists in `references/` (one level deep).
|
|
122
|
+
- **Placeholders:** never leave filler text. Any entry of `validation.placeholders` (to-do markers, dummy Latin text, "to be decided" notes) fails validation.
|
|
123
|
+
- **`metadata`:** string values only, so quote numbers, as in `version: "1.0"`.
|
|
124
|
+
- **`allowed-tools`:** a space-separated string, not a list.
|
|
125
|
+
|
|
126
|
+
### 5. Diagnostic → fix
|
|
127
|
+
|
|
128
|
+
| Rule | Fix |
|
|
129
|
+
| --------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
130
|
+
| `readme-missing`, `readme-orphan`, `readme-section` | `npx skanvil doctor --fix` |
|
|
131
|
+
| `name-matches-folder`, `name-required` | `doctor --fix`, or `edit --rename` if the folder name is wrong |
|
|
132
|
+
| `frontmatter-tabs`, `tools-field` | `doctor --fix` |
|
|
133
|
+
| `frontmatter` | Repair the YAML between the `---` lines (quote values containing `: ` or `#`). |
|
|
134
|
+
| `required-sections` | Add the missing `## Section` listed in `validation.requiredSections`. |
|
|
135
|
+
| `placeholders` | Replace the placeholder text with real content. |
|
|
136
|
+
| `description-length`, `max-lines` | Shorten; move detail to `references/`. |
|
|
137
|
+
| `metadata-format` | Quote non-string values. |
|
|
138
|
+
| `duplicate-name` | Two folders share a `name`: rename one with `edit --rename`. |
|
|
139
|
+
| `broken-references` | Create the referenced file, or fix the link (paths are relative to the skill). |
|
|
140
|
+
| `template-unchanged` | Rewrite the generic scaffold sentences with skill-specific instructions. |
|
|
141
|
+
|
|
142
|
+
See [references/REFERENCE.md](references/REFERENCE.md) for every command option, the config schema and JSON output shapes.
|
|
143
|
+
|
|
144
|
+
## Output Format
|
|
145
|
+
|
|
146
|
+
Report to the user:
|
|
147
|
+
|
|
148
|
+
- the skanvil commands you ran;
|
|
149
|
+
- the skills created, changed or removed, with their folder names;
|
|
150
|
+
- the final `skanvil validate` result (errors and warnings), and anything left for them to decide.
|
|
151
|
+
|
|
152
|
+
## Quality Criteria
|
|
153
|
+
|
|
154
|
+
- Every structural change went through `skanvil add` or `skanvil edit`. There are no hand-made folder renames or README index edits.
|
|
155
|
+
- `npx skanvil validate` reports no errors, and `npx skanvil index --check` passes.
|
|
156
|
+
- New or edited skills have specific descriptions with triggers, and no template filler or placeholders.
|
|
157
|
+
- Deletions and syncs into other projects were confirmed with the user.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# skanvil reference
|
|
2
|
+
|
|
3
|
+
## Commands
|
|
4
|
+
|
|
5
|
+
Every command accepts `-C, --cwd <path>` (library root) and `--json`. Exit code `0` means success; `1` means an error or failed check.
|
|
6
|
+
|
|
7
|
+
| Command | Options |
|
|
8
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
9
|
+
| `init [dir]` | `--name`, `--scope`, `--description`, `--profile front,back,transversal`, `--no-git`, `--eject-templates`, `--no-agent-skill`, `--target <preset\|path>` |
|
|
10
|
+
| `add` | `--type <category>`, `--name`, `--title`, `--description`, `--template <name>`, `--no-assets`, `--no-references`, `--no-scripts`, `--skip-validate` |
|
|
11
|
+
| `edit <skill>` | `--rename`, `--type`, `--title`, `--description`, `--remove`, `--yes`, `--skip-validate` |
|
|
12
|
+
| `list` | `--category <id>` |
|
|
13
|
+
| `validate` | `--strict`, `--skill <name>` |
|
|
14
|
+
| `index` | `--check` |
|
|
15
|
+
| `doctor` | `--fix` |
|
|
16
|
+
| `templates eject` | `--category <id>`, `--force` |
|
|
17
|
+
| `sync [dest]` | `--target <preset\|path>` (repeatable/comma-separated, must stay inside dest), `--from <pkg\|path>`, `--link`, `--copy`, `--category`, `--skill`, `--force`, `--dry-run`, `--global` (presets only, no dest) |
|
|
18
|
+
| `install-skill [dest]` | `--target <preset\|path>`, `--force`, `--global` (presets only, no dest) |
|
|
19
|
+
|
|
20
|
+
## `.skanvilrc.json`
|
|
21
|
+
|
|
22
|
+
```jsonc
|
|
23
|
+
{
|
|
24
|
+
"$schema": "./node_modules/skanvil/schema.json",
|
|
25
|
+
"name": "my-skills",
|
|
26
|
+
"skillsDir": "skills", // default
|
|
27
|
+
"readme": "README.md", // default
|
|
28
|
+
"categories": [
|
|
29
|
+
{
|
|
30
|
+
"id": "front", // used by --type
|
|
31
|
+
"prefix": "front-", // "" (default category only), "_" or kebab-case ending in "-"
|
|
32
|
+
"title": "Front", // README section title
|
|
33
|
+
"aliases": ["frontend", "f"],
|
|
34
|
+
"default": false, // exactly one category is the default (empty prefix)
|
|
35
|
+
"indexed": true, // listed in the README
|
|
36
|
+
"validated": true, // validated against the spec and syncable
|
|
37
|
+
"metadata": { "domain": "frontend" },
|
|
38
|
+
"compatibility": "Designed for frontend repositories."
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"validation": {
|
|
42
|
+
"requiredSections": [
|
|
43
|
+
"Objective",
|
|
44
|
+
"When to Activate This Skill",
|
|
45
|
+
"Instructions",
|
|
46
|
+
"Output Format",
|
|
47
|
+
"Quality Criteria"
|
|
48
|
+
],
|
|
49
|
+
"placeholders": ["TODO", "describe...", "lorem ipsum", "tbd", "to be defined"],
|
|
50
|
+
"maxLines": 500,
|
|
51
|
+
"rules": { "max-lines": "warn" } // error | warn | off per rule id
|
|
52
|
+
},
|
|
53
|
+
"templates": { "dir": ".skanvil/templates" },
|
|
54
|
+
"sync": { "targets": ["claude"], "mode": "copy" }
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Validation rules
|
|
59
|
+
|
|
60
|
+
Default severity is `error` unless noted. Rules marked with `*` are fixable by `doctor --fix`.
|
|
61
|
+
|
|
62
|
+
- **Files and YAML:** `skill-file`, `frontmatter`, `frontmatter-tabs`*.
|
|
63
|
+
- **Names:**
|
|
64
|
+
- `folder-name`;
|
|
65
|
+
- `name-required`*;
|
|
66
|
+
- `name-format`: 1–64 characters of `a-z0-9-`, with no leading, trailing or double hyphens;
|
|
67
|
+
- `name-matches-folder`*;
|
|
68
|
+
- `duplicate-name`.
|
|
69
|
+
- **Spec fields:**
|
|
70
|
+
- `description-required`;
|
|
71
|
+
- `description-length` (≤ 1024);
|
|
72
|
+
- `compatibility-length` (1–500);
|
|
73
|
+
- `metadata-format` (warn);
|
|
74
|
+
- `allowed-tools-format` (warn);
|
|
75
|
+
- `tools-field`* (warn).
|
|
76
|
+
- **Content:** `required-sections`, `placeholders`, `max-lines` (warn), `broken-references`, `template-unchanged` (warn).
|
|
77
|
+
- **README:** `readme-missing`_, `readme-orphan`_, `readme-section`*.
|
|
78
|
+
|
|
79
|
+
## JSON output shapes
|
|
80
|
+
|
|
81
|
+
- `list --json` prints `[{ name, type, indexed, valid, description }]`. `indexed` and `valid` are `null` for categories that are not indexed or not validated.
|
|
82
|
+
- `validate --json` prints `{ ok, diagnostics: [{ rule, severity, skill?, message, fixable? }], count, errors, warnings }`.
|
|
83
|
+
- `doctor --json` prints the same as validate, plus `fixes: string[]`.
|
|
84
|
+
- `index --json` prints `{ updated }`, or `{ upToDate }` with `--check`.
|
|
85
|
+
- `sync --json` prints `{ dryRun, mode, results: [{ target, path, added, updated, unchanged, removed, skipped: [{ skill, reason }], warnings }] }`.
|
|
86
|
+
- `add --json` prints `{ skillName, title, type, target, template }`.
|
|
87
|
+
- `edit --json` prints `{ skillName, previousName }`, or `{ removed }`.
|
|
88
|
+
|
|
89
|
+
## Template variables
|
|
90
|
+
|
|
91
|
+
The following variables are available in custom templates. In the `SKILL.md` frontmatter they are YAML-escaped automatically.
|
|
92
|
+
|
|
93
|
+
- `{{name}}`, `{{title}}`, `{{description}}`, `{{descriptionLower}}`;
|
|
94
|
+
- `{{category}}`, `{{domain}}`, `{{compatibility}}`;
|
|
95
|
+
- `{{resources}}`;
|
|
96
|
+
- `{{metadata.<key>}}`.
|