get-tbd 0.2.0 → 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.
Files changed (37) hide show
  1. package/dist/bin.mjs +551 -168
  2. package/dist/bin.mjs.map +1 -1
  3. package/dist/cli.mjs +492 -159
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/docs/SKILL.md +2 -2
  6. package/dist/docs/guidelines/bun-monorepo-patterns.md +65 -66
  7. package/dist/docs/guidelines/cli-agent-skill-patterns.md +396 -158
  8. package/dist/docs/guidelines/common-doc-guidelines.md +2 -2
  9. package/dist/docs/guidelines/convex-limits-best-practices.md +39 -39
  10. package/dist/docs/guidelines/convex-rules.md +13 -13
  11. package/dist/docs/guidelines/electron-app-development-patterns.md +18 -18
  12. package/dist/docs/guidelines/general-comment-rules.md +1 -1
  13. package/dist/docs/guidelines/general-tdd-guidelines.md +4 -4
  14. package/dist/docs/guidelines/golden-testing-guidelines.md +9 -9
  15. package/dist/docs/guidelines/pnpm-monorepo-patterns.md +49 -49
  16. package/dist/docs/guidelines/python-cli-patterns.md +1 -1
  17. package/dist/docs/guidelines/python-modern-guidelines.md +4 -4
  18. package/dist/docs/guidelines/release-notes-guidelines.md +18 -2
  19. package/dist/docs/guidelines/supply-chain-hardening.md +84 -29
  20. package/dist/docs/guidelines/tbd-sync-troubleshooting.md +3 -3
  21. package/dist/docs/guidelines/typescript-cli-tool-rules.md +17 -17
  22. package/dist/docs/guidelines/typescript-code-coverage.md +5 -5
  23. package/dist/docs/guidelines/typescript-rules.md +3 -3
  24. package/dist/docs/guidelines/typescript-yaml-handling-rules.md +3 -3
  25. package/dist/docs/shortcuts/system/skill-baseline.md +2 -2
  26. package/dist/docs/tbd-design.md +40 -40
  27. package/dist/docs/tbd-docs.md +1 -1
  28. package/dist/docs/tbd-prime.md +3 -3
  29. package/dist/{id-mapping-CtfTfGIh.mjs → id-mapping-687_UEsy.mjs} +66 -16
  30. package/dist/id-mapping-687_UEsy.mjs.map +1 -0
  31. package/dist/{id-mapping-CFoPVinz.mjs → id-mapping-mtoSP9Qt.mjs} +1 -1
  32. package/dist/index.mjs +1 -1
  33. package/dist/{src-rIE4xSVs.mjs → src-BpvcrLnq.mjs} +2 -2
  34. package/dist/{src-rIE4xSVs.mjs.map → src-BpvcrLnq.mjs.map} +1 -1
  35. package/dist/tbd +551 -168
  36. package/package.json +1 -1
  37. package/dist/id-mapping-CtfTfGIh.mjs.map +0 -1
@@ -1,23 +1,25 @@
1
1
  ---
2
- title: Agent Skills & CLI Integration Patterns
3
- description: How to write skills and agent-integrated CLIs that work across Claude Code, Codex, and the broader coding-agent ecosystem a simple baseline plus references for advanced, multi-subcommand tools
2
+ title: Agent Skills and CLI Integration Patterns
3
+ description: How to write skills and agent-integrated CLIs that work across Claude Code, Codex, and the broader coding-agent ecosystem—a simple baseline plus references for advanced, multi-subcommand tools
4
4
  author: Joshua Levy (github.com/jlevy) with LLM assistance
5
5
  ---
6
- # Agent Skills & CLI Integration Patterns
6
+ # Agent Skills and CLI Integration Patterns
7
7
 
8
- **Last Updated**: 2026-05-23 (research verified against primary sources May 2026)
8
+ **Last Updated**: 2026-05-31 (research verified against primary sources May 2026; added
9
+ the L0–L3 integration ladder and §6.6.2 project-vs-global scope mechanics, informed by
10
+ `qmd`)
9
11
 
10
12
  This guideline covers how to package a capability so AI coding agents can discover and
11
- use it well from a single-file skill up to a full CLI with many subcommands exposed as
12
- a skill. It is deliberately **not dogmatic**: most needs are met by a tiny `SKILL.md`,
13
- and the heavier patterns are opt-in for tools that genuinely need them.
13
+ use it well—from a single-file skill up to a full CLI with many subcommands exposed as a
14
+ skill. It is deliberately **not dogmatic**: most needs are met by a tiny `SKILL.md`, and
15
+ the heavier patterns are opt-in for tools that genuinely need them.
14
16
 
15
17
  The patterns draw on the current (May 2026) state of the ecosystem and on `tbd`’s own
16
18
  implementation, which serves as a reference for the advanced “CLI-as-skill” approach.
17
19
 
18
20
  **When to use this guideline**: when building or packaging anything an AI coding agent
19
- should use a prompt-only skill, a CLI tool, an MCP server, or a multi-agent
20
- integration and you want it to work across Claude Code, Codex, Cursor, Gemini CLI, and
21
+ should use—a prompt-only skill, a CLI tool, an MCP server, or a multi-agent
22
+ integration—and you want it to work across Claude Code, Codex, Cursor, Gemini CLI, and
21
23
  others without rewriting it per agent.
22
24
 
23
25
  > **The single most important shift since 2025**: skills and project instructions are
@@ -29,7 +31,7 @@ others without rewriting it per agent.
29
31
 
30
32
  * * *
31
33
 
32
- ## 0. Start Here The Simple Baseline
34
+ ## 0. Start Here—The Simple Baseline
33
35
 
34
36
  Read this section first.
35
37
  For the large majority of cases, you are done after it.
@@ -55,17 +57,17 @@ description: >-
55
57
  Step-by-step instructions the agent should follow...
56
58
  ```
57
59
 
58
- That is the entire artifact no build step, no runtime, no dependencies.
60
+ That is the entire artifact—no build step, no runtime, no dependencies.
59
61
  This is the **Agent Skills open standard** ([agentskills.io](https://agentskills.io)),
60
62
  and the same folder works in Claude Code, Codex CLI, Gemini CLI, GitHub Copilot, Cursor,
61
63
  Windsurf, Cline, pi, and 20+ other tools.
62
64
  Garry Tan’s **gstack** (~97K stars) is 23 skills, each a plain `SKILL.md` and nothing
63
- more proof the baseline scales without custom tooling.
65
+ more—proof the baseline scales without custom tooling.
64
66
 
65
67
  **The only two things that matter for a basic skill:**
66
68
 
67
69
  1. A **`description`** that says *what it does* AND *when to use it* (this drives
68
- activation see §4.2).
70
+ activation—see §4.2).
69
71
  2. A **body under ~500 lines** of clear, imperative instructions.
70
72
 
71
73
  **Install it** by copying into a known directory, or with the cross-agent package
@@ -81,7 +83,7 @@ npx skills add owner/repo # Vercel's skills.sh ecosystem (symlinks, 27+ ag
81
83
 
82
84
  The `SKILL.md` folder is the portable **authoring** format; some agents add their own
83
85
  discovery paths (Codex/pi also read `.agents/skills/`) and their own **distribution**
84
- layers on top (Claude Code plugins, Codex plugins) see §5.
86
+ layers on top (Claude Code plugins, Codex plugins)—see §5.
85
87
 
86
88
  ### 0.2 If your capability is a CLI
87
89
 
@@ -94,11 +96,20 @@ So:
94
96
  2. Ship a **`SKILL.md`** (or an `AGENTS.md` snippet) that tells the agent the tool
95
97
  exists, what it’s for, and the handful of commands to run.
96
98
  Reference the CLI via a **pinned zero-install runner** (`npx`/`uvx <pkg>@<version>`)
97
- so it works even in ephemeral/cloud environments global install vs.
99
+ so it works even in ephemeral/cloud environments—global install vs.
98
100
  zero-install is its own design dimension (§6.7).
99
101
  3. That’s the baseline.
100
102
  Stop here unless you have many subcommands or need cross-session state, structured
101
- auth, or background services then see §6 (CLI-as-skill) and §7 (MCP).
103
+ auth, or background services—then see §6 (CLI-as-skill) and §7 (MCP).
104
+
105
+ > **The skill points; the CLI documents.** A CLI’s `--help` (and per-command
106
+ > `mycli <cmd> --help`) is the source of truth for flags, arguments, and exact command
107
+ > sequences. The skill’s job is to name each capability and the command that reaches it,
108
+ > then let the agent open the CLI’s own help for the details.
109
+ > A skill carries the focused context an agent needs to judge that the tool is relevant;
110
+ > copying its help text, flag tables, and command recipes wholesale is the most common
111
+ > way a CLI-backed skill goes wrong.
112
+ > See §3.1 for why and §6.5 for how to avoid it.
102
113
 
103
114
  ### 0.3 The one-paragraph decision guide
104
115
 
@@ -111,16 +122,17 @@ So:
111
122
  (§7)
112
123
  - **Maximum reach across many agents** → layer them: AGENTS.md, SKILL.md, CLI, and MCP.
113
124
  (§1)
114
- - **Self-installs into agents & ships evolving skills?** that is the advanced Tier 2
115
- pattern (self-upgrade and format versioning); most tools are Tier 1: a pure skill run
116
- via a **pinned** `npx`/`uvx`. (§6.0)
125
+ - **Self-installs into agents?** climb the integration ladder (§6.0): L0 pure skill
126
+ L1 skill + pinned `npx`/`uvx` L2 self-install into skill dirs only (`qmd`) → L3 full
127
+ platform with managed `AGENTS.md`, hooks, and format versioning (`tbd`). Most tools
128
+ are L1; stop as low as you can.
117
129
 
118
130
  Everything below is reference material.
119
131
  You do not need most of it for most tools.
120
132
 
121
133
  * * *
122
134
 
123
- ## 1. The Layered Model — “Write Once, Integrate Many”
135
+ ## 1. The Layered Model—“Write Once, Integrate Many”
124
136
 
125
137
  There is no single integration surface that every agent uses, but the surfaces compose
126
138
  cleanly.
@@ -142,19 +154,19 @@ Add agent-specific files last, and only where they buy something.
142
154
 
143
155
  * * *
144
156
 
145
- ## 2. AGENTS.md The Universal Project Baseline
157
+ ## 2. AGENTS.md—The Universal Project Baseline
146
158
 
147
159
  `AGENTS.md` is a plain-Markdown file at the repo root that tells any agent how your
148
160
  project works: build commands, test commands, conventions, gotchas.
149
- It is **not** capability-specific think of it as the README written for agents.
161
+ It is **not** capability-specific—think of it as the README written for agents.
150
162
 
151
- **Governance & reach**: Originated by OpenAI (Aug 2025); since Dec 2025 stewarded by the
152
- **Agentic AI Foundation under the Linux Foundation** (co-founded by OpenAI, Anthropic,
153
- and Block; ~180 member orgs).
163
+ **Governance and reach**: Originated by OpenAI (Aug 2025); since Dec 2025 stewarded by
164
+ the **Agentic AI Foundation under the Linux Foundation** (co-founded by OpenAI,
165
+ Anthropic, and Block; ~180 member orgs).
154
166
  Used by **60,000+** open-source projects.
155
167
  Canonical spec: [agents.md](https://agents.md).
156
168
 
157
- **Discovery & precedence** vary by agent know your targets:
169
+ **Discovery and precedence** vary by agent—know your targets:
158
170
 
159
171
  - **Codex**: reads global `~/.codex/AGENTS.md` (or `AGENTS.override.md`), then walks
160
172
  from repo root down to the working directory, concatenating one file per directory
@@ -196,8 +208,8 @@ generated content without touching user-authored text:
196
208
  <!-- END MYCLI INTEGRATION -->
197
209
  ```
