@crouton-kit/crouter 0.1.9 → 0.2.2

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.
@@ -48,14 +48,30 @@ crtr skill where <name> # {scope, plugin, path} JSON
48
48
  ## Author (progressive disclosure)
49
49
 
50
50
  \`\`\`
51
- crtr skill create [topic...] # pick a template type
52
- crtr skill template <type> [topic] # workflow + skeleton for that type
53
- crtr skill new <name> # bare scaffold, scope-direct
51
+ crtr skill create [topic...] # pick a template type
52
+ crtr skill template <type> [topic] # workflow + skeleton for that type
53
+ crtr skill new <name> --type <type> # bare scaffold with typed frontmatter
54
54
  \`\`\`
55
55
 
56
+ Five types — pick by what the agent does after reading:
57
+
58
+ - \`playbook\` — decide (judgment, heuristics, when-to-use)
59
+ - \`primer\` — navigate (codebase facts, architecture)
60
+ - \`reference\` — look up (stable facts, tables)
61
+ - \`runbook\` — execute (numbered procedure)
62
+ - \`freeform\` — none of the above (catchall)
63
+
56
64
  Don't load \`create\` and \`template\` in the same turn — \`create\` decides the
57
65
  type, then call \`template\`.
58
66
 
67
+ ## Neighbors auto-append
68
+
69
+ \`crtr skill show <name>\` appends a \`## Neighbors\` section listing siblings
70
+ (same parent dir) and nested skills. Skill bodies should write \`## Related\`
71
+ **only** for cross-plugin or distant refs — within-plugin links are redundant.
72
+
73
+ Suppress with \`crtr skill show <name> --no-neighbors\`.
74
+
59
75
  ## Toggle
60
76
 
61
77
  \`\`\`
@@ -81,11 +97,22 @@ ${topicLine}
81
97
 
82
98
  ## Templates
83
99
 
84
- - \`primer\` codebase/architectural knowledge ("how does X work, why, what
85
- are the gotchas"). Triggers parallel-explore research.
86
- - \`playbook\` — methodology/judgment ("how to think about X"). The
87
- \`authoring:skills\`-style skill that teaches decisions, not facts.
88
- - \`freeform\` — anything else (glossary, decision record, runbook, prefs).
100
+ Pick by what the agent does after reading the skill:
101
+
102
+ - \`playbook\` — **decide**. Judgment, heuristics, when-to-use / when-not-to-use.
103
+ Examples: skill-authoring, debugging methodology. Most skills are this.
104
+ - \`primer\` — **navigate**. Codebase/architectural facts. *"How does this
105
+ subsystem work, why, what are the gotchas."* Triggers parallel-explore.
106
+ - \`reference\` — **look up**. Stable facts: protocol fields, API surface,
107
+ glossaries, lookup tables. Source of truth is external (spec, docs).
108
+ - \`runbook\` — **execute**. Numbered procedure with decision points and
109
+ rollback. Examples: deploy, incident response, review workflow.
110
+ - \`freeform\` — **none of the above**. Catchall for decision records, prefs,
111
+ miscellany.
112
+
113
+ Litmus: *"when X, do Y"* → playbook. *"these are the fields of Y"* →
114
+ reference. *"step 1, step 2, step 3"* → runbook. *"how X is built inside
115
+ this repo"* → primer.
89
116
 
90
117
  ## Next
91
118
 
@@ -103,6 +130,7 @@ ${topicLine}
103
130
 
104
131
  - Subsystem is small/self-evident → suggest CLAUDE.md note instead of primer.
105
132
  - "Topic" is really a one-off task → don't capture; just do the work.
133
+ - Content is one-off lookup that lives elsewhere → link to it, don't mirror.
106
134
  `;
107
135
  }
