@crouton-kit/crouter 0.2.2 → 0.2.4
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.
|
@@ -141,14 +141,14 @@ Bad plugin scope:
|
|
|
141
141
|
|
|
142
142
|
## Cross-plugin etiquette
|
|
143
143
|
|
|
144
|
-
If your skill conceptually depends on another plugin's skill, link via `## Related` with `` `<plugin>/<skill>`
|
|
144
|
+
If your skill conceptually depends on another plugin's skill, link via `## Related` with `` `<plugin>/<skill>` ``. Don't fork content; link it.
|
|
145
145
|
|
|
146
146
|
## Validation
|
|
147
147
|
|
|
148
148
|
`crtr doctor` checks every plugin:
|
|
149
149
|
- Manifest exists and is valid JSON.
|
|
150
150
|
- Manifest `name` matches the directory name.
|
|
151
|
-
- Every skill under `skills/` passes the skill-validation contract (
|
|
151
|
+
- Every skill under `skills/` passes the skill-validation contract (frontmatter parses, `name` matches dir path, `type` in enum). Run `crtr skill` (no args) for the full format reference.
|
|
152
152
|
- Sibling artifact dirs (`commands/`, `hooks/`, etc.) — validated by their respective specs as those land.
|
|
153
153
|
|
|
154
154
|
## Cross-publishing with Claude Code
|
package/dist/commands/skill.js
CHANGED
|
@@ -23,10 +23,9 @@ const KNOWN_VERBS = new Set([
|
|
|
23
23
|
'disable',
|
|
24
24
|
'search',
|
|
25
25
|
]);
|
|
26
|
-
const AUTHORING_GUIDE_SKILL = 'crouter-development/skills';
|
|
27
26
|
function buildShowFooter(skillPath) {
|
|
28
27
|
return (`crtr: edit this skill directly at ${skillPath} — ` +
|
|
29
|
-
`for SKILL.md authoring
|
|
28
|
+
`for SKILL.md format + authoring workflow run \`crtr skill\` (no args)`);
|
|
30
29
|
}
|
|
31
30
|
function wrapSkill(name, path, content) {
|
|
32
31
|
return `<skill name="${name}" path="${path}">\n${content.endsWith('\n') ? content : content + '\n'}</skill>`;
|
|
@@ -82,7 +81,8 @@ export function registerSkillCommands(program) {
|
|
|
82
81
|
.command('skill [nameOrVerb] [rest...]')
|
|
83
82
|
.description('manage and inspect skills')
|
|
84
83
|
.option('--frontmatter', 'include YAML frontmatter in the printed body')
|
|
85
|
-
.addHelpText('after', '\n' +
|
|
84
|
+
.addHelpText('after', '\nRun `crtr skill` (no args) for intent-based routing and SKILL.md format reference.\n\n' +
|
|
85
|
+
SKILL_IDENTIFIER_HELP)
|
|
86
86
|
.action(async (nameOrVerb, _rest, opts) => {
|
|
87
87
|
if (nameOrVerb === undefined) {
|
|
88
88
|
out(skillPrompt());
|
|
@@ -185,7 +185,7 @@ export function registerSkillCommands(program) {
|
|
|
185
185
|
scope: skillObj.scope,
|
|
186
186
|
path: skillObj.path,
|
|
187
187
|
content,
|
|
188
|
-
authoring_guide_command: `crtr skill
|
|
188
|
+
authoring_guide_command: `crtr skill`,
|
|
189
189
|
});
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
@@ -322,8 +322,9 @@ export function registerSkillCommands(program) {
|
|
|
322
322
|
});
|
|
323
323
|
writeFileSync(skillFile, fm, 'utf8');
|
|
324
324
|
out(skillFile);
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
const templateHint = skillType !== undefined ? skillType : '<type>';
|
|
326
|
+
hint(`crtr: scaffolded ${scope}-scope skill ${skillName} — edit directly; ` +
|
|
327
|
+
`\`crtr skill template ${templateHint}\` for body skeleton`);
|
|
327
328
|
return;
|
|
328
329
|
}
|
|
329
330
|
let plugin;
|
|
@@ -349,8 +350,9 @@ export function registerSkillCommands(program) {
|
|
|
349
350
|
});
|
|
350
351
|
writeFileSync(skillFile, fm, 'utf8');
|
|
351
352
|
out(skillFile);
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
const templateHint = skillType !== undefined ? skillType : '<type>';
|
|
354
|
+
hint(`crtr: scaffolded ${skillFile} — edit directly; ` +
|
|
355
|
+
`\`crtr skill template ${templateHint}\` for body skeleton`);
|
|
354
356
|
}
|
|
355
357
|
catch (e) {
|
|
356
358
|
handleError(e);
|
package/dist/prompts/skill.js
CHANGED
|
@@ -64,6 +64,25 @@ Five types — pick by what the agent does after reading:
|
|
|
64
64
|
Don't load \`create\` and \`template\` in the same turn — \`create\` decides the
|
|
65
65
|
type, then call \`template\`.
|
|
66
66
|
|
|
67
|
+
## Format
|
|
68
|
+
|
|
69
|
+
A skill is a directory; \`SKILL.md\` is its entry file. The dir IS the skill —
|
|
70
|
+
siblings are assets, nested dirs are themselves skills.
|
|
71
|
+
|
|
72
|
+
Frontmatter (required: \`name\`, \`type\`, \`description\`):
|
|
73
|
+
- \`name\` — must equal the dir path under \`skills/\`. Slashes for nested
|
|
74
|
+
(\`skills/web/frontend/design/SKILL.md\` → \`name: web/frontend/design\`).
|
|
75
|
+
- \`type\` — one of the five above.
|
|
76
|
+
- \`description\` — one sentence, front-load with "Use when…" — drives discovery.
|
|
77
|
+
- \`keywords\` (optional) — array of strings, improves \`crtr skill search\`.
|
|
78
|
+
|
|
79
|
+
Intermediate dirs (\`web/\`, \`web/frontend/\`) don't need their own SKILL.md —
|
|
80
|
+
nesting is purely path-based. Budget ~150 lines per SKILL.md body; spill
|
|
81
|
+
deeper material into sibling files (\`reference.md\`, \`examples.md\`).
|
|
82
|
+
|
|
83
|
+
Validate with \`crtr doctor\` — checks frontmatter, name-vs-path match, type
|
|
84
|
+
enum, sibling-link reachability.
|
|
85
|
+
|
|
67
86
|
## Neighbors auto-append
|
|
68
87
|
|
|
69
88
|
\`crtr skill show <name>\` appends a \`## Neighbors\` section listing siblings
|
|
@@ -375,18 +394,6 @@ crtr skill show <name>
|
|
|
375
394
|
crtr skill search <keyword>
|
|
376
395
|
\`\`\`
|
|
377
396
|
|
|
378
|
-
## Deep-dive reference
|
|
379
|
-
|
|
380
|
-
For canonical SKILL.md authoring (frontmatter fields, argument passing,
|
|
381
|
-
dynamic context, subagent forking, hooks):
|
|
382
|
-
|
|
383
|
-
\`\`\`
|
|
384
|
-
crtr skill show crouter-development/skills
|
|
385
|
-
\`\`\`
|
|
386
|
-
|
|
387
|
-
The playbook above gives you structure + density rules.
|
|
388
|
-
\`crouter-development/skills\` covers the SKILL.md surface itself.
|
|
389
|
-
|
|
390
397
|
## Constraints
|
|
391
398
|
|
|
392
399
|
- Topic fails litmus? → \`crtr skill template freeform\`, \`reference\`, or \`runbook\`.
|
package/package.json
CHANGED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: crouter-development/skills
|
|
3
|
-
type: playbook
|
|
4
|
-
description: How to author a crtr skill — SKILL.md format, frontmatter, naming, nested skills, template types. Use when creating a new skill (plugin-owned or scope-owned) or auditing an existing one.
|
|
5
|
-
keywords: [skill, SKILL.md, frontmatter, authoring, template]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Authoring crtr skills
|
|
9
|
-
|
|
10
|
-
A **skill** is a directory; `SKILL.md` is its entry file — the same role `index.html` plays for a web dir. The dir IS the skill: siblings (`reference.md`, scripts, examples) ride along, nested subdirs are themselves skills.
|
|
11
|
-
|
|
12
|
-
Audience: LLM agents loading this to create or audit a skill. Decision-first.
|
|
13
|
-
|
|
14
|
-
## Minimum viable skill
|
|
15
|
-
|
|
16
|
-
**Plugin-owned:**
|
|
17
|
-
```
|
|
18
|
-
<plugin-root>/skills/<name>/SKILL.md
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
**Scope-owned** (no plugin, just your project or user scope):
|
|
22
|
-
```
|
|
23
|
-
~/.crouter/skills/<name>/SKILL.md # user scope
|
|
24
|
-
<project>/.crouter/skills/<name>/SKILL.md # project scope
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
```markdown
|
|
28
|
-
---
|
|
29
|
-
name: <name>
|
|
30
|
-
type: <type>
|
|
31
|
-
description: <one sentence — used by the agent to decide whether to load this>
|
|
32
|
-
keywords: [optional, list]
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
# Title
|
|
36
|
-
|
|
37
|
-
Body in markdown. This is what `crtr skill show <name>` prints.
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Drop the directory in place; `crtr skill list` picks it up. No build, no registry.
|
|
41
|
-
|
|
42
|
-
## Template types
|
|
43
|
-
|
|
44
|
-
Pick the type matching what the agent *does* after reading.
|
|
45
|
-
|
|
46
|
-
| Type | Agent action | Source of truth | Example |
|
|
47
|
-
|---|---|---|---|
|
|
48
|
-
| `playbook` | Decides — applies judgment ("when X, do Y because Z") | The skill itself | this skill, cli-design |
|
|
49
|
-
| `primer` | Navigates — learns architectural facts about a codebase | Code in repo | crtr-internals |
|
|
50
|
-
| `reference` | Looks up — stable external facts | Docs/specs/protocols | semver-rules |
|
|
51
|
-
| `runbook` | Executes — numbered procedure with rollback | The skill (steps fixed) | deploy-plugin |
|
|
52
|
-
| `freeform` | None of the above | Varies | catch-all |
|
|
53
|
-
|
|
54
|
-
### Picking the type
|
|
55
|
-
|
|
56
|
-
- Agent needs to make a *judgment call*? → `playbook`. Lead with rules; show examples; state the *why* so edge cases resolve themselves.
|
|
57
|
-
- Agent needs to *navigate code* that drifts over time? → `primer`. Point at `file:line`. Don't transcribe code; explain the *shape*.
|
|
58
|
-
- Agent needs *stable facts* (semver, HTTP codes, protocol fields)? → `reference`. Tables, terse, no methodology.
|
|
59
|
-
- Agent needs to *run a procedure* with known steps and failure modes? → `runbook`. Numbered. Include rollback per step.
|
|
60
|
-
- None of the above → `freeform`. Try harder first — the other four catch ~95% of cases.
|
|
61
|
-
|
|
62
|
-
### Anti-patterns by type
|
|
63
|
-
|
|
64
|
-
- `playbook` that's mostly code listings → split code to siblings; keep judgment in SKILL.md.
|
|
65
|
-
- `primer` that duplicates code it points to → just point; don't transcribe.
|
|
66
|
-
- `reference` that contains methodology → split methodology into a `playbook` sibling.
|
|
67
|
-
- `runbook` with no decision points → it's a script; ship a script.
|
|
68
|
-
|
|
69
|
-
## The `name` rule
|
|
70
|
-
|
|
71
|
-
`name:` MUST equal the skill's path under `skills/`. For `skills/cli-design/SKILL.md`, `name: cli-design`. For `skills/web/frontend/design-website/SKILL.md`, `name: web/frontend/design-website` — slashes and all.
|
|
72
|
-
|
|
73
|
-
`crtr skill new <plugin>:<name>` (or `crtr skill new <name>` for scope-owned) scaffolds this correctly. `crtr doctor` flags drift.
|
|
74
|
-
|
|
75
|
-
## Nested skills
|
|
76
|
-
|
|
77
|
-
Nesting is directory nesting. No `parent:` field, no registry. The path IS the hierarchy.
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
skills/
|
|
81
|
-
├── prompting-effectively/SKILL.md # flat
|
|
82
|
-
├── cli-design/ # flat with sibling assets
|
|
83
|
-
│ ├── SKILL.md
|
|
84
|
-
│ └── reference.md
|
|
85
|
-
└── web/
|
|
86
|
-
└── frontend/
|
|
87
|
-
└── design-website/SKILL.md # name: web/frontend/design-website
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Resolve nested with `crtr skill show web/frontend/design-website`.
|
|
91
|
-
|
|
92
|
-
Intermediate dirs (`web/`, `web/frontend/`) can be purely organizational — no SKILL.md required at each level. Add one only if you want a primer for the whole nest.
|
|
93
|
-
|
|
94
|
-
## Assets and references
|
|
95
|
-
|
|
96
|
-
Anything sibling to `SKILL.md` is part of the skill. The `cli-design` shape — `SKILL.md` for prose, `reference.md` for tables you don't want inline — is canonical. Scripts, example configs, screenshots all live as siblings. Reference from `SKILL.md` with relative paths.
|
|
97
|
-
|
|
98
|
-
Don't use a top-level `assets/` dir; the dir IS the skill, and grouping per skill keeps moves atomic.
|
|
99
|
-
|
|
100
|
-
## Frontmatter fields
|
|
101
|
-
|
|
102
|
-
| Field | Required | Notes |
|
|
103
|
-
|---|---|---|
|
|
104
|
-
| `name` | yes | Must equal path under `skills/`. Slashes for nested. |
|
|
105
|
-
| `type` | yes | One of: `playbook` `primer` `reference` `runbook` `freeform`. |
|
|
106
|
-
| `description` | yes | One sentence. Front-load the trigger ("Use when…"). The agent decides whether to load based on this. |
|
|
107
|
-
| `keywords` | no | Array of strings. Improves `crtr skill grep` and search. |
|
|
108
|
-
|
|
109
|
-
Descriptions: active and specific. "Guide to X" is weak; "Use when doing X — covers Y and Z" is strong.
|
|
110
|
-
|
|
111
|
-
## The authoring loop
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
# 1. Scaffold — plugin-owned or scope-owned
|
|
115
|
-
crtr skill new <plugin>:my-skill --type playbook --description "Use when …"
|
|
116
|
-
crtr skill new my-skill --type playbook --description "Use when …" # scope-owned
|
|
117
|
-
|
|
118
|
-
# 2. Find and edit
|
|
119
|
-
crtr skill path <plugin>:my-skill # absolute path
|
|
120
|
-
$EDITOR $(crtr skill path <plugin>:my-skill)
|
|
121
|
-
|
|
122
|
-
# 3. Validate
|
|
123
|
-
crtr doctor
|
|
124
|
-
|
|
125
|
-
# 4. Preview as the agent sees it (includes auto-appended neighbors)
|
|
126
|
-
crtr skill show my-skill
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
## Cross-skill links
|
|
130
|
-
|
|
131
|
-
- Sibling and nested skills in the same plugin/scope auto-append in a `<neighbors>` XML block inside the `<skill>` wrapper. Don't hand-roll these.
|
|
132
|
-
- `## Related` in the body is for **cross-plugin or distant** references only — not siblings.
|
|
133
|
-
- Cross-plugin refs: `` `<plugin>/<name>` ``. Scope-direct: `` `<scope>:<name>` ``.
|
|
134
|
-
- Suppress neighbors: `crtr skill show <name> --no-neighbors`.
|
|
135
|
-
|
|
136
|
-
If `## Related` would only list siblings, delete the section.
|
|
137
|
-
|
|
138
|
-
## What goes in the body
|
|
139
|
-
|
|
140
|
-
Skills are reference + methodology for an agent. Good skills:
|
|
141
|
-
- Lead with trigger conditions and a one-paragraph summary so the agent can decide whether to read further.
|
|
142
|
-
- Use greppable headings (`## When to use`, `## Common pitfalls`).
|
|
143
|
-
- Show concrete invocations — code blocks beat prose.
|
|
144
|
-
- Link sibling assets: `see [reference.md](./reference.md)`.
|
|
145
|
-
|
|
146
|
-
Bad skills:
|
|
147
|
-
- Tell the agent what it already knows ("markdown uses `#` for headings").
|
|
148
|
-
- Bury triggers under five paragraphs of motivation.
|
|
149
|
-
- Pile related-but-distinct topics into one skill — split into nested sub-skills.
|
|
150
|
-
|
|
151
|
-
Budget ~150 lines for `SKILL.md` bodies. If a section exceeds 20 lines without teaching judgment, move it to a sibling file.
|
|
152
|
-
|
|
153
|
-
## Validation
|
|
154
|
-
|
|
155
|
-
`crtr doctor` checks every skill:
|
|
156
|
-
- Frontmatter parses as YAML.
|
|
157
|
-
- `name` matches the directory path.
|
|
158
|
-
- `SKILL.md` exists and is non-empty.
|
|
159
|
-
- Referenced sibling files exist (best-effort from markdown links).
|
|
160
|
-
- `type` is present and in the enum (fails if not).
|
|
161
|
-
|
|
162
|
-
A skill failing doctor still loads — doctor is advisory — but `crtr skill list --json` flags it.
|
|
163
|
-
|
|
164
|
-
## Collisions
|
|
165
|
-
|
|
166
|
-
Skill names need only be unique *within a plugin*. Two plugins shipping the same name collide; resolution order (project plugin → user plugin → project marketplace → user marketplace → builtin) picks one, and `crtr` exits `4` for ambiguous lookups when explicitness is required. Disambiguate with `<plugin>:<skill>`: `crtr skill show crtr:crouter-development/skills`.
|