skanvil 0.0.0-stage → 1.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.
@@ -0,0 +1,85 @@
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, --param rendering
28
+ │ ├── params.ts params.json schema, template renderer ({{name}}, {{#if}}), value checks
29
+ │ ├── build.ts skanvil build: typed ESM/CJS exports with the renderer embedded
30
+ │ ├── agent-skill.ts install/update the bundled `skanvil` agent skill
31
+ │ ├── init.ts createLibrary
32
+ │ └── naming.ts kebab-case, title case, sentences
33
+ └── util/ paths (package root via import.meta.url), eol, fs, output
34
+
35
+ agent-skill/skanvil/ the `skanvil` agent skill (SKILL.md + references/) shipped to users
36
+
37
+ templates/
38
+ ├── library/ skeleton copied by `init` (gitignore is renamed to .gitignore)
39
+ └── skill/ default skill: SKILL.md + assets/, references/, scripts/
40
+
41
+ tests/ vitest: unit, core end-to-end, and real-CLI suites (tests/setup bundles the CLI)
42
+ scripts/build-schema.mjs writes schema.json from the zod schema after the build
43
+ docs/ user guides (docs/assets is not published to npm)
44
+ .github/workflows/ ci.yml (lint, format, typecheck, build, test) and release.yml (release-please PR + npm publish after green CI on main)
45
+ ```
46
+
47
+ ## Data flow
48
+
49
+ ```text
50
+ skanvil add --type front --name x --description y
51
+ │
52
+ ▼
53
+ cli.ts ──► commands/skills.ts: addCommand(options)
54
+ │ openLibrary(--cwd) ──► core/library.ts: Library.open
55
+ │ └─ core/config.ts: loadConfig → resolveConfig
56
+ ▼
57
+ core/skills.ts: scaffoldSkill(library, …)
58
+ ├─ categories.buildName / buildTitle
59
+ ├─ templates.resolveSkillTemplate → copyTemplateDir (renderSkillMarkdown)
60
+ ├─ SkillFile: apply category metadata
61
+ └─ readme-index.insertEntry → library.writeReadme
62
+ ▼
63
+ commands/shared.ts: validateAfter ──► core/validate.ts: validateLibrary
64
+ ```
65
+
66
+ Every command follows the same pattern:
67
+
68
+ 1. The command opens a `Library`, which loads and resolves the config.
69
+ 2. It calls a core function.
70
+ 3. It prints the result with `Output`, as text or JSON.
71
+
72
+ Core functions accept a `Library`, or a root path, and never print.
73
+
74
+ ## Design decisions
75
+
76
+ - **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`.
77
+ - **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.
78
+ - **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.
79
+ - **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.
80
+ - **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.
81
+ - **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.
82
+ - **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.
83
+ - **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.
84
+ - **Templates are data.** Changing how a skill or a library looks never requires touching `src/`.
85
+ - **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,26 @@
1
+ # Changelog
2
+
3
+ ## [1.1.0](https://github.com/JMBargueno/skanvil/compare/v1.0.0...v1.1.0) (2026-11-11)
4
+
5
+
6
+ ### Features
7
+
8
+ * parametrized skills and typed package exports ([7f9ff65](https://github.com/JMBargueno/skanvil/commit/7f9ff659140591b5ccc56f867f831853d2573d44))
9
+
10
+
11
+ ### Documentation
12
+
13
+ * add an AI agent setup prompt to getting started ([ee3adae](https://github.com/JMBargueno/skanvil/commit/ee3adae981baab3b5244b555024ac9122d47b56b))
14
+
15
+ ## 1.0.0 (2026-11-10)
16
+
17
+
18
+ ### Features
19
+
20
+ * add interactive wizard ([e3643f8](https://github.com/JMBargueno/skanvil/commit/e3643f8d5034ada4d0a0bf07e9b64270ca3a16fb))
21
+ * initial release of skanvil ([a3fa166](https://github.com/JMBargueno/skanvil/commit/a3fa166f1af05b3e60c9ca17a9adbc8826c0042d))
22
+
23
+
24
+ ### Documentation
25
+
26
+ * use canonical JMBargueno casing in repository URLs ([139bd66](https://github.com/JMBargueno/skanvil/commit/139bd66ab267d8ada6557ea91d84e11df88a4803))
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,169 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img src="docs/assets/logo.png" alt="skanvil" width="480">
3
+ </p>
2
4
 
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.
5
+ # skanvil
6
+
7
+ [![ci](https://github.com/JMBargueno/skanvil/actions/workflows/ci.yml/badge.svg)](https://github.com/JMBargueno/skanvil/actions/workflows/ci.yml)
8
+ [![npm](https://img.shields.io/npm/v/skanvil.svg)](https://www.npmjs.com/package/skanvil)
9
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](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
+ - **Adapts and exports skills.** Optional parameters (`{{ticketTracker}}`, `{{#if …}}`) make one skill fit every team, and `skanvil build` turns the library into a typed npm package: `import { codeReview } from "@acme/skills"`.
20
+ - **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.
21
+
22
+ ## What is a skills library?
23
+
24
+ A git repository (and optionally an npm package) with this layout:
25
+
26
+ ```text
27
+ my-skills/
28
+ ├── skills/
29
+ │ ├── front-api-review/ # one folder per skill
30
+ │ │ ├── SKILL.md # YAML frontmatter + instructions
31
+ │ │ ├── references/ # optional long-form guidance
32
+ │ │ ├── scripts/ # optional helpers
33
+ │ │ └── assets/ # optional templates
34
+ │ └── back-migrations/
35
+ ├── .claude/skills/skanvil/ # the skanvil agent skill, installed by `init`
36
+ ├── README.md # human-readable index, maintained by skanvil
37
+ └── .skanvilrc.json # categories, validation rules, sync targets
38
+ ```
39
+
40
+ 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`.
41
+
42
+ ## Install
43
+
44
+ ```bash
45
+ npm install --save-dev skanvil # or run any command with npx skanvil …
46
+ ```
47
+
48
+ Requires Node.js 20 or later.
49
+
50
+ ## Quick start
51
+
52
+ **The easy way: run `npx skanvil`** with no arguments in a terminal. A wizard guides you through it:
53
+
54
+ ```text
55
+ $ npx skanvil
56
+ skanvil 1.0.0 · interactive mode · Ctrl+C to quit
57
+ ? This folder (projects) is not a skills library. What do you want to do?
58
+ ❯ Create a new skills library
59
+ Install skills from a library into this folder
60
+ Install or update the skanvil agent skill
61
+ Exit
62
+ ```
63
+
64
+ What the wizard covers:
65
+
66
+ - **Outside a library:** creating one, with your own categories if you want.
67
+ - **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.
68
+ - **Learning the flags:** after each action it prints the equivalent command, ready for scripts and CI.
69
+
70
+ **Or let your AI agent do it:** paste the [setup prompt](docs/getting-started.md#0-let-your-ai-agent-learn-skanvil-optional) into Claude Code, Copilot or Codex. It installs the skanvil agent skill and the agent learns the tool, so you can then ask for skills in plain language.
71
+
72
+ **Author a library with commands:**
73
+
74
+ ```bash
75
+ npx skanvil init my-skills --scope acme
76
+ cd my-skills && npm install
77
+
78
+ npx skanvil add --type front --name "API review" \
79
+ --description "Reviews API integration changes for error handling and typing."
80
+ npx skanvil edit front-api-review --rename http-review --type back
81
+ npx skanvil list
82
+ npx skanvil validate --strict
83
+ ```
84
+
85
+ **Use it in a project:**
86
+
87
+ ```bash
88
+ # from a local checkout
89
+ npx skanvil sync ../my-app -C ./my-skills --target claude,copilot
90
+
91
+ # or from the published package
92
+ cd my-app
93
+ npm install --save-dev @acme/my-skills skanvil
94
+ npx skanvil sync --from @acme/my-skills --target claude
95
+
96
+ # or for every project on your machine (~/.claude/skills, ~/.copilot/skills, ~/.agents/skills)
97
+ npx skanvil sync -C ./my-skills --global --target claude,copilot
98
+ ```
99
+
100
+ ## Commands
101
+
102
+ | Command | What it does |
103
+ | ------------------------------ | --------------------------------------------------------------------------------- |
104
+ | `skanvil` / `skanvil wizard` | Interactive assistant (in a terminal; without one, `skanvil` prints the help). |
105
+ | `skanvil init [dir]` | Create a new library. |
106
+ | `skanvil add` | Create a skill from a template and index it (interactive if options are missing). |
107
+ | `skanvil edit <skill>` | Rename, re-categorise, retitle, redescribe or remove a skill. Transactional. |
108
+ | `skanvil list` | Table of skills with category, README presence, validity and description. |
109
+ | `skanvil validate` | Check the spec and conventions. Exits 1 on errors. |
110
+ | `skanvil index` | Regenerate the README index (`--check` for CI). |
111
+ | `skanvil doctor` | Diagnose problems; `--fix` repairs what it can. |
112
+ | `skanvil templates eject` | Copy the skill template into the library to customise it. |
113
+ | `skanvil sync [dest]` | Install skills into agent folders of a project. |
114
+ | `skanvil install-skill [dest]` | Install or update the `skanvil` agent skill in a project. |
115
+ | `skanvil build` | Generate the library's typed npm exports, one function per skill. |
116
+
117
+ 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.
118
+
119
+ ## The skanvil agent skill
120
+
121
+ skanvil includes an Agent Skill, [`agent-skill/skanvil`](agent-skill/skanvil/SKILL.md), that explains the tool to coding agents. It covers:
122
+
123
+ - how to recognise a skills library;
124
+ - the golden rules: use `add`/`edit` instead of touching folders or the README, and pass every option in non-interactive shells;
125
+ - recipes for common tasks;
126
+ - how to write good skill content;
127
+ - a table from each validation diagnostic to its fix.
128
+
129
+ `skanvil init` installs it into new libraries, in the configured sync targets (`.claude/skills` by default). To add or refresh it in any repository:
130
+
131
+ ```bash
132
+ npx skanvil install-skill --target claude,copilot,agents # in the current project
133
+ npx skanvil install-skill --global --target claude # for every project
134
+ ```
135
+
136
+ 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`.
137
+
138
+ ## Documentation
139
+
140
+ | Guide | |
141
+ | ---------------------------------------------------- | ------------------------------------------------------------------------------------- |
142
+ | [Getting started](docs/getting-started.md) | Build, validate, publish and consume a library, step by step. |
143
+ | [Commands](docs/commands.md) | Every command, option and exit code. |
144
+ | [Configuration](docs/configuration.md) | `.skanvilrc.json` reference: categories, validation, templates, sync. |
145
+ | [Validation rules](docs/validation.md) | Every rule, its severity and how to tune it. CI recipes. |
146
+ | [Templates](docs/templates.md) | Customising the skill template per library or category. |
147
+ | [Parameters and exports](docs/params-and-exports.md) | Parametrized skills, `sync --param`, and `import { codeReview } from "@acme/skills"`. |
148
+ | [Sync](docs/sync.md) | Installing skills into Claude Code, GitHub Copilot and Codex projects. |
149
+ | [API](docs/api.md) | Using skanvil from Node.js. |
150
+ | [Architecture](ARCHITECTURE.md) | How the code is organised. |
151
+ | [Contributing](CONTRIBUTING.md) | Development setup and conventions. |
152
+
153
+ ## Programmatic API
154
+
155
+ ```ts
156
+ import { Library, scaffoldSkill, validateLibrary, syncSkills } from "skanvil";
157
+
158
+ const lib = await Library.open("./my-skills");
159
+ await scaffoldSkill(lib, { type: "front", name: "a11y", description: "Audits accessibility." });
160
+
161
+ const { errors, diagnostics } = await validateLibrary(lib);
162
+ if (errors === 0) await syncSkills(lib, { dest: "../my-app", targets: ["claude"] });
163
+ ```
164
+
165
+ Every export is fully typed and documented; see the [API guide](docs/api.md).
166
+
167
+ ## License
168
+
169
+ [MIT](LICENSE) © Jose Manuel Bargueño López. See the [changelog](CHANGELOG.md) for release notes.
@@ -0,0 +1,168 @@
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
+ **Parametrize a skill.** Do this when variants of a skill differ only in details, such as the tracker, package manager or URLs.
118
+
119
+ 1. Add a `params.json` next to its `SKILL.md`, for example `{"ticketTracker": {"type": "enum", "values": ["github", "jira"], "default": "github"}}`. Types are `enum`, `string` and `boolean`, and every parameter needs a `default`.
120
+ 2. In `SKILL.md`, use `{{ticketTracker}}`, `{{#if ticketTracker == "jira"}}…{{else}}…{{/if}}` and `{{#if strict}}…{{/if}}`.
121
+ 3. Run `npx skanvil validate`: it checks the skill rendered with the defaults, plus the `params-file` and `params-template` rules.
122
+ 4. Install it with values: `npx skanvil sync <project> --param ticketTracker=jira`.
123
+
124
+ **Export skills as code.** `npx skanvil build` generates `dist/`, with one typed function per skill (`front-code-review` becomes `codeReview(params)`), plus `skills` and `getSkill(name)`. Generated libraries run it in `npm run build` and before publishing.
125
+
126
+ ### 4. Write good skill content
127
+
128
+ - **`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.
129
+ - **`name`** equals the folder name: lowercase letters, digits and single hyphens, at most 64 characters.
130
+ - **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).
131
+ - **Placeholders:** never leave filler text. Any entry of `validation.placeholders` (to-do markers, dummy Latin text, "to be decided" notes) fails validation.
132
+ - **`metadata`:** string values only, so quote numbers, as in `version: "1.0"`.
133
+ - **`allowed-tools`:** a space-separated string, not a list.
134
+
135
+ ### 5. Diagnostic → fix
136
+
137
+ | Rule | Fix |
138
+ | --------------------------------------------------- | ------------------------------------------------------------------------------------ |
139
+ | `readme-missing`, `readme-orphan`, `readme-section` | `npx skanvil doctor --fix` |
140
+ | `name-matches-folder`, `name-required` | `doctor --fix`, or `edit --rename` if the folder name is wrong |
141
+ | `frontmatter-tabs`, `tools-field` | `doctor --fix` |
142
+ | `frontmatter` | Repair the YAML between the `---` lines (quote values containing `: ` or `#`). |
143
+ | `required-sections` | Add the missing `## Section` listed in `validation.requiredSections`. |
144
+ | `placeholders` | Replace the placeholder text with real content. |
145
+ | `description-length`, `max-lines` | Shorten; move detail to `references/`. |
146
+ | `metadata-format` | Quote non-string values. |
147
+ | `duplicate-name` | Two folders share a `name`: rename one with `edit --rename`. |
148
+ | `broken-references` | Create the referenced file, or fix the link (paths are relative to the skill). |
149
+ | `template-unchanged` | Rewrite the generic scaffold sentences with skill-specific instructions. |
150
+ | `params-file` | Fix `params.json`: camelCase names, `type`, a `default` (inside `values` for enums). |
151
+ | `params-template` | Declare every `{{name}}` used, and balance `{{#if}}` / `{{/if}}`. |
152
+
153
+ See [references/REFERENCE.md](references/REFERENCE.md) for every command option, the config schema and JSON output shapes.
154
+
155
+ ## Output Format
156
+
157
+ Report to the user:
158
+
159
+ - the skanvil commands you ran;
160
+ - the skills created, changed or removed, with their folder names;
161
+ - the final `skanvil validate` result (errors and warnings), and anything left for them to decide.
162
+
163
+ ## Quality Criteria
164
+
165
+ - Every structural change went through `skanvil add` or `skanvil edit`. There are no hand-made folder renames or README index edits.
166
+ - `npx skanvil validate` reports no errors, and `npx skanvil index --check` passes.
167
+ - New or edited skills have specific descriptions with triggers, and no template filler or placeholders.
168
+ - Deletions and syncs into other projects were confirmed with the user.
@@ -0,0 +1,122 @@
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), `--param name=value` (repeatable, remembered per target) |
18
+ | `build` | `--out <dir>`, `--force` |
19
+ | `install-skill [dest]` | `--target <preset\|path>`, `--force`, `--global` (presets only, no dest) |
20
+
21
+ ## `.skanvilrc.json`
22
+
23
+ ```jsonc
24
+ {
25
+ "$schema": "./node_modules/skanvil/schema.json",
26
+ "name": "my-skills",
27
+ "skillsDir": "skills", // default
28
+ "readme": "README.md", // default
29
+ "categories": [
30
+ {
31
+ "id": "front", // used by --type
32
+ "prefix": "front-", // "" (default category only), "_" or kebab-case ending in "-"
33
+ "title": "Front", // README section title
34
+ "aliases": ["frontend", "f"],
35
+ "default": false, // exactly one category is the default (empty prefix)
36
+ "indexed": true, // listed in the README
37
+ "validated": true, // validated against the spec and syncable
38
+ "metadata": { "domain": "frontend" },
39
+ "compatibility": "Designed for frontend repositories."
40
+ }
41
+ ],
42
+ "validation": {
43
+ "requiredSections": [
44
+ "Objective",
45
+ "When to Activate This Skill",
46
+ "Instructions",
47
+ "Output Format",
48
+ "Quality Criteria"
49
+ ],
50
+ "placeholders": ["TODO", "describe...", "lorem ipsum", "tbd", "to be defined"],
51
+ "maxLines": 500,
52
+ "rules": { "max-lines": "warn" } // error | warn | off per rule id
53
+ },
54
+ "templates": { "dir": ".skanvil/templates" },
55
+ "sync": { "targets": ["claude"], "mode": "copy" }
56
+ }
57
+ ```
58
+
59
+ ## Validation rules
60
+
61
+ Default severity is `error` unless noted. Rules marked with `*` are fixable by `doctor --fix`.
62
+
63
+ - **Files and YAML:** `skill-file`, `frontmatter`, `frontmatter-tabs`*.
64
+ - **Names:**
65
+ - `folder-name`;
66
+ - `name-required`*;
67
+ - `name-format`: 1–64 characters of `a-z0-9-`, with no leading, trailing or double hyphens;
68
+ - `name-matches-folder`*;
69
+ - `duplicate-name`.
70
+ - **Spec fields:**
71
+ - `description-required`;
72
+ - `description-length` (≤ 1024);
73
+ - `compatibility-length` (1–500);
74
+ - `metadata-format` (warn);
75
+ - `allowed-tools-format` (warn);
76
+ - `tools-field`* (warn).
77
+ - **Content:** `required-sections`, `placeholders`, `max-lines` (warn), `broken-references`, `template-unchanged` (warn).
78
+ - **README:** `readme-missing`_, `readme-orphan`_, `readme-section`*.
79
+
80
+ ## JSON output shapes
81
+
82
+ - `list --json` prints `[{ name, type, indexed, valid, description }]`. `indexed` and `valid` are `null` for categories that are not indexed or not validated.
83
+ - `validate --json` prints `{ ok, diagnostics: [{ rule, severity, skill?, message, fixable? }], count, errors, warnings }`.
84
+ - `doctor --json` prints the same as validate, plus `fixes: string[]`.
85
+ - `index --json` prints `{ updated }`, or `{ upToDate }` with `--check`.
86
+ - `sync --json` prints `{ dryRun, mode, results: [{ target, path, added, updated, unchanged, removed, skipped: [{ skill, reason }], warnings }] }`.
87
+ - `add --json` prints `{ skillName, title, type, target, template }`.
88
+ - `edit --json` prints `{ skillName, previousName }`, or `{ removed }`.
89
+
90
+ ## Parameters (`params.json`)
91
+
92
+ ```json
93
+ {
94
+ "ticketTracker": { "type": "enum", "values": ["github", "jira"], "default": "github", "description": "…" },
95
+ "packageManager": { "type": "string", "default": "npm" },
96
+ "strict": { "type": "boolean", "default": false }
97
+ }
98
+ ```
99
+
100
+ The syntax inside `SKILL.md`:
101
+
102
+ - `{{name}}` inserts the value;
103
+ - `{{#if name}}`, `{{#if !name}}`, `{{#if name == "v"}}` and `{{#if name != "v"}}` start a block;
104
+ - `{{else}}` and `{{/if}}` continue and close it.
105
+
106
+ A tag alone on its line removes the line.
107
+
108
+ What the build generates (`skanvil build`):
109
+
110
+ - `dist/index.mjs` and `index.cjs`, plus their `.d.mts` and `.d.cts` declarations;
111
+ - one export per skill, `<camelName>(params?) => string`;
112
+ - `skills`, an array with `{ name, category, title, description, params, render(params), files(params) }` for each skill;
113
+ - `getSkill(name)`.
114
+
115
+ ## Template variables
116
+
117
+ The following variables are available in custom templates. In the `SKILL.md` frontmatter they are YAML-escaped automatically.
118
+
119
+ - `{{name}}`, `{{title}}`, `{{description}}`, `{{descriptionLower}}`;
120
+ - `{{category}}`, `{{domain}}`, `{{compatibility}}`;
121
+ - `{{resources}}`;
122
+ - `{{metadata.<key>}}`.