198
210
 
199
- Keep the begin/end marker *names* stable (`<!-- BEGIN MYCLI INTEGRATION`) match on
200
- that prefix so detection finds both legacy blocks (no `format=`, treated as `f01`) and
211
+ Keep the begin/end marker *names* stable (`<!-- BEGIN MYCLI INTEGRATION`)—match on that
212
+ prefix so detection finds both legacy blocks (no `format=`, treated as `f01`) and
201
213
  current ones. Only the `format=fNN` value changes when the block’s shape changes.
202
214
 
203
215
  * * *
@@ -228,9 +240,20 @@ Skills are loaded in three levels so they cost almost nothing until used:
228
240
  **Constraints that matter**: keep the body **under 500 lines**; keep reference files
229
241
  **one level deep** from `SKILL.md` (avoid `SKILL.md → a.md → b.md` chains); put bulky
230
242
  material (schemas, examples, scripts) in supporting files.
231
- Scripts execute *outside* the context window only their output costs tokens, which is
243
+ Scripts execute *outside* the context window—only their output costs tokens, which is
232
244
  why bundling a script can be far cheaper than inlining instructions.
233
245
 
246
+ **For a CLI-backed skill, the CLI itself is the Level-3 layer.** Treat `mycli --help`,
247
+ `mycli <command> --help`, and the tool’s informational subcommands (§6.1) as the
248
+ on-demand disclosure tier, the role supporting files play for a prompt-only skill.
249
+ The body (Level 2) should route to them, not transcribe them.
250
+ Inlining a command’s flags, arguments, or step-by-step usage pulls Level-3 detail up
251
+ into Level 2, so it loads on every activation and goes stale whenever the CLI changes.
252
+ The body names the capability and the command; the agent runs that command’s `--help` or
253
+ `--list` when it needs the mechanics.
254
+ This is progressive disclosure applied to a CLI: the tool documents itself, and the
255
+ skill stays a thin pointer to it.
256
+
234
257
  ### 3.2 Bundled scripts and resources
235
258
 
236
259
  A skill folder can ship executable helpers:
@@ -279,12 +302,12 @@ specifically.
279
302
 
280
303
  ### 4.2 Description optimization (this is what makes skills activate)
281
304
 
282
- Activation is **pure LLM reasoning** — the model reads every installed skill’s `name` +
305
+ Activation is **pure LLM reasoning**—the model reads every installed skill’s `name` +
283
306
  `description` and decides what to invoke.
284
307
  There is no keyword matcher or embedding step.
285
308
  So the description is the single highest-leverage thing you write.
286
309
 
287
- **The two-part rule** — every description answers:
310
+ **The two-part rule**—every description answers:
288
311
 
289
312
  1. **What does it do?** (capabilities)
290
313
  2. **When should it be used?** (explicit triggers, in the user’s words)
@@ -304,13 +327,13 @@ description: >-
304
327
  the most important trigger keywords in the first ~50 characters (descriptions can be
305
328
  truncated in large collections); state both capability and trigger.
306
329
 
