@crouton-kit/crouter 0.1.6 → 0.1.7
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/dist/commands/skill.js +12 -3
- package/dist/core/bootstrap.js +25 -31
- package/dist/prompts/skill.d.ts +1 -0
- package/dist/prompts/skill.js +313 -159
- package/package.json +1 -1
package/dist/commands/skill.js
CHANGED
|
@@ -9,7 +9,7 @@ import { resolveSkill, listAllSkills, listInstalledPlugins, findPluginByName, pa
|
|
|
9
9
|
import { updateConfig, ensureScopeInitialized } from '../core/config.js';
|
|
10
10
|
import { parseFrontmatter, serializeFrontmatter } from '../core/frontmatter.js';
|
|
11
11
|
import { ensureDir, pathExists, readText, walkFiles } from '../core/fs-utils.js';
|
|
12
|
-
import { skillPrompt, skillCreatePrompt } from '../prompts/skill.js';
|
|
12
|
+
import { skillPrompt, skillCreatePrompt, skillTemplatePrompt } from '../prompts/skill.js';
|
|
13
13
|
const KNOWN_VERBS = new Set([
|
|
14
14
|
'list',
|
|
15
15
|
'show',
|
|
@@ -17,6 +17,7 @@ const KNOWN_VERBS = new Set([
|
|
|
17
17
|
'grep',
|
|
18
18
|
'new',
|
|
19
19
|
'create',
|
|
20
|
+
'template',
|
|
20
21
|
'where',
|
|
21
22
|
'enable',
|
|
22
23
|
'disable',
|
|
@@ -286,14 +287,22 @@ export function registerSkillCommands(program) {
|
|
|
286
287
|
handleError(e);
|
|
287
288
|
}
|
|
288
289
|
});
|
|
289
|
-
// create —
|
|
290
|
+
// create — pick a template type
|
|
290
291
|
skill
|
|
291
292
|
.command('create [topic...]')
|
|
292
|
-
.description('
|
|
293
|
+
.description('pick a template type for a new skill (primer | playbook | freeform)')
|
|
293
294
|
.action(async (topic) => {
|
|
294
295
|
const arg = topic && topic.length > 0 ? topic.join(' ') : '';
|
|
295
296
|
out(skillCreatePrompt(arg));
|
|
296
297
|
});
|
|
298
|
+
// template — full workflow + skeleton for one template type
|
|
299
|
+
skill
|
|
300
|
+
.command('template <type> [topic...]')
|
|
301
|
+
.description('full workflow + skeleton for a template type (primer | playbook | freeform)')
|
|
302
|
+
.action(async (type, topic) => {
|
|
303
|
+
const arg = topic && topic.length > 0 ? topic.join(' ') : '';
|
|
304
|
+
out(skillTemplatePrompt(type, arg));
|
|
305
|
+
});
|
|
297
306
|
// where
|
|
298
307
|
skill
|
|
299
308
|
.command('where <name>')
|
package/dist/core/bootstrap.js
CHANGED
|
@@ -23,48 +23,42 @@ function shouldSkipForArgv(argv) {
|
|
|
23
23
|
return SKIP_SUBCOMMANDS.has(sub);
|
|
24
24
|
}
|
|
25
25
|
const BOOT_SKILL_NAME = 'crtr-skills';
|
|
26
|
-
const BOOT_SKILL_MARKER = '<!-- crtr-boot-skill
|
|
26
|
+
const BOOT_SKILL_MARKER = '<!-- crtr-boot-skill v2 -->';
|
|
27
|
+
const BOOT_SKILL_MARKER_PREFIX = '<!-- crtr-boot-skill v';
|
|
27
28
|
function bootSkillBody() {
|
|
28
29
|
return `---
|
|
29
30
|
name: crtr-skills
|
|
30
|
-
description: Capture, list, search, and load skills via the crtr CLI. Use when the user wants to remember
|
|
31
|
+
description: Capture, list, search, and load skills via the crtr CLI. Skills are durable agent memory — markdown future LLM sessions load on demand. Use when the user wants to remember/save knowledge, build a context primer, or recall a previously saved skill. Triggers: "save", "remember", "build context for", "what skills do we have", "skill for X".
|
|
31
32
|
argument-hint: [topic or verb]
|
|
32
33
|
---
|
|
33
34
|
|
|
34
35
|
${BOOT_SKILL_MARKER}
|
|
35
36
|
|
|
36
|
-
# /crtr
|
|
37
|
+
# /crtr-skills — skill router
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
thin router; the CLI is the index.
|
|
39
|
+
Skills = durable agent memory. Written for **future LLM sessions**, not the
|
|
40
|
+
user. \`crtr skill\` is the index — discoverable via list/search/grep.
|
|
41
41
|
|
|
42
|
-
##
|
|
42
|
+
## Route by intent
|
|
43
43
|
|
|
44
|
-
- **Capture
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
- **
|
|
53
|
-
- **List everything**: run \`crtr skill list\`.
|
|
54
|
-
- **Anything else skill-related**: run \`crtr skill\` (no args) — it prints
|
|
55
|
-
the full skill workflow guide. Follow it.
|
|
44
|
+
- **Capture** ("save", "remember", "build context for", "make a skill"):
|
|
45
|
+
\`crtr skill create $ARGUMENTS\` → pick template (primer/playbook/freeform)
|
|
46
|
+
→ \`crtr skill template <type> $ARGUMENTS\` for the full workflow. Follow it
|
|
47
|
+
directly.
|
|
48
|
+
- **Find** ("what do we have on X"): \`crtr skill search "$ARGUMENTS"\` →
|
|
49
|
+
\`crtr skill show <name>\` on the best hit.
|
|
50
|
+
- **Load by name**: \`crtr skill show <name>\`.
|
|
51
|
+
- **List all**: \`crtr skill list\`.
|
|
52
|
+
- **Anything else**: \`crtr skill\` (no args) prints the full workflow guide.
|
|
56
53
|
|
|
57
|
-
\`$ARGUMENTS\` is the user
|
|
58
|
-
\`create\` or the query for \`search\`. If it's empty, ask the user what they
|
|
59
|
-
want before running anything.
|
|
54
|
+
If \`$ARGUMENTS\` is empty, ask the user what they want before running.
|
|
60
55
|
|
|
61
|
-
##
|
|
56
|
+
## Rules
|
|
62
57
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
If \`crtr\`
|
|
67
|
-
\`@crouton-kit/crouter\` is installed globally.
|
|
58
|
+
- CLI stdout is the prompt — act on it, don't paraphrase to the user.
|
|
59
|
+
- Don't load \`create\` and \`template\` outputs in the same turn (progressive
|
|
60
|
+
disclosure). \`create\` decides type; \`template\` returns the workflow.
|
|
61
|
+
- If \`crtr\` is not on PATH, tell the user and stop.
|
|
68
62
|
`;
|
|
69
63
|
}
|
|
70
64
|
export function ensureBootSkill(argv) {
|
|
@@ -81,11 +75,11 @@ export function ensureBootSkill(argv) {
|
|
|
81
75
|
const skillDir = join(claudeSkillsRoot, BOOT_SKILL_NAME);
|
|
82
76
|
const skillFile = join(skillDir, 'SKILL.md');
|
|
83
77
|
if (pathExists(skillFile)) {
|
|
84
|
-
// Idempotent: only rewrite if it's still our marker version.
|
|
85
78
|
const existing = readText(skillFile);
|
|
86
|
-
|
|
79
|
+
// If the user customized (no boot-skill marker at all), don't clobber.
|
|
80
|
+
if (!existing.includes(BOOT_SKILL_MARKER_PREFIX))
|
|
87
81
|
return;
|
|
88
|
-
//
|
|
82
|
+
// Any marker version present → roll forward to current. Skip if identical.
|
|
89
83
|
if (existing === bootSkillBody())
|
|
90
84
|
return;
|
|
91
85
|
}
|
package/dist/prompts/skill.d.ts
CHANGED
package/dist/prompts/skill.js
CHANGED
|
@@ -1,176 +1,175 @@
|
|
|
1
1
|
export function skillPrompt() {
|
|
2
|
-
return `# Skills —
|
|
2
|
+
return `# Skills — durable agent memory
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
captured knowledge. The CLI is the index; \`crtr skill list/search/grep\`
|
|
8
|
-
discovers what's available so you never need a hand-maintained router file.
|
|
4
|
+
Skills are markdown the agent loads on demand. **Audience: future LLM agent
|
|
5
|
+
sessions, not humans.** Write for the model: terse, decision-first, dense.
|
|
6
|
+
The CLI is the index — \`crtr skill list/search/grep\` discovers what's saved.
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
1. **Scope-direct**
|
|
12
|
-
2. **Plugin skills**
|
|
13
|
-
3. Project
|
|
8
|
+
Locations (resolution order):
|
|
9
|
+
1. **Scope-direct** \`<scope-root>/skills/<name>/SKILL.md\` → \`user:<name>\` / \`project:<name>\`
|
|
10
|
+
2. **Plugin skills** \`<plugin>/skills/<name>/SKILL.md\` → \`<scope>:<plugin>/<name>\`
|
|
11
|
+
3. Project > user; non-marketplace plugins > marketplace.
|
|
14
12
|
|
|
15
|
-
Ambiguous names exit \`4\` — disambiguate with \`<plugin>:<name>\` or \`_:<name
|
|
16
|
-
for scope-direct.
|
|
13
|
+
Ambiguous names exit \`4\` — disambiguate with \`<plugin>:<name>\` or \`_:<name>\`.
|
|
17
14
|
|
|
18
15
|
## Discover
|
|
19
16
|
|
|
20
17
|
\`\`\`
|
|
21
|
-
crtr skill list #
|
|
22
|
-
crtr skill search <query> #
|
|
23
|
-
crtr skill grep <pattern> # regex
|
|
18
|
+
crtr skill list # <qualifier> — <description>
|
|
19
|
+
crtr skill search <query> # ranked by name/description/keywords
|
|
20
|
+
crtr skill grep <pattern> # regex across SKILL.md bodies
|
|
24
21
|
\`\`\`
|
|
25
22
|
|
|
26
23
|
## Load
|
|
27
24
|
|
|
28
25
|
\`\`\`
|
|
29
|
-
crtr skill show <name> #
|
|
30
|
-
crtr skill show <plugin>:<name> # disambiguate when names collide
|
|
26
|
+
crtr skill show <name> # body to stdout (default verb)
|
|
31
27
|
crtr skill show _:<name> # explicit scope-direct
|
|
32
|
-
crtr skill path <name> # absolute path
|
|
33
|
-
crtr skill where <name> # {scope, plugin, path}
|
|
28
|
+
crtr skill path <name> # absolute path
|
|
29
|
+
crtr skill where <name> # {scope, plugin, path} JSON
|
|
34
30
|
\`\`\`
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
the body.
|
|
38
|
-
|
|
39
|
-
## Author
|
|
32
|
+
## Author (progressive disclosure)
|
|
40
33
|
|
|
41
34
|
\`\`\`
|
|
42
|
-
crtr skill create [topic...] #
|
|
43
|
-
crtr skill
|
|
44
|
-
crtr skill new <
|
|
45
|
-
crtr skill show authoring-skills # the SKILL.md authoring guide
|
|
35
|
+
crtr skill create [topic...] # pick a template type
|
|
36
|
+
crtr skill template <type> [topic] # workflow + skeleton for that type
|
|
37
|
+
crtr skill new <name> # bare scaffold, scope-direct
|
|
46
38
|
\`\`\`
|
|
47
39
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
freeform) and applies the right research workflow for that template.
|
|
40
|
+
Don't load \`create\` and \`template\` in the same turn — \`create\` decides the
|
|
41
|
+
type, then call \`template\`.
|
|
51
42
|
|
|
52
43
|
## Toggle
|
|
53
44
|
|
|
54
45
|
\`\`\`
|
|
55
|
-
crtr skill enable <name>
|
|
56
|
-
crtr skill disable <name>
|
|
46
|
+
crtr skill enable <name>
|
|
47
|
+
crtr skill disable <name>
|
|
57
48
|
\`\`\`
|
|
58
49
|
|
|
59
50
|
## Exit codes
|
|
60
51
|
|
|
61
|
-
|
|
62
|
-
- \`3\` — skill not found
|
|
63
|
-
- \`4\` — ambiguous name; use \`<plugin>:<name>\`
|
|
52
|
+
\`0\` success · \`3\` not found · \`4\` ambiguous (qualify name)
|
|
64
53
|
`;
|
|
65
54
|
}
|
|
66
55
|
export function skillCreatePrompt(topic) {
|
|
67
56
|
const topicLine = topic
|
|
68
|
-
? `
|
|
69
|
-
: `No topic
|
|
70
|
-
return `#
|
|
57
|
+
? `Topic: **${topic}**`
|
|
58
|
+
: `No topic provided — ask the user what to capture before proceeding.`;
|
|
59
|
+
return `# Author a skill — step 1: pick template type
|
|
71
60
|
|
|
72
|
-
You are about to
|
|
73
|
-
|
|
74
|
-
primers, runbooks, personal preferences, domain glossaries, decision records,
|
|
75
|
-
freeform notes. Don't conflate this with "methodology only" — if the user wants
|
|
76
|
-
the agent to remember something later, a skill is the right shape.
|
|
61
|
+
You are about to write a skill (markdown read by future LLM agent sessions,
|
|
62
|
+
not humans). Pick the template, then load its workflow.
|
|
77
63
|
|
|
78
64
|
${topicLine}
|
|
79
65
|
|
|
80
|
-
##
|
|
66
|
+
## Templates
|
|
81
67
|
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
- \`primer\` — codebase/architectural knowledge ("how does X work, why, what
|
|
69
|
+
are the gotchas"). Triggers parallel-explore research.
|
|
70
|
+
- \`playbook\` — methodology/judgment ("how to think about X"). The
|
|
71
|
+
\`authoring:skills\`-style skill that teaches decisions, not facts.
|
|
72
|
+
- \`freeform\` — anything else (glossary, decision record, runbook, prefs).
|
|
84
73
|
|
|
85
|
-
|
|
86
|
-
|----------|-------------|-------------------|
|
|
87
|
-
| \`primer\` | Architectural/codebase knowledge — "how does X work, why does it exist" | Parallel-explore (Step 3a) |
|
|
88
|
-
| \`preference\` | User preferences, style guides, "remember I like X" | None — just ask 2-3 sharpening questions |
|
|
89
|
-
| \`runbook\` | Operational procedure, incident response, "here's how to do X" | Light — confirm steps with the user |
|
|
90
|
-
| \`glossary\` | Domain terms and invariants | None — list terms, get definitions from user |
|
|
91
|
-
| \`decision\` | ADR-style record: context / decision / consequences | Confirm context and tradeoffs with user |
|
|
92
|
-
| \`freeform\` | Anything else | Ask what shape they want |
|
|
74
|
+
## Next
|
|
93
75
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
need a primer — push back and offer to write a one-paragraph note instead.
|
|
76
|
+
1. Pick a type. If unclear, use \`AskUserQuestion\` with your best guess first.
|
|
77
|
+
2. Run:
|
|
97
78
|
|
|
98
|
-
|
|
79
|
+
\`\`\`
|
|
80
|
+
crtr skill template <type>${topic ? ` ${topic}` : ' [topic]'}
|
|
81
|
+
\`\`\`
|
|
99
82
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
\`project\` (lives in \`<project>/.crouter/skills/\`, only here). Default
|
|
103
|
-
\`project\` if cwd is inside a project scope; otherwise \`user\`.
|
|
104
|
-
- **Name** — kebab-case slug. Suggest one from the topic.
|
|
83
|
+
That output contains the research methodology, SKILL.md skeleton, and
|
|
84
|
+
scaffold command. Follow it directly — don't paraphrase.
|
|
105
85
|
|
|
106
|
-
|
|
107
|
-
update the existing one or pick a different name.
|
|
86
|
+
## Push back when
|
|
108
87
|
|
|
109
|
-
|
|
88
|
+
- Subsystem is small/self-evident → suggest CLAUDE.md note instead of primer.
|
|
89
|
+
- "Topic" is really a one-off task → don't capture; just do the work.
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
export function skillTemplatePrompt(type, topic) {
|
|
93
|
+
const t = type.toLowerCase();
|
|
94
|
+
if (t === 'primer')
|
|
95
|
+
return primerTemplatePrompt(topic);
|
|
96
|
+
if (t === 'playbook')
|
|
97
|
+
return playbookTemplatePrompt(topic);
|
|
98
|
+
if (t === 'freeform')
|
|
99
|
+
return freeformTemplatePrompt(topic);
|
|
100
|
+
return `unknown template type: ${type}\nvalid: primer | playbook | freeform\nrun \`crtr skill create\` to pick.\n`;
|
|
101
|
+
}
|
|
102
|
+
function topicLine(topic) {
|
|
103
|
+
return topic
|
|
104
|
+
? `Topic: **${topic}**`
|
|
105
|
+
: `No topic — confirm with the user before continuing.`;
|
|
106
|
+
}
|
|
107
|
+
function primerTemplatePrompt(topic) {
|
|
108
|
+
return `# Primer — codebase knowledge skill
|
|
110
109
|
|
|
111
|
-
|
|
110
|
+
**Audience: future LLM agent sessions.** Captures *why* a subsystem exists +
|
|
111
|
+
non-obvious facts that code alone doesn't reveal. Lets a future session skip
|
|
112
|
+
re-exploration.
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
directory**:
|
|
114
|
+
${topicLine(topic)}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
- **Data model** — schemas, types, DB tables, key invariants
|
|
118
|
-
- **Control flow** — how a typical request/job traverses the system end-to-end
|
|
119
|
-
- **External integrations** — third-party APIs, queues, services, env vars
|
|
120
|
-
- **Tests** — what's tested reveals what's load-bearing
|
|
121
|
-
- **History** — recent \`git log\` for this area surfaces ongoing work and pain
|
|
122
|
-
- **Cross-cutting** — auth, errors, logging, feature flags as they apply here
|
|
116
|
+
## 1. Inventory (parallel)
|
|
123
117
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
- \`ls\` repo top level
|
|
119
|
+
- check stack manifests
|
|
120
|
+
- \`git log --oneline -15\` in this area
|
|
121
|
+
- \`crtr skill search <topic>\` / \`crtr skill list\` — does a primer already exist?
|
|
127
122
|
|
|
128
|
-
|
|
123
|
+
If subsystem is small/self-evident, **stop**. Suggest a CLAUDE.md note. Primers
|
|
124
|
+
are for large, complicated, or unintuitive systems only.
|
|
129
125
|
|
|
130
|
-
|
|
131
|
-
choice with your best guess first). Frame each as "here's my read; is this
|
|
132
|
-
right?" Never write assumptions into the skill — if a fact isn't confirmed by
|
|
133
|
-
code or the user, it doesn't go in.
|
|
126
|
+
## 2. Scope + name
|
|
134
127
|
|
|
135
|
-
|
|
128
|
+
- **Scope**: \`project\` by default. \`user\` only if cross-repo.
|
|
129
|
+
- **Name**: kebab-case. Confirm no collision: \`crtr skill where <name>\`.
|
|
136
130
|
|
|
137
|
-
|
|
138
|
-
narrate it once and read back the steps.
|
|
131
|
+
## 3. Parallel exploration
|
|
139
132
|
|
|
140
|
-
|
|
133
|
+
Dispatch **4–8 \`Explore\` subagents in parallel**, partitioned by *slice* (not
|
|
134
|
+
directory):
|
|
141
135
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
136
|
+
- Entry points (routes, CLI, events, public exports)
|
|
137
|
+
- Data model (schemas, types, invariants)
|
|
138
|
+
- Control flow (typical request/job end-to-end)
|
|
139
|
+
- External integrations (APIs, queues, env vars)
|
|
140
|
+
- Tests (what's tested = what's load-bearing)
|
|
141
|
+
- History (recent git log surfaces pain points)
|
|
142
|
+
- Cross-cutting (auth, errors, logging, flags as they apply)
|
|
145
143
|
|
|
146
|
-
|
|
144
|
+
Each subagent returns: concrete \`file:line\` refs, *non-obvious* facts (skip
|
|
145
|
+
filename-obvious), naming conventions, gotchas. Reject vague summaries.
|
|
147
146
|
|
|
148
|
-
|
|
147
|
+
## 4. Verify with user
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
\`\`\`
|
|
149
|
+
Code = *what*. User = *why*. Use \`AskUserQuestion\` (≤4 questions,
|
|
150
|
+
multi-choice, best-guess first):
|
|
153
151
|
|
|
154
|
-
|
|
152
|
+
- Business purpose / who depends on it
|
|
153
|
+
- Surprising-looking architectural decisions
|
|
154
|
+
- Ownership / deprecation status / expected scale
|
|
155
|
+
- Canonical flow when multiple exist
|
|
155
156
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
\`file:line\` over prose; tables where structure fits; skip anything
|
|
159
|
-
self-evident from a 30-second skim of the code; no "this section covers…"
|
|
160
|
-
meta-commentary.
|
|
157
|
+
Skip if greppable or won't change the primer. **Never write unconfirmed
|
|
158
|
+
assumptions.**
|
|
161
159
|
|
|
162
|
-
|
|
163
|
-
keywords the user (or agent) would naturally say. Aim for ≤250 chars.
|
|
160
|
+
## 5. Scaffold
|
|
164
161
|
|
|
165
|
-
|
|
162
|
+
\`\`\`
|
|
163
|
+
crtr skill new <name> --scope project --description "<what+when, ≤250 chars, front-loaded triggers>"
|
|
164
|
+
\`\`\`
|
|
166
165
|
|
|
167
|
-
|
|
166
|
+
## 6. Write the body
|
|
168
167
|
|
|
169
168
|
\`\`\`markdown
|
|
170
169
|
# <topic>
|
|
171
170
|
|
|
172
171
|
## Purpose
|
|
173
|
-
Why this exists.
|
|
172
|
+
Why this exists. Problem solved. Who depends on it.
|
|
174
173
|
(1–3 tight paragraphs — what code can't tell you.)
|
|
175
174
|
|
|
176
175
|
## Architecture
|
|
@@ -185,97 +184,252 @@ Components, responsibilities, data/control flow, boundaries.
|
|
|
185
184
|
Domain terms, invariants, non-obvious constraints.
|
|
186
185
|
|
|
187
186
|
## Entry points
|
|
188
|
-
|
|
187
|
+
\`file:line\` where work enters.
|
|
189
188
|
|
|
190
189
|
## Gotchas
|
|
191
|
-
Non-obvious coupling.
|
|
190
|
+
Non-obvious coupling. Looks-broken-but-isn't. Past footguns.
|
|
192
191
|
|
|
193
192
|
## Related
|
|
194
|
-
- \`<other-skill>\` —
|
|
193
|
+
- \`<other-skill>\` — interaction
|
|
195
194
|
\`\`\`
|
|
196
195
|
|
|
197
|
-
|
|
196
|
+
**Density rules:**
|
|
197
|
+
- \`file:line\` over prose
|
|
198
|
+
- Tables where structure fits
|
|
199
|
+
- Skip 30-second-skim-obvious
|
|
200
|
+
- No "this section covers…" meta
|
|
201
|
+
- Budget ~150 lines; deeper reference → sibling files
|
|
198
202
|
|
|
199
|
-
|
|
200
|
-
# <topic preferences>
|
|
203
|
+
## 7. Verify
|
|
201
204
|
|
|
202
|
-
|
|
203
|
-
|
|
205
|
+
\`\`\`
|
|
206
|
+
crtr skill where <name>
|
|
207
|
+
crtr skill show <name>
|
|
208
|
+
crtr skill search <keyword> # confirm description triggers discovery
|
|
209
|
+
\`\`\`
|
|
204
210
|
|
|
205
|
-
|
|
206
|
-
Reason given — past incident, strong preference, constraint.
|
|
211
|
+
Sharpen description if discovery misses. Cut body if bloated.
|
|
207
212
|
|
|
208
|
-
##
|
|
209
|
-
|
|
213
|
+
## Updates
|
|
214
|
+
|
|
215
|
+
If updating existing primer: diff draft vs current, call out changes + why
|
|
216
|
+
before writing. Update related skills' \`## Related\` sections.
|
|
217
|
+
`;
|
|
218
|
+
}
|
|
219
|
+
function playbookTemplatePrompt(topic) {
|
|
220
|
+
return `# Playbook — methodology skill
|
|
221
|
+
|
|
222
|
+
**Audience: future LLM agent sessions.** Teaches *judgment*, not facts —
|
|
223
|
+
decision frameworks, heuristics, when-to-use / when-not-to-use. Examples:
|
|
224
|
+
skill-authoring, debugging methodology, multi-agent orchestration.
|
|
225
|
+
|
|
226
|
+
${topicLine(topic)}
|
|
227
|
+
|
|
228
|
+
## Litmus test
|
|
229
|
+
|
|
230
|
+
> Does this teach judgment, or describe an API?
|
|
231
|
+
|
|
232
|
+
If you'd write *"when X, do Y because Z"* → playbook. If you'd write tables
|
|
233
|
+
of fields/flags/events → reference material (put in sibling \`reference.md\`,
|
|
234
|
+
not SKILL.md). If neither fits → use \`crtr skill template freeform\` instead.
|
|
235
|
+
|
|
236
|
+
**Playbook markers:** teaches a framework · has "when (not) to use" · prose
|
|
237
|
+
over tables · reader makes better decisions after 30 seconds.
|
|
238
|
+
|
|
239
|
+
## 1. Interview
|
|
240
|
+
|
|
241
|
+
A playbook = user's accumulated judgment. Not greppable. Use
|
|
242
|
+
\`AskUserQuestion\` (≤4, multi-choice, best-guess first):
|
|
243
|
+
|
|
244
|
+
- The decision this skill teaches
|
|
245
|
+
- 2–4 most common failure modes without it
|
|
246
|
+
- Triggers (words/situations that should load it)
|
|
247
|
+
- Non-obvious rules that surprise newcomers
|
|
248
|
+
|
|
249
|
+
Push back on vagueness. *"Be thoughtful"* ≠ heuristic. *"Prefer one bundled
|
|
250
|
+
PR over many small ones for refactors here, because review churn dominates"*
|
|
251
|
+
= heuristic.
|
|
252
|
+
|
|
253
|
+
## 2. Scope + name
|
|
254
|
+
|
|
255
|
+
- **Scope**: \`user\` for cross-project methodology. \`project\` for repo-specific.
|
|
256
|
+
- **Name**: kebab-case, verb-or-noun-phrase. Not "guide-to-X".
|
|
257
|
+
- Check \`crtr skill where <name>\`.
|
|
258
|
+
|
|
259
|
+
## 3. Scaffold
|
|
260
|
+
|
|
261
|
+
\`\`\`
|
|
262
|
+
crtr skill new <name> --scope <user|project> --description "<what it teaches + when to load, ≤250 chars, front-loaded triggers>"
|
|
210
263
|
\`\`\`
|
|
211
264
|
|
|
212
|
-
|
|
265
|
+
## 4. Density rules
|
|
266
|
+
|
|
267
|
+
LLM reasoning degrades past ~3k tokens. **Budget ~150 lines for SKILL.md.**
|
|
268
|
+
|
|
269
|
+
- Decision-first. *"When you need X"* before *"how X works"*.
|
|
270
|
+
- One well-placed "don't" > three paragraphs of explanation.
|
|
271
|
+
- Reasoning chains > example outputs. Show *how to think*, not *what to produce*.
|
|
272
|
+
- Section >20 lines without teaching judgment → move to \`reference.md\`.
|
|
273
|
+
|
|
274
|
+
**Test:** can someone reading 30 seconds make a better decision? If they need
|
|
275
|
+
to read the whole thing for value, you've buried the judgment.
|
|
276
|
+
|
|
277
|
+
## 5. Body skeleton
|
|
213
278
|
|
|
214
279
|
\`\`\`markdown
|
|
215
|
-
# <
|
|
280
|
+
# <skill name>
|
|
216
281
|
|
|
217
|
-
|
|
218
|
-
Triggering condition.
|
|
282
|
+
<1-paragraph: what + when to load>
|
|
219
283
|
|
|
220
|
-
##
|
|
221
|
-
|
|
222
|
-
2. …
|
|
284
|
+
## When to use
|
|
285
|
+
- <trigger>
|
|
223
286
|
|
|
224
|
-
##
|
|
225
|
-
|
|
287
|
+
## When NOT to use
|
|
288
|
+
- <anti-trigger>
|
|
226
289
|
|
|
227
|
-
##
|
|
228
|
-
|
|
290
|
+
## The core decision
|
|
291
|
+
<central judgment — usually a heuristic or framework>
|
|
292
|
+
|
|
293
|
+
## <heuristic 1>
|
|
294
|
+
<2–6 lines, brief (anti-)example>
|
|
295
|
+
|
|
296
|
+
## <heuristic 2>
|
|
297
|
+
…
|
|
298
|
+
|
|
299
|
+
## Failure modes
|
|
300
|
+
- **<name>**: what it looks like; how to avoid
|
|
301
|
+
|
|
302
|
+
## Related
|
|
303
|
+
- \`<other-skill>\` — interaction
|
|
304
|
+
\`\`\`
|
|
305
|
+
|
|
306
|
+
## 6. Progressive disclosure
|
|
307
|
+
|
|
308
|
+
If deep reference is needed:
|
|
309
|
+
|
|
310
|
+
\`\`\`
|
|
311
|
+
<skill-dir>/
|
|
312
|
+
SKILL.md # judgment layer — <150 lines
|
|
313
|
+
reference.md # lookup layer
|
|
314
|
+
examples.md # optional worked examples
|
|
229
315
|
\`\`\`
|
|
230
316
|
|
|
231
|
-
|
|
317
|
+
SKILL.md *links* to siblings (\`see [reference.md](reference.md)\`). Agent
|
|
318
|
+
loads supporting files only when needed.
|
|
232
319
|
|
|
320
|
+
## 7. Verify
|
|
321
|
+
|
|
322
|
+
\`\`\`
|
|
323
|
+
crtr skill where <name>
|
|
324
|
+
crtr skill show <name>
|
|
325
|
+
crtr skill search <keyword>
|
|
326
|
+
\`\`\`
|
|
327
|
+
|
|
328
|
+
## Deep-dive reference
|
|
329
|
+
|
|
330
|
+
For canonical SKILL.md authoring (frontmatter fields, argument passing,
|
|
331
|
+
dynamic context, subagent forking, hooks):
|
|
332
|
+
|
|
333
|
+
\`\`\`
|
|
334
|
+
crtr skill show authoring-skills
|
|
335
|
+
\`\`\`
|
|
336
|
+
|
|
337
|
+
The playbook above gives you structure + density rules. \`authoring-skills\`
|
|
338
|
+
covers the SKILL.md surface itself.
|
|
339
|
+
|
|
340
|
+
## Constraints
|
|
341
|
+
|
|
342
|
+
- Topic fails litmus? → \`crtr skill template freeform\` or \`primer\`.
|
|
343
|
+
- No unconfirmed heuristics — if not from user experience or clear principle,
|
|
344
|
+
leave it out.
|
|
345
|
+
- Update related skills' \`## Related\` if interactions exist.
|
|
346
|
+
`;
|
|
347
|
+
}
|
|
348
|
+
function freeformTemplatePrompt(topic) {
|
|
349
|
+
return `# Freeform — escape hatch skill
|
|
350
|
+
|
|
351
|
+
**Audience: future LLM agent sessions.** Use when content doesn't fit
|
|
352
|
+
\`primer\` (codebase knowledge) or \`playbook\` (methodology) — glossaries,
|
|
353
|
+
decisions, runbooks, lists, preferences.
|
|
354
|
+
|
|
355
|
+
${topicLine(topic)}
|
|
356
|
+
|
|
357
|
+
## 1. Pick a shape
|
|
358
|
+
|
|
359
|
+
What kind of thing is this?
|
|
360
|
+
|
|
361
|
+
- Terms + definitions → glossary-shaped
|
|
362
|
+
- "We decided X, here's why" → decision-shaped
|
|
363
|
+
- Procedure with steps + rollback → runbook-shaped
|
|
364
|
+
- User preferences → preference-shaped
|
|
365
|
+
- None of the above → freeform
|
|
366
|
+
|
|
367
|
+
No strict template; the shape just tells you what to ask for.
|
|
368
|
+
|
|
369
|
+
## 2. Interview
|
|
370
|
+
|
|
371
|
+
\`AskUserQuestion\` (≤4, multi-choice, best-guess first). Get only what you
|
|
372
|
+
need to write the skill. **No unconfirmed assumptions** — if not from user
|
|
373
|
+
or grep, omit it.
|
|
374
|
+
|
|
375
|
+
## 3. Scope + name + scaffold
|
|
376
|
+
|
|
377
|
+
\`\`\`
|
|
378
|
+
crtr skill new <name> --scope <user|project> --description "<what+when, ≤250 chars, front-loaded triggers>"
|
|
379
|
+
\`\`\`
|
|
380
|
+
|
|
381
|
+
## 4. Body — pick the closest skeleton
|
|
382
|
+
|
|
383
|
+
**Glossary:**
|
|
233
384
|
\`\`\`markdown
|
|
234
385
|
# <domain> glossary
|
|
235
|
-
|
|
236
386
|
| Term | Definition | Notes |
|
|
237
387
|
|------|------------|-------|
|
|
238
|
-
| … | … | … |
|
|
239
388
|
\`\`\`
|
|
240
389
|
|
|
241
|
-
|
|
242
|
-
|
|
390
|
+
**Decision:**
|
|
243
391
|
\`\`\`markdown
|
|
244
|
-
# <decision
|
|
245
|
-
|
|
392
|
+
# <decision> — <date>
|
|
246
393
|
## Context
|
|
247
|
-
What forced the decision.
|
|
248
|
-
|
|
249
394
|
## Decision
|
|
250
|
-
What we chose.
|
|
251
|
-
|
|
252
395
|
## Consequences
|
|
253
|
-
What this costs us. What it buys us.
|
|
254
|
-
|
|
255
396
|
## Alternatives considered
|
|
256
|
-
- …
|
|
257
397
|
\`\`\`
|
|
258
398
|
|
|
259
|
-
|
|
399
|
+
**Runbook:**
|
|
400
|
+
\`\`\`markdown
|
|
401
|
+
# <procedure>
|
|
402
|
+
## When to run
|
|
403
|
+
## Steps
|
|
404
|
+
## Verification
|
|
405
|
+
## Rollback
|
|
406
|
+
\`\`\`
|
|
407
|
+
|
|
408
|
+
**Preference:**
|
|
409
|
+
\`\`\`markdown
|
|
410
|
+
# <preference>
|
|
411
|
+
## Rule
|
|
412
|
+
## Why
|
|
413
|
+
## How to apply
|
|
414
|
+
\`\`\`
|
|
415
|
+
|
|
416
|
+
Or invent your own. Stay tight — no padding.
|
|
417
|
+
|
|
418
|
+
## 5. Verify
|
|
260
419
|
|
|
261
420
|
\`\`\`
|
|
262
|
-
crtr skill where <name>
|
|
263
|
-
crtr skill
|
|
264
|
-
crtr skill
|
|
421
|
+
crtr skill where <name>
|
|
422
|
+
crtr skill show <name>
|
|
423
|
+
crtr skill search <keyword>
|
|
265
424
|
\`\`\`
|
|
266
425
|
|
|
267
|
-
|
|
268
|
-
body is bloated, cut it. Budget ~150 lines for SKILL.md; move deep reference
|
|
269
|
-
into sibling files in the same directory.
|
|
426
|
+
## Switch templates if needed
|
|
270
427
|
|
|
271
|
-
|
|
428
|
+
If the content is actually methodology or codebase knowledge:
|
|
272
429
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
and call out what changed and why before writing.
|
|
278
|
-
- Update related skills' \`## Related\` sections if you're adding something
|
|
279
|
-
that interacts with them.
|
|
430
|
+
\`\`\`
|
|
431
|
+
crtr skill template playbook ${topic ? topic : '<topic>'}
|
|
432
|
+
crtr skill template primer ${topic ? topic : '<topic>'}
|
|
433
|
+
\`\`\`
|
|
280
434
|
`;
|
|
281
435
|
}
|