108
136
  export function skillTemplatePrompt(type, topic) {
@@ -111,9 +139,13 @@ export function skillTemplatePrompt(type, topic) {
111
139
  return primerTemplatePrompt(topic);
112
140
  if (t === 'playbook')
113
141
  return playbookTemplatePrompt(topic);
142
+ if (t === 'reference')
143
+ return referenceTemplatePrompt(topic);
144
+ if (t === 'runbook')
145
+ return runbookTemplatePrompt(topic);
114
146
  if (t === 'freeform')
115
147
  return freeformTemplatePrompt(topic);
116
- return `unknown template type: ${type}\nvalid: primer | playbook | freeform\nrun \`crtr skill create\` to pick.\n`;
148
+ return `unknown template type: ${type}\nvalid: playbook | primer | reference | runbook | freeform\nrun \`crtr skill create\` to pick.\n`;
117
149
  }
118
150
  function topicLine(topic) {
119
151
  return topic
@@ -176,7 +208,7 @@ assumptions.**
176
208
  ## 5. Scaffold
177
209
 
178
210
  \`\`\`
179
- crtr skill new <name> --scope project --description "<what+when, ≤250 chars, front-loaded triggers>"
211
+ crtr skill new <name> --type primer --scope project --description "<what+when, ≤250 chars, front-loaded triggers>"
180
212
  \`\`\`
181
213
 
182
214
  ## 6. Write the body
@@ -204,11 +236,12 @@ Domain terms, invariants, non-obvious constraints.
204
236
 
205
237
  ## Gotchas
206
238
  Non-obvious coupling. Looks-broken-but-isn't. Past footguns.
207
-
208
- ## Related
209
- - \`<other-skill>\` — interaction
210
239
  \`\`\`
211
240
 
241
+ **No \`## Related\` for within-plugin siblings** — the CLI auto-appends a
242
+ \`## Neighbors\` section on \`crtr skill show\`. Add a manual \`## Related\`
243
+ only for cross-plugin or distant refs.
244
+
212
245
  **Density rules:**
213
246
  - \`file:line\` over prose
214
247
  - Tables where structure fits
@@ -229,7 +262,7 @@ Sharpen description if discovery misses. Cut body if bloated.
229
262
  ## Updates
230
263
 
231
264
  If updating existing primer: diff draft vs current, call out changes + why
232
- before writing. Update related skills' \`## Related\` sections.
265
+ before writing.
233
266
  `;
234
267
  }
235
268
  function playbookTemplatePrompt(topic) {
@@ -275,7 +308,7 @@ PR over many small ones for refactors here, because review churn dominates"*
275
308
  ## 3. Scaffold
276
309
 
277
310
  \`\`\`
278
- crtr skill new <name> --scope <user|project> --description "<what it teaches + when to load, ≤250 chars, front-loaded triggers>"
311
+ crtr skill new <name> --type playbook --scope <user|project> --description "<what it teaches + when to load, ≤250 chars, front-loaded triggers>"
279
312
  \`\`\`
280
313
 
281
314
  ## 4. Density rules
@@ -314,11 +347,12 @@ to read the whole thing for value, you've buried the judgment.
314
347
 
315
348
  ## Failure modes
316
349
  - **<name>**: what it looks like; how to avoid
317
-
318
- ## Related
319
- - \`<other-skill>\` — interaction
320
350
  \`\`\`
321
351
 
352
+ **No \`## Related\` for within-plugin siblings** — the CLI auto-appends a
353
+ \`## Neighbors\` section on \`crtr skill show\`. Add a manual \`## Related\`
354
+ only for cross-plugin or distant refs.
355
+
322
356
  ## 6. Progressive disclosure
323
357
 
324
358
  If deep reference is needed:
@@ -347,18 +381,17 @@ For canonical SKILL.md authoring (frontmatter fields, argument passing,
347
381
  dynamic context, subagent forking, hooks):
348
382
 
349
383
  \`\`\`
350
- crtr skill show authoring-skills
384
+ crtr skill show crouter-development/skills
351
385
  \`\`\`
352
386
 
353
- The playbook above gives you structure + density rules. \`authoring-skills\`
354
- covers the SKILL.md surface itself.
387
+ The playbook above gives you structure + density rules.
388
+ \`crouter-development/skills\` covers the SKILL.md surface itself.
355
389
 
356
390
  ## Constraints
357
391
 
358
- - Topic fails litmus? → \`crtr skill template freeform\` or \`primer\`.
392
+ - Topic fails litmus? → \`crtr skill template freeform\`, \`reference\`, or \`runbook\`.
359
393
  - No unconfirmed heuristics — if not from user experience or clear principle,
360
394
  leave it out.
361
- - Update related skills' \`## Related\` if interactions exist.
362
395
  `;
363
396
  }
364
397
  function freeformTemplatePrompt(topic) {
@@ -391,7 +424,7 @@ or grep, omit it.
391
424
  ## 3. Scope + name + scaffold
392
425
 
393
426
  \`\`\`
394
- crtr skill new <name> --scope <user|project> --description "<what+when, ≤250 chars, front-loaded triggers>"
427
+ crtr skill new <name> --type freeform --scope <user|project> --description "<what+when, ≤250 chars, front-loaded triggers>"
395
428
  \`\`\`
396
429
 
397
430
  ## 4. Body — pick the closest skeleton
@@ -441,11 +474,226 @@ crtr skill search <keyword>
441
474
 
442
475
  ## Switch templates if needed
443
476
 
444
- If the content is actually methodology or codebase knowledge:
477
+ Content actually fits a typed template?
478
+
479
+ \`\`\`
480
+ crtr skill template playbook ${topic ? topic : '<topic>'} # decide
481
+ crtr skill template primer ${topic ? topic : '<topic>'} # navigate codebase
482
+ crtr skill template reference ${topic ? topic : '<topic>'} # look up stable facts
483
+ crtr skill template runbook ${topic ? topic : '<topic>'} # execute a procedure
484
+ \`\`\`
485
+ `;
486
+ }
487
+ function referenceTemplatePrompt(topic) {
488
+ return `# Reference — lookup-fact skill
489
+
490
+ **Audience: future LLM agent sessions.** Captures *stable lookup facts* an
491
+ agent will grep or scan: protocol fields, API surfaces, glossaries, enum
492
+ tables, status-code maps. Source of truth lives *outside* the skill (RFC,
493
+ spec, vendor docs); the skill is a fast in-repo cache.
494
+
495
+ ${topicLine(topic)}
496
+
497
+ ## Litmus test
498
+
499
+ > Would you *grep* this rather than *read* it?
500
+
501
+ If you'd skim end-to-end → it's not reference. If you'd jump straight to
502
+ the row you need → reference. If you'd make a decision after reading →
503
+ \`crtr skill template playbook\`. If you'd execute steps → \`runbook\`.
504
+
505
+ **Reference markers:** mostly tables · stable across releases · authoritative
506
+ source elsewhere · agent loads to *answer*, not to *think*.
507
+
508
+ ## 1. Confirm reference, not playbook
509
+
510
+ Use \`AskUserQuestion\` (≤4, multi-choice, best-guess first):
511
+
512
+ - The lookup the agent will perform (e.g., "what does HTTP 423 mean")
513
+ - Stability: does this change every release? If yes, push back — link the
514
+ upstream source instead of mirroring it.
515
+ - Authoritative source URL (cite in the body)
516
+
517
+ Skip if the topic is clearly facts (RFCs, public API). **Never invent
518
+ field/flag/code values** — pull verbatim from source.
519
+
520
+ ## 2. Scope + name
521
+
522
+ - **Scope**: \`user\` for cross-project facts. \`project\` for repo-specific.
523
+ - **Name**: noun-phrase. \`http-status-codes\` not \`learn-http-status\`.
524
+ - Check \`crtr skill where <name>\`.
525
+
526
+ ## 3. Scaffold
527
+
528
+ \`\`\`
529
+ crtr skill new <name> --type reference --scope <user|project> --description "<what to look up + when to load, ≤250 chars>"
530
+ \`\`\`
531
+
532
+ ## 4. Density rules
533
+
534
+ Reference skills are *load and scan*, not *load and read*. Optimize for jump-to-row.
535
+
536
+ - Tables for anything multi-row. Columns: most-queried field first.
537
+ - One topic per file. Split if it doesn't fit one screen.
538
+ - Source URL at the top — agent verifies before trusting cached facts.
539
+ - No prose paragraphs longer than 2 lines.
540
+ - Skip *why* — playbooks teach why. Reference teaches what.
541
+
542
+ ## 5. Body skeleton
543
+
544
+ \`\`\`markdown
545
+ # <topic> reference
546
+
547
+ **Source of truth:** <URL or spec name>
548
+ **Last verified:** <date — when an agent should re-check>
549
+
550
+ ## <table 1 title>
551
+ | <field> | <value> | <notes> |
552
+ |---------|---------|---------|
553
+ | … | … | … |
554
+
555
+ ## <table 2 title>
556
+
557
+
558
+ ## Edge cases / gotchas
559
+ - Brief bullets. *What* is misleading, not *why*.
560
+ \`\`\`
561
+
562
+ **No \`## Related\` for within-plugin siblings** — auto-appended by the CLI.
563
+
564
+ ## 6. Progressive disclosure
565
+
566
+ If reference is large, split:
567
+
568
+ \`\`\`
569
+ <skill-dir>/
570
+ SKILL.md # top-level index + most-queried table
571
+ full-table.md # the full set
572
+ examples.md # rarely-needed worked examples
573
+ \`\`\`
574
+
575
+ SKILL.md links to siblings (\`see [full-table.md](full-table.md)\`).
576
+
577
+ ## 7. Verify
578
+
579
+ \`\`\`
580
+ crtr skill where <name>
581
+ crtr skill show <name>
582
+ crtr skill search <keyword>
583
+ \`\`\`
584
+
585
+ Search must surface the skill on a typical lookup query. Sharpen the
586
+ description if it doesn't.
587
+
588
+ ## Constraints
589
+
590
+ - No invented values. If you can't cite the source, leave the row out.
591
+ - Topic teaches *judgment*, not facts? → \`crtr skill template playbook\`.
592
+ - Topic is a *procedure*? → \`crtr skill template runbook\`.
593
+ - Source updates faster than you'll update the skill? → don't capture; link.
594
+ `;
595
+ }
596
+ function runbookTemplatePrompt(topic) {
597
+ return `# Runbook — procedure skill
598
+
599
+ **Audience: future LLM agent sessions.** Captures a *procedure* the agent
600
+ executes: numbered steps, decision points, verification, rollback. Examples:
601
+ deploy, incident response, review workflow, release cut.
602
+
603
+ ${topicLine(topic)}
604
+
605
+ ## Litmus test
606
+
607
+ > After loading this, does the agent *do steps in order*?
608
+
609
+ If yes → runbook. If the agent makes a decision and stops → \`playbook\`. If
610
+ the agent looks up a value → \`reference\`. If neither fits → \`freeform\`.
611
+
612
+ **Runbook markers:** numbered steps · ordering matters · has rollback or
613
+ verification · maps an outcome to a known sequence.
614
+
615
+ ## 1. Capture the procedure
616
+
617
+ Use \`AskUserQuestion\` (≤4, multi-choice, best-guess first):
618
+
619
+ - The trigger (when does the agent run this?)
620
+ - Steps in order — explicit, atomic. *"Update X"* is not atomic; *"run
621
+ \\\`pnpm db:migrate\\\` and confirm exit 0"* is.
622
+ - Decision points within the sequence (when does the agent branch?)
623
+ - Rollback / verification (how to confirm success; how to undo on failure)
624
+
625
+ Push back on vagueness. *"Deploy to prod"* is a label; *"run \\\`pnpm build\\\`,
626
+ push to \\\`main\\\`, wait for green CI, click promote"* is a runbook step.
627
+
628
+ ## 2. Scope + name
629
+
630
+ - **Scope**: \`project\` for repo-specific procedures. \`user\` for cross-project.
631
+ - **Name**: verb-phrase. \`deploy-to-prod\` not \`production-deployment-guide\`.
632
+ - Check \`crtr skill where <name>\`.
633
+
634
+ ## 3. Scaffold
445
635
 
446
636
  \`\`\`
447
- crtr skill template playbook ${topic ? topic : '<topic>'}
448
- crtr skill template primer ${topic ? topic : '<topic>'}
637
+ crtr skill new <name> --type runbook --scope <user|project> --description "<when to run + outcome, ≤250 chars, front-loaded trigger>"
449
638
  \`\`\`
639
+
640
+ ## 4. Density rules
641
+
642
+ - Steps are commands, not advice. Each step is something the agent can verify.
643
+ - Decision points get explicit branches, not "use judgment."
644
+ - Verification belongs in-line, after the step that produces the change.
645
+ - Rollback is mandatory if the procedure changes prod state.
646
+
647
+ ## 5. Body skeleton
648
+
649
+ \`\`\`markdown
650
+ # <procedure>
651
+
652
+ ## When to run
653
+ - <trigger>
654
+
655
+ ## Pre-flight
656
+ - [ ] <thing that must be true before starting>
657
+
658
+ ## Steps
659
+
660
+ 1. **<atomic action>** — \\\`<command>\\\`
661
+ Verify: <observation that confirms success>
662
+ If <error condition>: <what to do>
663
+
664
+ 2. **<atomic action>** — …
665
+
666
+ ## Decision points
667
+
668
+ - After step N, if X then go to step M; else continue.
669
+
670
+ ## Verification (post-flight)
671
+ - [ ] <how to confirm the procedure succeeded end-to-end>
672
+
673
+ ## Rollback
674
+ 1. <reverse-order undo steps with their own verification>
675
+ \`\`\`
676
+
677
+ **No \`## Related\` for within-plugin siblings** — auto-appended by the CLI.
678
+
679
+ ## 6. Verify
680
+
681
+ \`\`\`
682
+ crtr skill where <name>
683
+ crtr skill show <name>
684
+ crtr skill search <keyword>
685
+ \`\`\`
686
+
687
+ Walk through the runbook mentally. Each step verifiable? Each decision
688
+ explicit? Rollback covers the state changes? If any answer is no, fix
689
+ before shipping.
690
+
691
+ ## Constraints
692
+
693
+ - Steps without verification are wishes. Add the verify line or cut the step.
694
+ - "Use your judgment at step 4" → either turn step 4 into a playbook
695
+ reference, or write the decision criteria explicitly.
696
+ - A procedure that's actually one command isn't a runbook — make it a
697
+ CLAUDE.md note.
450
698
  `;
451
699
  }
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export type Scope = 'user' | 'project';
1
+ export type Scope = 'user' | 'project' | 'builtin';
2
2
  export declare const ExitCode: {
3
3
  readonly SUCCESS: 0;
4
4
  readonly GENERAL: 1;
@@ -71,10 +71,14 @@ export interface ScopeState {
71
71
  last_self_check?: string;
72
72
  bootstrap_done?: boolean;
73
73
  }
74
+ export declare const SKILL_TYPES: readonly ["playbook", "primer", "reference", "runbook", "freeform"];
75
+ export type SkillType = (typeof SKILL_TYPES)[number];
76
+ export declare function isSkillType(v: unknown): v is SkillType;
74
77
  export interface SkillFrontmatter {
75
78
  name: string;
76
79
  description?: string;
77
80
  keywords?: string[];
81
+ type?: SkillType;
78
82
  }
79
83
  export interface Skill {
80
84
  name: string;
@@ -92,6 +96,7 @@ export interface InstalledPlugin {
92
96
  root: string;
93
97
  manifest: PluginManifest;
94
98
  enabled: boolean;
99
+ builtin?: boolean;
95
100
  sourceMarketplace?: string;
96
101
  version?: string;
97
102
  }
package/dist/types.js CHANGED
@@ -7,6 +7,10 @@ export const ExitCode = {
7
7
  NETWORK: 5,
8
8
  };
9
9
  export const SCHEMA_VERSION = 1;
10
+ export const SKILL_TYPES = ['playbook', 'primer', 'reference', 'runbook', 'freeform'];
11
+ export function isSkillType(v) {
12
+ return typeof v === 'string' && SKILL_TYPES.includes(v);
13
+ }
10
14
  export const PLUGIN_MANIFEST_DIR = '.crouter-plugin';
11
15
  export const PLUGIN_MANIFEST_FILE = 'plugin.json';
12
16
  export const MARKETPLACE_MANIFEST_DIR = '.crouter-marketplace';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crouton-kit/crouter",
3
- "version": "0.1.9",
3
+ "version": "0.2.2",
4
4
  "description": "crtr — fast access to skills, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "bin"
24
24
  ],
25
25
  "scripts": {
26
- "build": "tsc",
26
+ "build": "tsc && rm -rf dist/builtin-skills && cp -R src/builtin-skills dist/builtin-skills",
27
27
  "dev": "tsx src/cli.ts",
28
28
  "link": "npm link",
29
29
  "prepublishOnly": "npm run build"