307
- **Activation reliability** (community 650-trial sandboxed eval directional, not
330
+ **Activation reliability** (community 650-trial sandboxed eval—directional, not
308
331
  official): vague descriptions ~20% → optimized “Use when…” descriptions ~50% → adding
309
332
  concrete examples ~72–90%. Two distinct failure modes to design against: *activation
310
- failure* (never invoked) and *execution failure* (invoked but steps skipped fix with
333
+ failure* (never invoked) and *execution failure* (invoked but steps skipped—fix with
311
334
  clearer, checklist-style instructions).
312
335
 
313
- ### 4.3 The description budget (changed in 2026 verify against your target)
336
+ ### 4.3 The description budget (changed in 2026—verify against your target)
314
337
 
315
338
  Earlier guidance cited a flat ~15K-character budget.
316
339
  **Claude Code’s current model is different**:
@@ -325,7 +348,7 @@ Earlier guidance cited a flat ~15K-character budget.
325
348
  `off` without editing the file; `/doctor` reports overflow.
326
349
 
327
350
  **Implication for tools that install many skills**: don’t. Use the **meta-skill
328
- pattern** (§6.2) one skill that exposes N resources via CLI subcommands consumes a
351
+ pattern** (§6.2)—one skill that exposes N resources via CLI subcommands consumes a
329
352
  single listing slot instead of N. This is the strongest architectural reason to prefer
330
353
  CLI-as-skill once you have more than a handful of capabilities.
331
354
 
@@ -334,9 +357,9 @@ CLI-as-skill once you have more than a handful of capabilities.
334
357
  Because activation is probabilistic (§4.2) and the body is executable influence, test
335
358
  it:
336
359
 
337
- - **Positive activation**: a few realistic prompts that *should* trigger the skill
338
- does the agent invoke it?
339
- - **Negative activation**: nearby prompts that should *not* trigger it no false fires?
360
+ - **Positive activation**: a few realistic prompts that *should* trigger the skill—does
361
+ the agent invoke it?
362
+ - **Negative activation**: nearby prompts that should *not* trigger it—no false fires?
340
363
  - **Explicit invocation**: `/skill-name` (or the agent equivalent) loads and runs
341
364
  cleanly.
342
365
  - **Sandbox / write-denial**: the skill (and any bundled script) degrades gracefully
@@ -382,12 +405,12 @@ you care about.
382
405
  | **Goose** (Block) | `AGENTS.md` | Recipes; 70+ MCP extensions | Yes (deepest) | extension lifecycle | MCP (primary) |
383
406
  | **Zed** | `.rules` (reads `.cursorrules`, `CLAUDE.md`) | Rules Library | Yes (extensions) | — | MCP extension + `.rules` |
384
407
  | **Factory** | `AGENTS.md` + `.factory/droids/*.md` | Custom Droids (sub-agents) | Yes | Delegator loop | AGENTS.md + droid file |
385
- | **pi** | `AGENTS.md` / `CLAUDE.md`, `.pi/SYSTEM.md` | Agent Skills (`.pi/skills/`, `.agents/skills/`); TS extensions | **No (by design)** — use CLI+README or an extension | extension hooks | SKILL.md + CLI; extension for deep tool registration |
408
+ | **pi** | `AGENTS.md` / `CLAUDE.md`, `.pi/SYSTEM.md` | Agent Skills (`.pi/skills/`, `.agents/skills/`); TS extensions | **No (by design)**—use CLI+README or an extension | extension hooks | SKILL.md + CLI; extension for deep tool registration |
386
409
 
387
410
  **Notes on the minimal end (pi)**: pi (Mario Zechner’s `@mariozechner/pi-coding-agent`,
388
411
  ~44K stars) ships four tools (read/write/edit/bash) and treats context as a scarce
389
412
  budget. It reads `AGENTS.md`/`CLAUDE.md`, supports the Agent Skills standard, and
390
- **deliberately omits MCP** — its docs tell authors to “build CLI tools with READMEs” or
413
+ **deliberately omits MCP**—its docs tell authors to “build CLI tools with READMEs” or
391
414
  write a TypeScript extension (`pi.registerTool()` / `pi.registerCommand()`). This is a
392
415
  clean endorsement of the CLI-as-skill approach: a self-documenting CLI plus a `SKILL.md`
393
416
  is exactly what a minimal agent wants.
@@ -395,23 +418,23 @@ is exactly what a minimal agent wants.
395
418
  **Codex specifics** (it gained a real skill system in 2026): skills are `SKILL.md`
396
419
  folders with the same progressive disclosure.
397
420
  Verified against the Codex source (`codex-rs/core-skills/src/loader.rs`, tags
398
- `rust-v0.130.0`…`v0.133.0`): the loader scans several **scopes** — `Repo` (every
421
+ `rust-v0.130.0`…`v0.133.0`): the loader scans several **scopes**—`Repo` (every
399
422
  `<dir>/.agents/skills/` from the project root down to cwd), `User`
400
423
  (`$HOME/.agents/skills/`), `Admin`, plus plugin roots and `$CODEX_HOME/skills`. So a
401
424
  **plain repo-root `.agents/skills/<name>/SKILL.md` is read directly**, no manifest
402
425
  required. (The repo path is built by joining `.agents` and `skills` at runtime, so it
403
- does *not* appear as a contiguous `.agents/skills` literal in the binary a
426
+ does *not* appear as a contiguous `.agents/skills` literal in the binary—a
404
427
  `strings`-based inspection will miss it and see only `.agents/plugins/marketplace.json`;
405
428
  confirm against the source, not binary strings.)
406
429
  **Plugins** are an *additional* distribution layer (installable units bundling skills
407
- and MCP servers 90+ ship with Codex), declared in `.agents/plugins/marketplace.json`
408
- (also reads `.claude-plugin/marketplace.json`) useful for *publishing a bundle*, but
409
- not needed to make a repo-local skill load.
430
+ and MCP servers—90+ ship with Codex), declared in `.agents/plugins/marketplace.json`
431
+ (also reads `.claude-plugin/marketplace.json`)—useful for *publishing a bundle*, but not
432
+ needed to make a repo-local skill load.
410
433
  Codex skills may carry a richer **`agents/openai.yaml`** companion (e.g.
411
434
  `interface.display_name`, icons, `dependencies.tools[]`,
412
435
  `policy.allow_implicit_invocation`); map the portable
413
436
  `name`/`description`/`allowed-tools` onto it only when you specifically want that Codex
414
- polish it’s optional.
437
+ polish—it’s optional.
415
438
  An experimental, off-by-default **`external_migration`** feature can import `.claude/`
416
439
  config (hooks/MCP/skills) into `.codex/`; don’t depend on it yet, but expect the
417
440
  portable duplication to shrink if it stabilizes.
@@ -419,14 +442,14 @@ Operational config lives in `~/.codex/config.toml` (or trusted per-project
419
442
  `.codex/config.toml`): `model`, `approval_policy`
420
443
  (`untrusted`/`on-request`/`granular`/`never`), `sandbox_mode`
421
444
  (`read-only`/`workspace-write`/`danger-full-access`), and `[mcp_servers.*]`. A CLI your
422
- tool ships will run **inside Codex’s sandbox** — under `workspace-write`, writes are
445
+ tool ships will run **inside Codex’s sandbox**—under `workspace-write`, writes are
423
446
  limited to workspace roots and network is off unless explicitly enabled.
424
447
  Design your CLI to work read-only where possible and to fail with a clear message when
425
448
  sandboxed.
426
449
 
427
450
  * * *
428
451
 
429
- ## 6. CLI-as-Skill (Advanced) One Tool, Many Self-Injecting Commands
452
+ ## 6. CLI-as-Skill (Advanced)—One Tool, Many Self-Injecting Commands
430
453
 
431
454
  This is the pattern for a richer tool: a CLI that is itself a skill, exposing many
432
455
  capabilities as subcommands while costing a single description slot.
@@ -435,37 +458,58 @@ follows the same shape (subcommands, `AGENTS.md`, `--json`, and an optional MCP
435
458
 
436
459
  Use this when you have many capabilities, need cross-session state, or want a curated
437
460
  knowledge library the agent pulls from.
438
- For a single capability, the §0 baseline is better don’t reach for this prematurely.
461
+ For a single capability, the §0 baseline is better—don’t reach for this prematurely.
439
462
 
440
- ### 6.0 Two integration tiers pick the lighter one
463
+ ### 6.0 The integration ladder—pick the lowest rung that works
441
464
 
442
465
  Most tools should **not** self-install.
443
- Decide which tier you are before adding any setup machinery:
444
-
445
- - **Tier 1 — pure skill (the default for most tools).** Ship a `SKILL.md` (optionally an
446
- `AGENTS.md` snippet); users install it once (commit to `.agents/skills/`,
447
- `npx skills add`, or the Claude mirror).
448
- Invoke the tool through a **version-pinned** zero-install runner —
449
- `npx --yes pkg@<ver>`, `uvx --from pkg@<ver>`, or `pipx run pkg==<ver>` (§6.7). No
450
- hooks, no managed `AGENTS.md` block, no `setup` command, no format versioning.
466
+ Distribution complexity is a ladder, not a switch: each rung adds machinery (and
467
+ maintenance) over the one below, so climb only as far as the tool genuinely needs.
468
+ Four rungs, lightest first:
469
+
470
+ - **L0—pure prompt skill.** A `SKILL.md` and nothing else: no binary, no runtime, no
471
+ install command. The agent follows the body directly.
472
+ Garry Tan’s **gstack** (23 plain skills) is L0. Install by committing to a discovery
473
+ dir or `npx skills add`.
474
+ - **L1—skill + delegated CLI (zero-install).** Ship a `SKILL.md` that points at a CLI
475
+ invoked through a **version-pinned** zero-install runner—`npx --yes pkg@<ver>`,
476
+ `uvx --from pkg@<ver>`, or `pipx run pkg==<ver>` (§6.7). No install command, no
477
+ managed `AGENTS.md` block, no hooks, no format versioning.
478
+ The skill *delegates* execution to a package it never installs itself.
479
+ This is the default for most CLI-backed capabilities.
451
480
  Pinning the version here does **double duty**:
452
- - **Supply-chain control** — an unpinned runner (`npx pkg`, `uvx --from pkg`) silently
481
+ - **Supply-chain control**—an unpinned runner (`npx pkg`, `uvx --from pkg`) silently
453
482
  re-resolves to the latest published version on every run and bypasses any cool-off
454
483
  window. A pinned version is the artifact you actually vetted.
455
- - **Consistency control** — every teammate and every agent runs the *same* tool
456
- version, so skill behavior is reproducible across a team and across agents rather
457
- than drifting as upstream publishes new releases.
458
- - **Tier 2 self-installing CLI (advanced; the rest of §6).** A tool that writes its
459
- own integration files into multiple agents (`.agents/skills/`, `.claude/skills/`, a
460
- managed `AGENTS.md` block, hooks, `.codex/` config) **and** whose skill content
461
- evolves across releases.
462
- Take on this complexity only for a tool with many capabilities, cross-session state,
463
- or a curated knowledge library.
464
- The self-upgrade and format-versioning rules in §6.6 apply **only to this tier** — a
465
- pure skill never needs them.
466
-
467
- If in doubt, you are Tier 1. `tbd` is a Tier-2 reference implementation; most CLIs are
468
- not.
484
+ - **Consistency control**—every teammate and every agent runs the *same* tool version,
485
+ so skill behavior is reproducible across a team and across agents rather than
486
+ drifting as upstream publishes new releases.
487
+ - **L2—self-installing skill, discovery-dirs only.** The tool ships an `install` command
488
+ (with `--project`/`--global` scope—§6.6.2) that writes its `SKILL.md` into the
489
+ skill-discovery directories (`.agents/skills/<tool>/`, the `.claude/skills/` mirror)
490
+ and **stops there**: no managed `AGENTS.md` block, no hooks, no `prime`/`setup`
491
+ context machinery. Because it never touches a human-authored project-instruction file
492
+ and always full-overwrites its own generated skill, it does **not** need the §6.6
493
+ format-version / migration apparatus—a re-install is just a clean overwrite.
494
+ **`qmd`** (Tobi Lütke’s Markdown search tool) is the reference: `qmd skill install` /
495
+ `--global`, an embedded skill with a build-time drift test, a
496
+ `.claude-plugin/marketplace.json`, and an MCP server—all without writing to
497
+ `AGENTS.md` at all.
498
+ - **L3—full self-installing CLI platform.** Everything in L2 **plus** a managed
499
+ `AGENTS.md` block, lifecycle hooks (`SessionStart`/`PreCompact`), `prime` and `setup`
500
+ commands, format-versioned migration with a forward-compatibility guard (§6.6), and
501
+ usually a knowledge-injection meta-skill (§6.2) backed by a path-ordered DocCache
502
+ (§6.3). Take this on only for a tool with many capabilities, cross-session state, or a
503
+ curated knowledge library.
504
+ **`tbd`** is the reference implementation; **Beads/`bd`** follows the same shape.
505
+ Such platforms are typically **project-only and version-pinned per repo** (§6.6.2):
506
+ the tool is part of the project’s reproducible toolchain, so global scope is usually
507
+ not worth offering. `qmd` (L2) offers global/dual scope precisely because it is a
508
+ general-purpose utility that carries no per-project config.
509
+
510
+ The self-upgrade and format-versioning rules in §6.6 apply **only to L3**—L0–L2 never
511
+ need them. If in doubt, you are L1: `tbd` is an L3 reference implementation, `qmd` an L2
512
+ one, and most CLIs are neither.
469
513
 
470
514
  ### 6.1 Two kinds of commands
471
515
 
@@ -474,7 +518,7 @@ not.
474
518
  | **Action commands** | Perform operations | `create`, `close`, `sync` |
475
519
  | **Informational commands** | Output guidance for the agent to *follow* | `guidelines <name>`, `shortcut <name>`, `template <name>` |
476
520
 
477
- Informational commands don’t *do* anything they print instructions, best practices, or
521
+ Informational commands don’t *do* anything—they print instructions, best practices, or
478
522
  templates the agent reads and acts on.
479
523
  This is the mechanism behind tbd’s **knowledge-injection-via-subcommands**: rather than
480
524
  installing dozens of skills, tbd installs *one* meta-skill and exposes its entire
@@ -513,8 +557,8 @@ post-compaction contexts).
513
557
 
514
558
  ### 6.3 Resource directories: show the full command
515
559
 
516
- When listing resources, print the command to run, not just a name it removes a step
517
- for the agent.
560
+ When listing resources, print the command to run, not just a name—it removes a step for
561
+ the agent.
518
562
 
519
563
  ```markdown
520
564
  ## Available Shortcuts
@@ -543,7 +587,7 @@ Rules: reference commands **explicitly** (`mycli command arg`, never “see the
543
587
 
544
588
  ### 6.5 Making the CLI agent-friendly
545
589
 
546
- - **`--json` on every command** — one output path that renders human or machine output.
590
+ - **`--json` on every command**—one output path that renders human or machine output.
547
591
  - **`--brief`/`--quiet`** for constrained contexts and scripts.
548
592
  - **Idempotent `setup --auto`** (non-interactive) vs.
549
593
  `setup --interactive` for humans; never let an agent get stuck on a prompt.
@@ -552,14 +596,45 @@ Rules: reference commands **explicitly** (`mycli command arg`, never “see the
552
596
  (e.g., `mycli prime`), and a “Getting Started” one-liner.
553
597
  - **A `prime` command** (dashboard, status, and rules) for session start and
554
598
  post-compact, distinct from `skill` (pure documentation).
599
+ `prime` is **read-only**: it restores context but does not rewrite project files.
600
+ Because a `SessionStart` hook runs it on every session (§8), have `prime` print a
601
+ short reminder that the agent or user can run `setup` to refresh skills and settings
602
+ (for example after upgrading the tool).
603
+ That keeps the refresh **opt-in** rather than silently mutating the repo from a hook,
604
+ while still nudging stale installs forward.
605
+
606
+ **Route, don’t restate: the skill is a thin pointer, not a copy of `--help`.** The most
607
+ common failure when packaging a CLI as a skill is over-documentation, where the author
608
+ (often an LLM, eagerly) copies the CLI’s help, flag lists, and command recipes wholesale
609
+ into the skill body.
610
+ Don’t. A self-documenting CLI already carries that detail in `mycli --help`,
611
+ `mycli <command> --help`, and its informational subcommands (§6.1), so duplicating it
612
+ only adds cost and drift (§3.1). The skill is a **knowledge, awareness, and routing
613
+ layer**: it carries the focused context an agent needs to judge that the tool is
614
+ relevant, names each key use case once, and gives the one command that reaches it, then
615
+ trusts the agent to run that command (or its `--help`) for the specifics.
616
+
617
+ | In the skill body (awareness and routing) | In the CLI’s own help (mechanics) |
618
+ | --- | --- |
619
+ | Each key capability or use case, named once | The full flag and argument reference |
620
+ | The single command that reaches it (`mycli create`, `mycli guidelines <name>`) | Exact option syntax, defaults, and edge cases |
621
+ | When to use the tool, and which command for which intent | Step-by-step recipes for a specific command |
622
+ | Pointers: `mycli --help`, `mycli <cmd> --help`, `mycli <cmd> --list` | Examples and output formats |
623
+
624
+ A quick test: if a line in the skill would become *wrong* when you add a flag or change
625
+ behavior in the CLI, it belongs in the CLI’s help, not the skill.
626
+ Mention every key use case, but push the “how exactly” (the sequence of commands and
627
+ their options) down into the tool.
628
+ Adequate beats exhaustive: a short skill that reliably routes the agent to the right
629
+ command beats a long one that mirrors the manual.
555
630
 
556
- ### 6.6 Distribution & multi-agent install
631
+ ### 6.6 Distribution and multi-agent install
557
632
 
558
633
  A CLI can install itself into multiple agents from one `setup` run.
559
634
  Use the portable Agent Skills location as the primary project skill surface and mirror
560
635
  only where a target agent requires it:
561
636
 
562
- - `.agents/skills/<tool>/SKILL.md` — the portable project skill.
637
+ - `.agents/skills/<tool>/SKILL.md`—the portable project skill.
563
638
  **Be precise about who reads this path natively vs.
564
639
  who reaches it via an installer**, rather than claiming a flat “all agents read it”:
565
640
  - **Scans repo-root `.agents/skills/` natively** (verified): **Codex** (source above)
@@ -568,17 +643,17 @@ only where a target agent requires it:
568
643
  - **Reached via the cross-agent installer**: `npx skills add` copies the same
569
644
  `SKILL.md` into `.agents/skills/` and **symlinks it into each agent’s own dir**
570
645
  (Cursor, Copilot, Cline, Amp, Windsurf, …). For those agents the *installer*, not
571
- the agent, is what binds `.agents/skills/` to their native location so “works with
646
+ the agent, is what binds `.agents/skills/` to their native location—so “works with
572
647
  Cursor/Copilot/…” means “via skills.sh”, not “Cursor scans `.agents/skills/`
573
648
  itself.”
574
- - **Claude Code does NOT scan `.agents/`** at all it reads only `.claude/skills/`
649
+ - **Claude Code does NOT scan `.agents/`** at all—it reads only `.claude/skills/`
575
650
  (next bullet), which is why the mirror is required, not optional.
576
651
  - When in doubt, verify against the agent’s source/docs before asserting native
577
652
  scanning.
578
- - `.claude/skills/<tool>/SKILL.md` — Claude Code compatibility mirror (required: Claude
653
+ - `.claude/skills/<tool>/SKILL.md`—Claude Code compatibility mirror (required: Claude
579
654
  Code reads only this path).
580
- - `AGENTS.md` — compact always-on project bootstrap, not a full copy of the skill.
581
- - `.codex/hooks.json` or `.codex/config.toml` — Codex lifecycle automation, not policy
655
+ - `AGENTS.md`—compact always-on project bootstrap, not a full copy of the skill.
656
+ - `.codex/hooks.json` or `.codex/config.toml`—Codex lifecycle automation, not policy
582
657
  text or skill content.
583
658
 
584
659
  tbd should write a CLI-managed `SKILL.md` to `.agents/skills/tbd/`, mirror it to
@@ -608,12 +683,19 @@ scripts/agent/<tool>-session.sh # shared hook script, referenced by both agents
608
683
  .claude/settings.json # Claude hook entry → same shared script
609
684
  ```
610
685
 
611
- Copy (don’t symlink) the `SKILL.md` payload to both skill paths — symlinks behave
612
- unevenly across Windows, sandboxes, and remote worktrees.
686
+ **Copy vs symlink the mirror.** Default to **copying** the `SKILL.md` payload to both
687
+ skill paths: a committed copy is browsable on GitHub/skills.sh and behaves predictably
688
+ across Windows, sandboxes, and remote worktrees, where symlinks do not.
689
+ A **symlink** of the Claude mirror onto the canonical `.agents/skills/<tool>/` is a
690
+ legitimate *single-machine* optimization—one source of truth, zero drift—and is what
691
+ `qmd` and the `npx skills add` installer do.
692
+ Reserve it for installs that stay on one developer’s machine; for anything committed or
693
+ shared across platforms, copy.
694
+ Whichever you pick, the two paths must carry identical content.
613
695
  Claude Code does **not** auto-load `AGENTS.md` (it reads `CLAUDE.md`), so a multi-agent
614
696
  project needs both.
615
697
 
616
- **File-ownership rules** — distinguish three categories:
698
+ **File-ownership rules**—distinguish three categories:
617
699
 
618
700
  - **Project instruction files** (`AGENTS.md`, `CLAUDE.md`): *commit these*. They hold
619
701
  human-authored project norms (§2). A CLI may own a **marker-bounded section** inside
@@ -634,42 +716,68 @@ project needs both.
634
716
  Con: not browsable in the repo, and no committed artifact to diff in review.
635
717
  With this mode a format-version stamp matters less (there is no committed artifact
636
718
  for an older tool to clobber).
637
- - **Source files** in the CLI package (header, baseline, brief): the canonical inputs —
638
- always version-controlled.
719
+ - **Source files** in the CLI package (header, baseline, brief): the canonical
720
+ inputs—always version-controlled.
639
721
 
640
722
  Make setup idempotent: dedupe hooks before merging, overwrite generated skills rather
641
723
  than patching them, update only the marked section of `AGENTS.md`, and clean up legacy
642
724
  files each run.
643
725
 
644
726
  **Generated output must be deterministic.** A given input state must always produce
645
- byte-identical output no timestamps, no random IDs, no machine-specific paths, no
727
+ byte-identical output—no timestamps, no random IDs, no machine-specific paths, no
646
728
  unstable ordering. This is what makes the artifact diff-stable, drift-testable, and safe
647
729
  to regenerate. It must also be stable under whatever formatter the repo runs (e.g. emit
648
- the managed block in the formatter’s canonical form sentence-aware line wrapping,
649
- correct quote style so a format pass is a no-op; and don’t emit a second YAML
730
+ the managed block in the formatter’s canonical form—sentence-aware line wrapping,
731
+ correct quote style—so a format pass is a no-op; and don’t emit a second YAML
650
732
  frontmatter block mid-document).
651
733
  Because Codex and Claude Code now share a hook event schema (§8), prefer **one shared
652
734
  script referenced by two thin per-agent configs**: keep the logic in a neutral location
653
735
  (e.g. `scripts/agent/<tool>-session.sh`) and reference it from both
654
736
  `.claude/settings.json` and the Codex `[hooks]`/`.codex/hooks.json` entry.
655
- Do not make Codex hooks call scripts stored under `.claude/` — that couples Codex setup
656
- to Claude setup. If a script must move out of `.claude/scripts/`, update the tbd-owned
657
- hook commands (or leave a wrapper) so existing Claude hooks keep working.
658
-
659
- **Upgrade existing installs deliberately (Tier 2 only).** A self-installing tool whose
660
- skill content evolves *will* leave older generated files in users’ repos.
737
+ Do not make Codex hooks call scripts stored under `.claude/`—that couples Codex setup to
738
+ Claude setup. If a script must move out of `.claude/scripts/`, update the tbd-owned hook
739
+ commands (or leave a wrapper) so existing Claude hooks keep working.
740
+
741
+ **Upgrade existing installs deliberately (L3 only).** A self-installing tool whose skill
742
+ content evolves *will* leave older generated files in users’ repos.
743
+ (An L2 tool that only writes discovery-dir skills can skip all of this: a re-install is
744
+ a clean full overwrite, with no managed `AGENTS.md` block or hooks to migrate.)
661
745
  Treat generated integration files like config migrations:
662
746
 
747
+ Reserve an `fNN` **format bump** for changes big enough to need an explicit migration: a
748
+ different on-disk shape, a moved or renamed managed region, or a changed hook contract.
749
+ Routine content edits (new skill text, an added shortcut, reworded guidance) are **not**
750
+ a format change. They ship by regenerating the surface, a full overwrite on the next
751
+ `setup` run, so they need no bump and no migration; bumping the format on every content
752
+ tweak would force needless migrations and churn.
753
+
754
+ The upgrade is also **opt-in, not silent**. A tool rewrites a user’s committed files
755
+ only when the user or agent explicitly runs `setup`/`setup --auto`, never from a
756
+ background hook or an ordinary read command.
757
+ Stamping a format lets an explicit `setup` detect an older layout and offer to migrate
758
+ it; it does not license the tool to mutate the repo on its own.
759
+ (This is why a `SessionStart` hook should run a read-only `prime`, not `setup`.)
760
+
663
761
  - Version the generated surfaces with an `fNN` format code.
664
- Prefer **one format code for all the tool’s managed surfaces** — reuse the tool’s
762
+ Prefer **one format code for all the tool’s managed surfaces**—reuse the tool’s
665
763
  existing config/data-format version as the single source of truth (tbd stamps the
666
764
  AGENTS.md block with the same `tbd_format`, currently `f03`) rather than maintaining a
667
- parallel counter. Bump it when any managed surface config schema or a generated agent
668
- surface changes shape.
765
+ parallel counter. Bump it when any managed surface—config schema or a generated agent
766
+ surface—changes shape.
669
767
  - Stamp the format on the generated artifact itself: on the `AGENTS.md` begin-marker
670
768
  line (`<!-- BEGIN … format=fNN … -->`), the skill “DO NOT EDIT” marker, script
671
769
  headers, or an equivalent hook signature.
672
770
  Prefer one marker line over a separate metadata comment.
771
+ - A **fully overwritten content surface** (a generated skill that is always rewritten
772
+ whole, never merged) does not strictly need its own stamp to upgrade cleanly: the next
773
+ `setup` replaces it outright.
774
+ It can lean on the single shared format code carried by a structural surface (such as
775
+ the `AGENTS.md` block).
776
+ But that only protects it if the forward-compatibility check runs **before** any
777
+ surface is written. If `setup` rewrites the skill first and only checks the `AGENTS.md`
778
+ format later, an older tool can partial-downgrade a newer committed skill before it
779
+ aborts. So either stamp and guard each generated surface, or run the format check up
780
+ front and write nothing until it passes.
673
781
  - On every `setup`/`setup --auto` run, **self-upgrade in place, safely and
674
782
  idempotently**: detect older formats and rewrite only the tool-owned regions (managed
675
783
  `AGENTS.md` block, generated skills, tool-owned hooks, `.codex/` config), re-running
@@ -701,8 +809,9 @@ Recommended setup flags:
701
809
 
702
810
  Use a true tri-state: with no targeting flag a surface is detection-based; a positive
703
811
  flag forces it on (and suppresses auto-detection of untargeted surfaces); `--skip-*`
704
- forces it off. Avoid Commander’s `--no-<x>` for surfaces — it defaults the value to
705
- `true`, which would force-install on every run.
812
+ forces it off.
813
+ Avoid Commander’s `--no-<x>` for surfaces—it defaults the value to `true`,
814
+ which would force-install on every run.
706
815
  (`tbd` itself ships `--all`, `--claude`, `--codex`, `--skip-claude`, `--skip-codex`;
707
816
  `AGENTS.md` installs as part of the Codex surface.)
708
817
 
@@ -710,13 +819,16 @@ Keep project-local setup separate from global/user setup.
710
819
  Writing `~/.codex/AGENTS.md`, `~/.agents/skills/`, or `~/.claude/skills/` should be an
711
820
  explicit global install command or documented manual step, not something `setup --auto`
712
821
  does silently.
822
+ For a tool that genuinely needs **both** scopes (a general-purpose writing
823
+ tool, linter, or formatter—most CLIs are project-only and can ignore this), §6.6.2
824
+ codifies the concrete flag mechanics and guard rails.
713
825
 
714
826
  #### 6.6.1 Extensible skill registries (let other packages contribute skills)
715
827
 
716
828
  A single bundled skill is enough for most tools.
717
829
  But when a tool is a **platform** that other packages extend, don’t hard-code its skill
718
- list expose a **registry** so any installed package can contribute a skill that the
719
- CLI discovers at runtime.
830
+ list—expose a **registry** so any installed package can contribute a skill that the CLI
831
+ discovers at runtime.
720
832
 
721
833
  The clean implementation is the host language’s plugin mechanism:
722
834
 
@@ -732,11 +844,129 @@ The clean implementation is the host language’s plugin mechanism:
732
844
 
733
845
  Keep each registered skill a **spec** (name, two-part description, `allowed-tools`, a
734
846
  baseline source, and an optional dynamic catalog function) and run them all through the
735
- **same** `compose` and `--install` path, so every skill first-party or third-party
736
- gets identical frontmatter, the `DO NOT EDIT`/format marker, and deterministic output.
847
+ **same** `compose` and `--install` path, so every skill—first-party or third-party—gets
848
+ identical frontmatter, the `DO NOT EDIT`/format marker, and deterministic output.
737
849
  This keeps the “one tool, many self-injecting commands” model open for extension without
738
850
  the core tool taking a dependency on every plugin.
739
851
 
852
+ #### 6.6.2 Install scope: project-pinned, global, or both
853
+
854
+ **First decide which scopes the tool should even offer—most tools should not offer all
855
+ three.** The deciding factor is whether the tool is *customized per install*; a
856
+ secondary one is whether the user wants it as an explicit dependency of each repo.
857
+
858
+ - **Customized per install → project install, version-pinned, single scope (preferred;
859
+ consider discouraging global).** If the tool carries per-project configuration or
860
+ defines how *this* repo is built, tracked, or reviewed, install it into the project
861
+ and pin its version there, so the whole team and every agent get identical behavior
862
+ and different projects can pin different versions independently.
863
+ For such a tool a global install is usually not worth supporting—and can be worth
864
+ actively discouraging—because a per-project install is almost always preferable.
865
+ **`tbd` is deliberately here**: pinned per project and configured per repo
866
+ (`.tbd/config.yml`, the issue prefix), so a global cross-repo install would be an
867
+ anti-pattern, not a missing feature.
868
+ This is the §6.0 “consistency control” argument taken to its conclusion.
869
+ - **Not customized (a general utility) → dual-scope, for flexibility.** When there is no
870
+ per-project configuration to anchor the tool, offering *both* `--project` and
871
+ `--global` simply lets the user decide where it lives—global so it is available
872
+ everywhere with no explicit repo dependency, or project-local when they do want it
873
+ pinned. **`qmd` is here**: a Markdown search tool pointed at arbitrary collections,
874
+ useful across repos and configured per invocation.
875
+ - **Global-only → rare, but conceivable.** Reserve it for a genuine *user-level
876
+ preference* that applies across all of a user’s projects and that the user would
877
+ rarely want committed into any single repo.
878
+ Most tools are not this; do not default to global-only.
879
+
880
+ The `--project`/`--global` mechanics below apply to any tool that offers global or
881
+ dual-scope installs.
882
+ §6.6 states the principle (project-local and global must be kept separate; global must
883
+ be explicit); this codifies it.
884
+ The model to copy is **`git config`**: implicit scope when it is unambiguous, a hard
885
+ error when it is not.
886
+
887
+ **Explicit scope flags.**
888
+
889
+ ```
890
+ mycli install [--project | --global] [--surfaces=LIST | per-agent flags]
891
+ [--dir DIR] [--no-repo-check] [--pin VERSION]
892
+ ```
893
+
894
+ - `--project` → project-local install (the canonical `.agents/skills/<tool>/` plus the
895
+ Claude mirror, under the repo).
896
+ - `--global` → user-global install under `$HOME` (`~/.agents/skills/`,
897
+ `~/.claude/skills/`).
898
+ - Mutually exclusive: `--project ↔ --global`, and `--global ↔ --dir`.
899
+
900
+ **Implicit-when-unambiguous, error-when-not** (the `git config` rule).
901
+ Resolve scope *before* writing anything:
902
+
903
+ | Situation | Behavior |
904
+ | --- | --- |
905
+ | cwd is inside a git repo and not `$HOME` | implicit `--project` |
906
+ | cwd is `$HOME` or the filesystem root | **error**: ambiguous; pass `--project` or `--global` |
907
+ | cwd is not in a git repo | **error**: ambiguous; pass `--project --no-repo-check` or `--global` |
908
+ | explicit `--project` / `--global` given | honor it (subject to the `$HOME` refusal below) |
909
+
910
+ This removes the footgun where `cd ~ && mycli install` silently writes into the user’s
911
+ global agent surfaces and changes every project’s behavior.
912
+ Warning *after* the write (what some tools do—and `qmd`, which simply defaults to cwd
913
+ with no guard at all, does not warn) is too late; refuse *before* it.
914
+
915
+ **`$HOME` is always refused in `--project` mode**—even with `--no-repo-check`,
916
+ `--project --dir ~` is an error, because that is exactly what `--global` is for.
917
+ Name the right flag in the message:
918
+
919
+ ```
920
+ mycli install --project: refusing to install into /Users/me (home directory).
921
+ That would write to your global agent surfaces. Use --global for a user-wide install.
922
+ ```
923
+
924
+ **Print the resolved target before writing**, so the user can ctrl-c if it is wrong:
925
+
926
+ ```
927
+ Installing mycli skills (project mode) into: /Users/me/myrepo
928
+ surfaces: portable, claude
929
+ ```
930
+
931
+ (Printing the scope *after* the write—as `qmd` does—is weaker: the damage is already
932
+ done.)
933
+
934
+ **Surface selection—match the vocabulary to the surface count.** There is no single
935
+ right answer; pick by how many surfaces you have and expect to add:
936
+
937
+ - **Two or three surfaces** → terse per-agent / boolean flags read best.
938
+ `qmd` (canonical skill dir + Claude mirror) uses a single
939
+ `--skip-claude`/`--no-claude` toggle; `tbd` uses `--all` / `--claude` / `--codex` /
940
+ `--skip-<surface>`.
941
+ - **Three or more surfaces, or you expect to add agents** → a `--surfaces=<comma-list>`
942
+ selector with an `all` alias (`--surfaces=portable,claude,agents-md,all`) scales
943
+ better: adding `gemini-md` or `cursor-rules` later is a no-op for the CLI shape, with
944
+ no flag soup. The selector vocabulary lives only in the CLI—the artifact’s identity is
945
+ clear from its location (a `SKILL.md` under a skill dir, or the BEGIN/END-bounded
946
+ block in `AGENTS.md`), so no in-file `surface=` tag is needed beyond the load-bearing
947
+ `format=fNN`.
948
+
949
+ Either way, use a true tri-state (detection-based when unflagged; positive flag forces
950
+ on and suppresses auto-detection; skip forces off) and avoid Commander’s `--no-<x>` for
951
+ surfaces, which defaults the value to `true` (§6.6).
952
+
953
+ **Global mode skips global `AGENTS.md` by default.** `AGENTS.md` loads on every turn;
954
+ skills are progressive-disclosure (~100 tokens until invoked).
955
+ Writing a global block to `~/.codex/AGENTS.md` would tax every session in every project,
956
+ so global install should populate only the skill-discovery dirs.
957
+ `--global --surfaces=agents-md` should **error** with a clear “we don’t support this”
958
+ message rather than silently do it.
959
+ (`qmd` validates this from the lighter end—it writes no `AGENTS.md` block in *any*
960
+ scope.)
961
+
962
+ **Cross-scope coexistence is the supported pattern, not a conflict.** Having a skill
963
+ installed both globally and per-project is a feature: **project scope shadows user
964
+ scope**, exactly like `git config`, shell `$PATH`, npm, and Python site-packages, and
965
+ matching the path-ordered DocCache in §6.3. Codex documents the same precedence in its
966
+ loader (`Repo` > `User` > `Admin`), and Claude Code ships `.claude/skills/` and
967
+ `~/.claude/skills/` as deliberately separate discovery paths.
968
+ Don’t treat a dual install as something to detect and de-duplicate.
969
+
740
970
  ### 6.7 Making the CLI available: global install vs. zero-install
741
971
 
742
972
  A separate design dimension from §6.6 (how the CLI installs *itself into agents*) is how
@@ -753,13 +983,13 @@ Decide this explicitly and state the chosen invocation in `SKILL.md`/`AGENTS.md`
753
983
 
754
984
  **Trade-offs**
755
985
 
756
- - **Global install** — *Pros*: fastest invocation (no per-call resolution), works
757
- offline, and version is managed by the project (lockfile / `package.json` / `uv` tool
986
+ - **Global install**—*Pros*: fastest invocation (no per-call resolution), works offline,
987
+ and version is managed by the project (lockfile / `package.json` / `uv` tool
758
988
  manifest), so it’s auditable and reproducible.
759
- *Cons*: it’s a stateful prerequisite in ephemeral or cloud environments the global
760
- bin doesn’t persist, so the CLI can be **missing at session start** unless you
761
- bootstrap it.
762
- - **Zero-install** — *Pros*: works in any environment with no setup; nothing to persist;
989
+ *Cons*: it’s a stateful prerequisite—in ephemeral or cloud environments the global bin
990
+ doesn’t persist, so the CLI can be **missing at session start** unless you bootstrap
991
+ it.
992
+ - **Zero-install**—*Pros*: works in any environment with no setup; nothing to persist;
763
993
  ideal default for portability.
764
994
  *Cons*: cold-start download/cache cost on first call (uvx cold ≈ 1s, cached ≈ tens of
765
995
  ms; npx similar), needs network, and an **unpinned** invocation (`npx pkg`, `uvx pkg`)
@@ -774,7 +1004,7 @@ will fail on a fresh cloud session.
774
1004
 
775
1005
  **Pin the version (security).** Whichever you choose, the skill’s referenced invocation
776
1006
  should pin a version so the agent can’t silently run a newer (possibly compromised)
777
- release the §9 / 14-day-package-age rule applied to the runner itself:
1007
+ release—the §9 / 14-day-package-age rule applied to the runner itself:
778
1008
 
779
1009
  ```bash
780
1010
  uvx mytool@1.4.2 ... # not `uvx mytool`
@@ -809,7 +1039,7 @@ See `tbd guidelines supply-chain-hardening` for the cross-ecosystem policy.
809
1039
  Astral’s `uv`, Rust-fast, no Python prereq) or `pipx run <pkg>==<ver>`; persistent via
810
1040
  `uv tool install` / `pipx install`. `uvx` reuses a persistent install if one exists.
811
1041
  - **Go**: `go run <module>@<ver>` (compiles on the fly) or `go install`.
812
- - **Rust**: no first-class zero-install runner ship **prebuilt binaries** (GitHub
1042
+ - **Rust**: no first-class zero-install runner—ship **prebuilt binaries** (GitHub
813
1043
  releases and a `curl … | sh` installer) or `cargo binstall`; `cargo install` compiles.
814
1044
  - **Cross-language**: a prebuilt binary and install script, or a container image (Docker
815
1045
  is emerging as the production-grade distribution for MCP servers).
@@ -824,24 +1054,24 @@ configs; **CLIs** like Beads offer `brew` / `npm -g` / `curl` installers, while
824
1054
  **global install and a `SessionStart` bootstrap** as the optimization for persistent
825
1055
  environments where the project wants lockfile-managed versions and warm-start speed.
826
1056
 
827
- ### 6.8 Publishing & discovery make the skill installable
1057
+ ### 6.8 Publishing and discovery—make the skill installable
828
1058
 
829
1059
  Most “skill registries” (May 2026) are **GitHub-repo discoverers, not gated app
830
1060
  stores**. You don’t submit a form; you put a spec-compliant `SKILL.md` in a public repo
831
1061
  and the ecosystem finds it.
832
1062
  The landscape worth targeting:
833
1063
 
834
- - **`skills.sh` / `npx skills add <owner/repo>`** (Vercel) the cross-agent “npm for
1064
+ - **`skills.sh` / `npx skills add <owner/repo>`** (Vercel)—the cross-agent “npm for
835
1065
  skills”: one command installs into `.agents/skills/` and symlinks per agent (Claude
836
1066
  Code, Codex, Cursor, Copilot, Gemini, …). No review; ranked by install telemetry.
837
1067
  **This is the highest-leverage target** and needs zero extra infra.
838
1068
  - **GitHub-scraping indexers** (SkillsMP ~800k skills, ClaudeSkills.info, LobeHub,
839
- claudemarketplaces.com) auto-list public repos that contain a `SKILL.md` (often
840
- gated on ≥2 stars). You get listed for free just by being public and discoverable.
841
- - **Plugin marketplaces** — `.claude-plugin/marketplace.json` (Claude Code, the official
1069
+ claudemarketplaces.com)—auto-list public repos that contain a `SKILL.md` (often gated
1070
+ on ≥2 stars). You get listed for free just by being public and discoverable.
1071
+ - **Plugin marketplaces**—`.claude-plugin/marketplace.json` (Claude Code, the official
842
1072
  Anthropic channel) and `.agents/plugins/marketplace.json` (Codex; Codex reads both).
843
1073
  These are *plugin* channels: bundles of skills, MCP servers, hooks, and commands.
844
- They are **only for publishing a bundle** — a repo-local skill already loads from
1074
+ They are **only for publishing a bundle**—a repo-local skill already loads from
845
1075
  `.claude/skills/` (Claude Code) and `.agents/skills/` (Codex) **without any
846
1076
  manifest**, so don’t add one just to be discovered.
847
1077
  If you *do* emit a `marketplace.json` / `.codex-plugin/plugin.json`, treat it like any
@@ -860,11 +1090,11 @@ your-repo/
860
1090
 
861
1091
  `skills/<name>/SKILL.md` at the repo root is the universal discovery location
862
1092
  (`npx skills add`, the indexers, and agent installers all scan it).
863
- That’s the whole publishing step push it public.
1093
+ That’s the whole publishing step—push it public.
864
1094
 
865
1095
  **For a CLI-backed skill** (the §6 pattern), one extra rule matters: a registry installs
866
1096
  **only the Markdown**, never your binary.
867
- So the published `SKILL.md` must **bootstrap its own CLI** — lead with a pinned install
1097
+ So the published `SKILL.md` must **bootstrap its own CLI**—lead with a pinned install
868
1098
  line (`npm i -g <pkg>@<ver>` / `uvx --from <pkg>@<ver>`) and a one-time `setup`, and
869
1099
  have commands degrade with a clear “install the CLI first” message.
870
1100
  Treat the registry copy as a **landing page that installs the engine**, not the engine
@@ -874,13 +1104,13 @@ pushing.
874
1104
 
875
1105
  `tbd` does exactly this: `skills/tbd/SKILL.md` is generated at build time from the same
876
1106
  baseline, carries `name: tbd` and a trigger-rich description, and opens with the
877
- `npm install -g get-tbd` and `tbd setup --auto` bootstrap so
878
- `npx skills add jlevy/tbd` gives an agent a working landing page, and `tbd setup` then
879
- upgrades it to the full multi-agent install (§6.6).
1107
+ `npm install -g get-tbd` and `tbd setup --auto` bootstrap—so `npx skills add jlevy/tbd`
1108
+ gives an agent a working landing page, and `tbd setup` then upgrades it to the full
1109
+ multi-agent install (§6.6).
880
1110
 
881
1111
  * * *
882
1112
 
883
- ## 7. CLI vs MCP vs Skill Choosing the Surface
1113
+ ## 7. CLI vs MCP vs Skill—Choosing the Surface
884
1114
 
885
1115
  These are complementary, not competing.
886
1116
  Pick by need:
@@ -894,25 +1124,25 @@ Pick by need:
894
1124
 
895
1125
  **Why CLI usually wins when one exists**: benchmarks (2026) put a CLI at ~100% task
896
1126
  reliability and ~1.3K–8.7K tokens, vs.
897
- MCP at ~72% reliability and ~32K–82K tokens roughly **17× cheaper** at scale because
1127
+ MCP at ~72% reliability and ~32K–82K tokens—roughly **17× cheaper** at scale—because
898
1128
  LLMs already know common CLI usage and no tool schema is injected.
899
1129
  Use MCP when there’s no CLI to lean on or you need its auth/permission machinery.
900
1130
 
901
- **MCP current state (May 2026)**: governed by AAIF/Linux Foundation; two transports —
902
- **stdio** (local) and **Streamable HTTP** (remote; replaced legacy SSE in the Nov 2025
903
- spec, supports OAuth 2.1 + PKCE). Primitives: **tools**, **resources**, **prompts**.
904
- Security is a real concern (a scan found 492 public servers with no auth) — authenticate
905
- every request, scope every tool call, validate inputs, never pass tokens between
906
- servers.
1131
+ **MCP current state (May 2026)**: governed by AAIF/Linux Foundation; two
1132
+ transports—**stdio** (local) and **Streamable HTTP** (remote; replaced legacy SSE in the
1133
+ Nov 2025 spec, supports OAuth 2.1 + PKCE). Primitives: **tools**, **resources**,
1134
+ **prompts**. Security is a real concern (a scan found 492 public servers with no
1135
+ auth)—authenticate every request, scope every tool call, validate inputs, never pass
1136
+ tokens between servers.
907
1137
 
908
1138
  **Code execution with MCP** ("Code Mode"): instead of exposing many MCP tools as direct
909
1139
  calls (each ~550–1,400 tokens of schema), let the agent write code against a compact
910
- tool API in a sandbox reported 78–99% token reduction.
1140
+ tool API in a sandbox—reported 78–99% token reduction.
911
1141
  Worth it when an MCP server exposes *many* tools; overkill for one.
912
1142
 
913
1143
  * * *
914
1144
 
915
- ## 8. Hooks & Lifecycle (Cross-Agent)
1145
+ ## 8. Hooks and Lifecycle (Cross-Agent)
916
1146
 
917
1147
  Hooks let a tool inject context or enforce invariants automatically.
918
1148
  Support varies:
@@ -927,7 +1157,7 @@ Support varies:
927
1157
  via exit code 2), **Gemini CLI** (~12), and **opencode** (25+, with tool interception)
928
1158
  all have lifecycle hooks.
929
1159
  - **Codex** (as of May 2026) ships a **Claude-style hooks engine that uses the same
930
- event schema as Claude Code** — `SessionStart`, `PreCompact`/`PostCompact`,
1160
+ event schema as Claude Code**—`SessionStart`, `PreCompact`/`PostCompact`,
931
1161
  `PreToolUse`/`PostToolUse`, `UserPromptSubmit`, `Stop`,
932
1162
  `SubagentStart`/`SubagentStop`, and `PermissionRequest`. Hooks load from `hooks.json`
933
1163
  **or an inline `[hooks]` table in `config.toml`** next to an active config layer
@@ -943,7 +1173,7 @@ Support varies:
943
1173
  **Common, portable use**: a `SessionStart` hook that runs your CLI’s `prime`/`skill`
944
1174
  command to restore workflow context; a `PreCompact` hook that re-injects a brief
945
1175
  (`skill --brief`) before the window is trimmed.
946
- Keep injected context small it competes with everything else.
1176
+ Keep injected context small—it competes with everything else.
947
1177
 
948
1178
  ```jsonc
949
1179
  // Claude Code ~/.claude/settings.json
@@ -957,7 +1187,7 @@ Keep injected context small — it competes with everything else.
957
1187
 
958
1188
  * * *
959
1189
 
960
- ## 9. Security & Supply Chain (Don’t Skip This)
1190
+ ## 9. Security and Supply Chain (Don’t Skip This)
961
1191
 
962
1192
  Skills and instruction files are **executable influence** on an agent, which makes them
963
1193
  an attack surface. Treat them with the same care as dependencies.
@@ -969,11 +1199,11 @@ an attack surface. Treat them with the same care as dependencies.
969
1199
  input**.
970
1200
  - **Never put secrets in skill/instruction files or tool output.** `AGENTS.md`,
971
1201
  `SKILL.md`, bundled scripts, and anything a command prints get loaded into agent
972
- context (and often committed) keep credentials, tokens, and keys out of them; read
1202
+ context (and often committed)—keep credentials, tokens, and keys out of them; read
973
1203
  secrets from the environment at runtime instead.
974
1204
  - **Vet third-party skills before install.** Prefer sources that scan (skills.sh runs
975
1205
  Snyk on every install).
976
- Read the body and any bundled scripts review them like dependency code.
1206
+ Read the body and any bundled scripts—review them like dependency code.
977
1207
  Pin to a commit, not a moving tag.
978
1208
  - **Scope tools tightly.** Use `allowed-tools` to grant the minimum (e.g.,
979
1209
  `Bash(mycli:*)` not blanket `Bash`). Prefer `disable-model-invocation` for
@@ -984,35 +1214,34 @@ an attack surface. Treat them with the same care as dependencies.
984
1214
  denied.
985
1215
  - **Apply the same currency discipline** you use for packages: if your skill ships a
986
1216
  script with dependencies, the project’s supply-chain rules (e.g., the 14-day
987
- package-age rule) apply and a skill that references a zero-install runner must pin
988
- the version (§6.7), since unpinned `npx`/`uvx` bypasses the cool-off.
1217
+ package-age rule) apply—and a skill that references a zero-install runner must pin the
1218
+ version (§6.7), since unpinned `npx`/`uvx` bypasses the cool-off.
989
1219
  See `tbd guidelines supply-chain-hardening` for the cross-ecosystem policy, or
990
1220
  `tbd guidelines bun-monorepo-patterns` / `pnpm-monorepo-patterns` for monorepo
991
1221
  specifics.
992
1222
 
993
1223
  * * *
994
1224
 
995
- ## 10. Emerging & Forward-Looking (Know It Exists)
1225
+ ## 10. Emerging and Forward-Looking (Know It Exists)
996
1226
 
997
1227
  You usually don’t need these to ship a skill, but they shape where the ecosystem is
998
1228
  going:
999
1229
 
1000
- - **ACP (Agent Client Protocol)** — Zed’s “LSP for agents” (JSON-RPC over stdio); 25+
1230
+ - **ACP (Agent Client Protocol)**—Zed’s “LSP for agents” (JSON-RPC over stdio); 25+
1001
1231
  agents (Claude Code, Codex, Gemini CLI, opencode) and editors (Zed, JetBrains, Kiro).
1002
1232
  Complements MCP (editor↔agent, while MCP is agent↔tools).
1003
1233
  Your agent runtime speaks it; a skill author doesn’t implement it.
1004
- - **A2A (Agent2Agent)** — Google/Linux Foundation, v1.0, 150+ orgs; for enterprise
1234
+ - **A2A (Agent2Agent)**—Google/Linux Foundation, v1.0, 150+ orgs; for enterprise
1005
1235
  agent-to-agent delegation, not skill authoring.
1006
1236
  Ignore unless you build autonomous multi-agent systems.
1007
- - **Codex App-Server** — JSON-RPC (Thread/Turn/Item) decoupling Codex logic from client
1237
+ - **Codex App-Server**—JSON-RPC (Thread/Turn/Item) decoupling Codex logic from client
1008
1238
  surfaces; relevant only for Codex-specific integration surfaces.
1009
- - **Plugin marketplaces & `npx skills`** — distribution is consolidating: Claude Code
1239
+ - **Plugin marketplaces & `npx skills`**—distribution is consolidating: Claude Code
1010
1240
  plugin marketplaces (official and community), Codex plugins, and Vercel’s
1011
1241
  `npx skills add` over the skills.sh directory (cross-agent symlinks).
1012
- - **Routines / scheduled agents, background monitors, `/run` & `/verify` skills** —
1013
- newer Claude Code capabilities for autonomous, event-triggered, and app-verifying
1014
- workflows (confirm GA vs.
1015
- preview for your version before relying on them).
1242
+ - **Routines / scheduled agents, background monitors, `/run` & `/verify` skills**—newer
1243
+ Claude Code capabilities for autonomous, event-triggered, and app-verifying workflows
1244
+ (confirm GA vs. preview for your version before relying on them).
1016
1245
 
1017
1246
  * * *
1018
1247
 
@@ -1026,23 +1255,27 @@ going:
1026
1255
  - Have a CLI → make it agent-friendly (`--json`, idempotent, actionable errors) and
1027
1256
  point a `SKILL.md` at it.
1028
1257
 
1029
- **Descriptions & disclosure**
1258
+ **Descriptions and disclosure**
1030
1259
 
1031
1260
  - Two-part rule: *what it does* + *when to use it*; third person; front-load keywords.
1032
1261
  - Progressive disclosure: metadata → body → supporting files; bundle scripts
1033
1262
  (output-only cost).
1263
+ - Route, don’t restate: name each capability and the command to run; let the CLI’s
1264
+ `--help` and informational subcommands hold the flags and recipes.
1265
+ Carry the focused context an agent needs to judge that the tool is relevant, but don’t
1266
+ blindly copy help into the skill; that wastes context and goes stale (§3.1, §6.5).
1034
1267
  - Respect the budget; verify the current model for your target agent (Claude Code ≈ 1%
1035
1268
  of context window, not a flat char count).
1036
1269
 
1037
1270
  **Scale up only when needed**
1038
1271
 
1039
- - Many capabilities → meta-skill + informational, self-injecting subcommands (one
1272
+ - Many capabilities → meta-skill and informational, self-injecting subcommands (one
1040
1273
  listing slot, unbounded resources).
1041
1274
  This is tbd’s validated approach.
1042
1275
  - Path-ordered resource cache for project/user shadowing; generate `--list` dynamically.
1043
1276
  - Context-injection loop with explicit `cli command arg` references; depth ≤ 3.
1044
1277
 
1045
- **Reach & surface**
1278
+ **Reach and surface**
1046
1279
 
1047
1280
  - Layer for reach: `AGENTS.md` + `SKILL.md` + CLI + (MCP if no CLI fits).
1048
1281
  - Prefer CLI over MCP when a CLI exists (cheaper, more reliable); use MCP for
@@ -1065,6 +1298,9 @@ going:
1065
1298
  **Baseline (every skill)**
1066
1299
  - [ ] `SKILL.md` with `name` + two-part `description`
1067
1300
  - [ ] Body < 500 lines; bulky material in supporting files one level deep
1301
+ - [ ] Body carries the essential context to judge whether the tool is relevant and to
1302
+ name each key use case, but routes to `mycli <cmd> --help` or `--list` for flags and
1303
+ recipes instead of copying help wholesale
1068
1304
  - [ ] Third-person description, trigger keywords front-loaded
1069
1305
  - [ ] Installable via commit to `.agents/skills/`, Claude mirror at `.claude/skills/`,
1070
1306
  and/or `npx skills add`
@@ -1105,7 +1341,7 @@ going:
1105
1341
 
1106
1342
  ## References
1107
1343
 
1108
- ### Open standards & governance
1344
+ ### Open standards and governance
1109
1345
 
1110
1346
  - Agent Skills standard: https://agentskills.io (spec:
1111
1347
  https://agentskills.io/specification)
@@ -1143,7 +1379,7 @@ going:
1143
1379
  - Amp: https://ampcode.com/manual
1144
1380
  - pi: https://github.com/badlogic/pi-mono
1145
1381
 
1146
- ### MCP & protocols
1382
+ ### MCP and protocols
1147
1383
 
1148
1384
  - 2026 MCP roadmap: https://blog.modelcontextprotocol.io/posts/2026-mcp-roadmap/
1149
1385
  - Code execution with MCP: https://www.anthropic.com/engineering/code-execution-with-mcp
@@ -1152,7 +1388,7 @@ going:
1152
1388
  - A2A:
1153
1389
  https://www.linuxfoundation.org/press/a2a-protocol-surpasses-150-organizations-lands-in-major-cloud-platforms-and-sees-enterprise-production-use-in-first-year
1154
1390
 
1155
- ### Distribution & ecosystem
1391
+ ### Distribution and ecosystem
1156
1392
 
1157
1393
  - Vercel skills / skills.sh:
1158
1394
  https://vercel.com/changelog/introducing-skills-the-open-agent-skills-ecosystem
@@ -1160,6 +1396,8 @@ going:
1160
1396
  - Anthropic skills (examples): https://github.com/anthropics/skills
1161
1397
  - gstack: https://github.com/garrytan/gstack
1162
1398
  - Beads (bd): https://github.com/gastownhall/beads
1399
+ - qmd (L2 reference: self-installing skill, discovery-dirs only, CLI + MCP + plugin):
1400
+ https://github.com/tobi/qmd
1163
1401
 
1164
1402
  ### Security
1165
1403