agentic-skill-mill 1.0.3 → 1.0.5

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/README.md CHANGED
@@ -8,10 +8,18 @@ Forge and refine agent skill projects. The skill teaches agents how to work with
8
8
  npm install
9
9
  npm run build
10
10
  npm run compile
11
- bash install.sh # auto-detect installed tools
12
- bash install.sh --all # or install for all tools
11
+ bash install-local.sh # local repo setup (auto-detect tools)
12
+ bash install-local.sh --all # local repo setup for all tools
13
13
  ```
14
14
 
15
+ ## One-Line Remote Install (No Clone)
16
+
17
+ ```bash
18
+ bash <(curl -fsSL https://agenticskillmill.com/install.sh) --all
19
+ ```
20
+
21
+ This bootstrap script installs the npm utility library globally, then installs skills for the targets you specify.
22
+
15
23
  ## Architecture
16
24
 
17
25
  ```
@@ -42,6 +50,11 @@ Skills (what to do) CLI Companion (tools to do it with)
42
50
  | `skillmill audit-exports` | Audit that src/index.ts exports match core modules |
43
51
 
44
52
  All commands support `--json` for structured agent consumption.
53
+ You can run them without global install using npx, for example:
54
+
55
+ ```bash
56
+ npx --yes agentic-skill-mill@latest inventory --json
57
+ ```
45
58
 
46
59
  ## Project Layout
47
60
 
@@ -66,14 +79,16 @@ src/
66
79
 
67
80
  compiled/ # Machine-generated, one subdir per IDE target
68
81
  contributions/ # Field observations from real runs
69
- install.sh # One-command setup: build CLI + install skills
82
+ site/ # GitHub Pages site (agenticskillmill.com)
83
+ install-local.sh # One-command local setup: build CLI + install skills
84
+ install.sh # One-command remote bootstrap: install package + skills
70
85
  ```
71
86
 
72
87
  ## How to Add a Skill
73
88
 
74
89
  1. Create the source file at `skill/skills/<name>/<name>.md` with YAML frontmatter
75
90
  2. Register it in `skill/build/manifest.json`
76
- 3. Add the skill name to the `SKILLS` array in `install.sh`
91
+ 3. Add the skill name to the `SKILLS` array in `install-local.sh`
77
92
  4. Compile and validate: `npm run compile && npm run compile:validate`
78
93
 
79
94
  ## How to Add a Fragment
@@ -90,7 +105,7 @@ install.sh # One-command setup: build CLI + install skills
90
105
  4. Export the public API from `src/index.ts`
91
106
  5. Rebuild: `npm run build`
92
107
 
93
- Or use the forge command: `skillmill forge command <name> --write`
108
+ Or use the forge command with npx: `npx --yes agentic-skill-mill@latest forge command <name> --write`
94
109
 
95
110
  ## Compilation Targets
96
111
 
@@ -128,8 +143,8 @@ Workflow behavior:
128
143
 
129
144
  1. `npm ci`
130
145
  2. `npm run build`
131
- 3. `npm run test`
132
- 4. `npm run compile:validate`
133
- 5. `npm version patch`
146
+ 3. `npm run test -- --passWithNoTests`
147
+ 4. `npm run compile`
148
+ 5. `npm run compile:validate`
134
149
  6. `git push --follow-tags`
135
150
  7. `npm publish --access public`
@@ -0,0 +1,421 @@
1
+ ---
2
+ managed_by: agentic-skill-mill
3
+ name: agentic-skill-mill
4
+ description: "Build, augment, and maintain skill projects that follow the skill-system-template architecture. Covers adding CLI commands, creating fragments, composing skills, renaming projects, and turning research into actionable tooling. Use when the user mentions: add a command, new skill, new fragment, augment the CLI, build a utility, add a tool, rename the project, forge a component, or wants to extend an existing skill project."
5
+ ---
6
+
7
+ # Agentic Skill Mill
8
+
9
+ Forge and refine skill projects that follow the skill-system-template architecture: fragment-composed skills compiled to multiple IDE targets, paired with a TypeScript companion CLI (`skillmill`) that provides structured commands for agents and humans. Prefer `npx --yes agentic-skill-mill@latest <command>` when the utility is not globally installed. Remote users can install everything via `bash <(curl -fsSL https://agenticskillmill.com/install.sh) --all`.
10
+
11
+ ---
12
+
13
+ ## Architecture
14
+
15
+ The skill-system-template architecture has two halves that meet at the agent:
16
+
17
+ ```
18
+ Skills (what to do) CLI Companion (tools to do it with)
19
+ skill/skills/*.md src/cli/commands/*.ts
20
+ skill/fragments/*.md src/core/*.ts
21
+ | |
22
+ v v
23
+ compiled/ (7 IDE formats) dist/ (npm link -> global CLI)
24
+ | |
25
+ +---------> Agent <----------+
26
+ ```
27
+
28
+ **Skills** are step-by-step runbooks in markdown with YAML frontmatter. They tell the agent *what* to do. Skills reference the CLI by name so the agent can invoke structured commands.
29
+
30
+ **Fragments** are shared knowledge blocks included by multiple skills via include markers (`\{\{include:path\}\}`). Edit a fragment once, recompile, and every skill that includes it gets the update. Fragments have no frontmatter.
31
+
32
+ **The compiler** (`skill/build/compile.mjs`) resolves includes, applies IDE-specific frontmatter transforms, and writes to `compiled/` with one subdirectory per target. It validates naming rules, checks for unresolved includes, and cross-validates manifest declarations against actual includes in source files.
33
+
34
+ **The CLI companion** is a TypeScript package with:
35
+ - `src/core/` — Pure logic modules with typed interfaces
36
+ - `src/cli/commands/` — Thin command wrappers that delegate to core modules
37
+ - `src/cli/index.ts` — Commander.js entry point wiring all commands
38
+ - `src/cli/output-formatter.ts` — JSON, table, and key-value formatters
39
+ - `src/errors/types.ts` — Typed error hierarchy (AppError, NotFoundError, etc.)
40
+ - `src/cache/cache-manager.ts` — Two-tier cache (memory + disk) with TTL
41
+
42
+ **The local installer** (`install-local.sh`) builds the CLI, compiles skills, and copies compiled outputs to IDE-specific directories (~/.claude/skills, ~/.cursor/rules, etc.) with marker-based stale file cleanup. The bootstrap installer is hosted at `https://agenticskillmill.com/install.sh` (source: `site/install.sh`) and is also bundled in the npm package as `install.sh`. It installs the npm utility first, then delegates to `install-local.sh --skills-only`. Local installer functions use `set -e` for fail-fast behavior. Any function that uses an early-exit guard (`[[ -d ... ]] || return`, `[[ -z ... ]] && return`) **must** use `return 0`, never bare `return`. Bare `return` inherits the exit code of the last command, which for a failed conditional test is 1 -- and `set -e` treats that as a script-terminating failure with no error message.
43
+
44
+ ### Key files to modify when augmenting a project
45
+
46
+ | What | File(s) |
47
+ |------|---------|
48
+ | Add a CLI command | `src/core/<name>.ts`, `src/cli/commands/<name>.ts`, `src/cli/index.ts`, `src/index.ts` |
49
+ | Add a fragment | `skill/fragments/<category>/<name>.md`, `skill/build/manifest.json`, skill source |
50
+ | Add a skill | `skill/skills/<name>/<name>.md`, `skill/build/manifest.json`, `install-local.sh` SKILLS array |
51
+ | Rename the project | See the rename workflow |
52
+
53
+ ---
54
+
55
+ ## Workflow
56
+
57
+ ### Step 1: Understand the Goal
58
+
59
+ Ask or infer:
60
+
61
+ | Question | Why It Matters |
62
+ |----------|---------------|
63
+ | What is the user trying to add or change? | Scopes the work: new command, new skill, new fragment, rename, or full project |
64
+ | Is there research or a requirements document? | Source material drives which CLI commands to build |
65
+ | What's the existing project state? | Read manifest.json, package.json, and src/cli/index.ts to understand what's already built |
66
+ | Does this need a new skill, a new fragment, or just a new CLI command? | Different paths require different steps |
67
+
68
+ ### Step 2: Read the Project State
69
+
70
+ Before making changes, read these files to understand the current structure:
71
+
72
+ 1. `skill/build/manifest.json` — what skills and fragments exist
73
+ 2. `src/cli/index.ts` — what CLI commands are wired
74
+ 3. `src/index.ts` — what's exported
75
+ 4. `package.json` — package name, bin name, dependencies
76
+
77
+ ### Step 3: If Adding CLI Commands from Research
78
+
79
+ ### Extracting CLI utilities from research
80
+
81
+ When research documents, field observations, or domain expertise suggest actionable tooling, follow this process to turn insights into CLI commands:
82
+
83
+ **Step 1: Read the research and tag actionable items**
84
+
85
+ Scan the source material for:
86
+ - Checklists that could be generated dynamically (checklist generator command)
87
+ - Calculations that depend on user inputs (calculator command)
88
+ - Validation rules that can be checked programmatically (validator command)
89
+ - Structured data that can be extracted from existing files (extractor command)
90
+ - Schedules or plans that follow a formula (planner command)
91
+ - Analysis that can be automated against a codebase or artifact (scanner command)
92
+
93
+ **Step 2: Group by command**
94
+
95
+ Each command should do one thing well. If two items from the research share the same input and output shape, they belong in one command. If they have different inputs, they're separate commands.
96
+
97
+ | Research insight | CLI command type | Example |
98
+ |-----------------|-----------------|---------|
99
+ | "Audiences retain 3+/-1 points" | Validator | Check that outlines have 2-4 key sections |
100
+ | "Budget 130 WPM for speaking" | Calculator | Compute per-section word counts from time budgets |
101
+ | "Spaced retrieval beats rereading" | Planner | Generate rehearsal schedule from event date |
102
+ | "Audio quality affects credibility" | Checklist | Pre-flight checklist with audio test item |
103
+ | "Entry points tell the story structure" | Scanner | Analyze repo for entry points and connectivity |
104
+
105
+ **Step 3: Define the interface before writing code**
106
+
107
+ For each command, write the TypeScript interface first:
108
+ - What does the user provide? (Options interface)
109
+ - What does the command return? (Result interface)
110
+ - What warnings can it produce? (`warnings: string[]` in Result)
111
+
112
+ **Step 4: Implement bottom-up**
113
+
114
+ 1. Core module in `src/core/` (pure logic, no CLI concerns)
115
+ 2. Command wrapper in `src/cli/commands/` (thin delegate)
116
+ 3. Wire into `src/cli/index.ts` (with --json support)
117
+ 4. Export from `src/index.ts` (for library consumers)
118
+ 5. Build and verify: `npm run build && node dist/cli/index.js <command> --help`
119
+
120
+ **Step 5: Embed the research rationale**
121
+
122
+ When a command produces items (checklist entries, warnings, schedule sessions), include a `rationale` or `description` field that cites the research principle. This teaches the user *why*, not just *what*.
123
+
124
+ ### Step 4: Implement Core Modules
125
+
126
+ Every CLI command starts as a **core module** in `src/core/`. Core modules contain pure domain logic with no CLI concerns (no chalk, no console.log, no process.exit). This separation lets the logic be consumed as a library, tested independently, and composed by multiple commands.
127
+
128
+ ### Structure of a core module
129
+
130
+ ```typescript
131
+ // src/core/<name>.ts
132
+
133
+ /** Input options -- everything the caller needs to provide */
134
+ export interface <Name>Options {
135
+ requiredParam: string;
136
+ optionalParam?: number;
137
+ }
138
+
139
+ /** Output result -- everything the caller gets back */
140
+ export interface <Name>Result {
141
+ data: SomeType[];
142
+ warnings: string[];
143
+ }
144
+
145
+ /** Pure function: options in, result out. No side effects on stdout. */
146
+ export function <name>(options: <Name>Options): <Name>Result {
147
+ return { data: [], warnings: [] };
148
+ }
149
+ ```
150
+
151
+ ### Rules
152
+
153
+ - **Export typed interfaces** for both input and output so consumers get autocomplete and type safety
154
+ - **Return structured data**, never print to stdout -- the CLI wrapper decides how to format
155
+ - **Include a `warnings` array** in results when the function can detect non-fatal issues
156
+ - **Use `async` only when needed** (file I/O, network) -- synchronous logic stays synchronous
157
+ - **Throw typed errors** from `src/errors/types.ts` for unrecoverable failures
158
+ - **Keep modules focused** -- one concept per file. A pace calculator doesn't also validate outlines
159
+ - **Accept paths and options, not raw CLI strings** -- parsing belongs in the command wrapper
160
+
161
+ ### Shared parsers
162
+
163
+ When two or more commands need to parse the same input format, extract a shared parser module. The parser returns a structured type that both consumers work with.
164
+
165
+ ### Step 5: Implement CLI Command Wrappers
166
+
167
+ ### Command wrapper pattern
168
+
169
+ Each CLI command lives in `src/cli/commands/<name>.ts` as a thin wrapper:
170
+
171
+ ```typescript
172
+ // src/cli/commands/<name>.ts
173
+ import { doThing, type ThingOptions, type ThingResult } from '../../core/<name>.js';
174
+
175
+ export interface ThingCommandOptions extends ThingOptions {
176
+ json: boolean;
177
+ }
178
+
179
+ export async function thingCommand(
180
+ options: ThingCommandOptions,
181
+ ): Promise<ThingResult> {
182
+ return doThing({
183
+ param: options.param,
184
+ });
185
+ }
186
+ ```
187
+
188
+ **Rules for command wrappers:**
189
+ - Import from core module using `.js` extension (ESM resolution)
190
+ - Extend the core options interface with `json: boolean`
191
+ - Delegate immediately to the core function -- no business logic in the wrapper
192
+ - Return the core result type -- formatting happens in `index.ts`
193
+
194
+ ### Wiring into the CLI entry point
195
+
196
+ Add the command in `src/cli/index.ts`:
197
+
198
+ ```typescript
199
+ import { thingCommand } from './commands/<name>.js';
200
+
201
+ program
202
+ .command('<name>')
203
+ .description('One-line description of what this does')
204
+ .argument('<required>', 'Description of required positional arg') // if needed
205
+ .requiredOption('--param <value>', 'Required option description') // if needed
206
+ .option('--json', 'Output as JSON', false)
207
+ .option('--optional <value>', 'Optional flag', 'default')
208
+ .action(async (positionalArg, options) => {
209
+ try {
210
+ const result = await thingCommand({
211
+ param: positionalArg,
212
+ json: options.json,
213
+ });
214
+
215
+ if (options.json) {
216
+ console.log(JSON.stringify(result, null, 2));
217
+ } else {
218
+ // Human-readable output using chalk
219
+ console.log();
220
+ console.log(chalk.bold('Title'));
221
+ for (const item of result.data) {
222
+ console.log(` ${item}`);
223
+ }
224
+ console.log();
225
+ }
226
+ } catch (error) {
227
+ handleError(error);
228
+ }
229
+ });
230
+ ```
231
+
232
+ **Rules for CLI wiring:**
233
+ - Every command supports `--json` for structured agent consumption
234
+ - Human-readable output uses chalk for color and formatting
235
+ - Errors funnel through the shared `handleError()` function
236
+ - Use `.argument()` for required positional args, `.requiredOption()` for mandatory flags
237
+ - Parse string options to their real types (parseInt, parseFloat) in the action handler
238
+ - Comma-separated list options get `.split(',').map(s => s.trim())` in the action handler
239
+
240
+ ### Updating exports
241
+
242
+ After adding a new core module, export its public API from `src/index.ts`:
243
+
244
+ ```typescript
245
+ export { doThing } from './core/<name>.js';
246
+ export type { ThingOptions, ThingResult } from './core/<name>.js';
247
+ ```
248
+
249
+ This allows the package to be consumed as a library, not just a CLI.
250
+
251
+ ### Step 6: If Adding or Modifying Fragments
252
+
253
+ ### Designing fragments
254
+
255
+ Fragments are reusable knowledge blocks stored in `skill/fragments/<category>/`. They are included in skill sources via include markers (`\{\{include:path\}\}`) and resolved at compile time.
256
+
257
+ **When to create a fragment:**
258
+ - The knowledge applies to 2+ skills (or likely will in the future)
259
+ - The content is self-contained and makes sense without its parent skill
260
+ - Updating the knowledge in one place should propagate everywhere
261
+
262
+ **When NOT to create a fragment:**
263
+ - The content is specific to exactly one skill and unlikely to be reused
264
+ - The content requires context from the surrounding skill to make sense
265
+ - The content is a single sentence or table row (too small to justify the indirection)
266
+
267
+ ### Fragment categories
268
+
269
+ | Category | What goes here | Examples |
270
+ |----------|---------------|---------|
271
+ | `common/` | Rules and formats shared across all skills | Output format, guidelines, anti-patterns |
272
+ | `domain/` | Deep domain knowledge specific to the project's subject area | Pacing tables, narrative patterns, voice guides |
273
+ | `meta/` | Knowledge about the skill system itself | Architecture, patterns, workflows |
274
+
275
+ ### Creating a fragment
276
+
277
+ 1. **Create the file** at `skill/fragments/<category>/<name>.md`
278
+ - No YAML frontmatter -- fragments are pure content
279
+ - Write in the same imperative style as the parent skill
280
+ - Use markdown headers starting at `###` (they'll be nested inside the skill's `##` sections)
281
+
282
+ 2. **Include it in the skill source** with an include marker: `\{\{include:<category>/<name>.md\}\}`
283
+
284
+ 3. **Declare it in manifest.json** under the skill's `fragments` array -- the compiler cross-validates these declarations against actual includes and errors on mismatches
285
+
286
+ ### Fragment rules
287
+
288
+ - **One level of includes only.** Fragments cannot include other fragments. This is enforced by the compiler.
289
+ - **No frontmatter.** Fragments are content blocks, not standalone documents.
290
+ - **Match the parent skill's voice.** If the skill uses imperative mood ("Do X"), the fragment should too.
291
+ - **Fragments are inlined verbatim.** The compiler replaces include markers with the fragment content, trimming trailing whitespace. No wrapping, no indentation changes.
292
+ - **Keep fragments focused.** A fragment about pacing shouldn't also cover narrative patterns. If they're separate concepts, they're separate fragments.
293
+
294
+ ### Step 7: If Adding a New Skill
295
+
296
+ Create the skill source at `skill/skills/<name>/<name>.md` with this structure:
297
+
298
+ ```markdown
299
+ ---
300
+ name: <skill-name>
301
+ description: "One sentence explaining what this skill does and when to invoke it."
302
+ ---
303
+
304
+ # Skill Title
305
+
306
+ Brief description of what this skill produces.
307
+
308
+ ---
309
+
310
+ ## Section Name
311
+
312
+ \{\{include:<category>/<fragment>.md\}\}
313
+
314
+ ---
315
+
316
+ ## Another Section
317
+
318
+ Direct content or more includes.
319
+ ```
320
+
321
+ Then register it:
322
+
323
+ 1. Add the skill entry to `skill/build/manifest.json` with its source path and fragment dependencies
324
+ 2. Add the skill name to the `SKILLS` array in `install-local.sh`
325
+ 3. Compile: `npm run compile`
326
+
327
+ ### Step 8: If Renaming the Project
328
+
329
+ ### Renaming a skill project
330
+
331
+ When the project, skill, or CLI needs a new name, update all touchpoints in one pass to avoid stale references. The rename affects three identity layers:
332
+
333
+ | Layer | Old example | New example |
334
+ |-------|-------------|-------------|
335
+ | npm package name | `presentation-creator` | `tech-demo-director` |
336
+ | CLI binary name | `presentation-util` | `demo-director` |
337
+ | Skill name + managed marker | `presentation-creator` | `tech-demo-director` |
338
+
339
+ ### Rename checklist (in order)
340
+
341
+ 1. **Skill source directory and file**
342
+ ```bash
343
+ mv skill/skills/<old>/ skill/skills/<new>/
344
+ mv skill/skills/<new>/<old>.md skill/skills/<new>/<new>.md
345
+ ```
346
+
347
+ 2. **Skill source frontmatter** -- update `name:` and H1 title in the renamed .md
348
+
349
+ 3. **Manifest** (`skill/build/manifest.json`) -- rename the skill key and `source` path
350
+
351
+ 4. **Compiler marker** (`skill/build/compile.mjs`) -- update the `MANAGED_BY` constant
352
+
353
+ 5. **Installer** (`install-local.sh`) -- update `PROJECT_NAME`, `CLI_BIN_NAME`, `MANAGED_MARKER`, `SKILLS` array
354
+
355
+ 6. **Package metadata** (`package.json`) -- update `name` and `bin` key
356
+
357
+ 7. **CLI metadata** (`src/cli/index.ts`) -- update `.name()` and `.description()` calls
358
+
359
+ 8. **README** -- update title, CLI references, project layout example
360
+
361
+ 9. **Any docs** referencing the old name (translation-map, lessons-learned, etc.)
362
+
363
+ 10. **Regenerate everything:**
364
+ ```bash
365
+ rm -rf compiled
366
+ npm install # regenerates package-lock.json
367
+ npm run build # rebuilds TypeScript CLI
368
+ npm run compile # regenerates compiled/ under new paths
369
+ ```
370
+
371
+ ### Verification
372
+
373
+ After renaming, run this sweep to confirm no stale references remain:
374
+
375
+ ```bash
376
+ grep -r "<old-name>" --include="*.md" --include="*.json" --include="*.mjs" --include="*.ts" --include="*.sh" .
377
+ ```
378
+
379
+ The grep should return zero results (excluding node_modules and dist).
380
+
381
+ ### Step 9: Build, Compile, and Verify
382
+
383
+ After any change, run the full verification sequence:
384
+
385
+ ```bash
386
+ npm run build # TypeScript CLI compiles cleanly
387
+ npm run compile # Skills compile to all 7 IDE targets
388
+ npm run compile:validate # Cross-validates manifest vs source includes
389
+ npx --yes agentic-skill-mill@latest --help # CLI command surface works via npx
390
+ ```
391
+
392
+ If adding a new CLI command, also verify it runs:
393
+
394
+ ```bash
395
+ npx --yes agentic-skill-mill@latest <command> --help # Options are correct
396
+ npx --yes agentic-skill-mill@latest <command> <args> # Human output works
397
+ npx --yes agentic-skill-mill@latest <command> --json # JSON output works
398
+ ```
399
+
400
+ ### Step 10: Commit
401
+
402
+ Use conventional commit format with a detailed body:
403
+
404
+ - `feat:` for new commands, skills, or fragments
405
+ - `refactor:` for renames or restructuring
406
+ - `fix:` for bug fixes
407
+
408
+ The commit body should list every file category changed (core modules, CLI wrappers, fragments, manifest, etc.) and what was done in each.
409
+
410
+ ---
411
+
412
+ ## Anti-Patterns
413
+
414
+ - **Business logic in CLI wrappers.** Command wrappers delegate; they don't compute.
415
+ - **Console output in core modules.** Core modules return data; they don't print.
416
+ - **Fragments that include fragments.** Only one level of includes is supported.
417
+ - **Undeclared fragments.** Every include marker in a skill source must be declared in manifest.json. The compiler errors on mismatches.
418
+ - **Stale compiled outputs.** Always recompile after changing skills or fragments. Run `npm run compile:validate` to detect staleness.
419
+ - **Partial renames.** When renaming, update every touchpoint in one pass (see rename workflow). A grep sweep with zero results confirms completeness.
420
+ - **Missing --json support.** Every CLI command must support `--json` for structured agent consumption. Agents cannot parse chalk-colored terminal output.
421
+ - **Bare `return` in `set -e` scripts.** In `install-local.sh`, never write `[[ condition ]] || return` or `grep ... || return`. Bare `return` inherits the exit code of the failed test (1), which `set -e` treats as fatal -- killing the script silently. Always use `return 0` for early-exit guards: `[[ -d "$dir" ]] || return 0`, `[[ -z "$var" ]] && return 0`.