get-tbd 0.1.28 → 0.1.30

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.
@@ -1,1397 +1,1176 @@
1
1
  ---
2
- title: CLI Agent Skill Patterns
3
- description: Best practices for building TypeScript CLIs that function as agent skills in Claude Code and other AI coding agents
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
4
4
  author: Joshua Levy (github.com/jlevy) with LLM assistance
5
5
  ---
6
- # CLI Agent Skill Patterns
6
+ # Agent Skills & CLI Integration Patterns
7
7
 
8
- These patterns apply to building TypeScript CLI applications that function as powerful
9
- skills within Claude Code and other AI coding agents.
10
- The patterns are derived from the `tbd` CLI implementation, which serves as a reference
11
- architecture for agent-integrated command-line tools.
8
+ **Last Updated**: 2026-05-23 (research verified against primary sources May 2026)
12
9
 
13
- The core insight is that a CLI can be much more than a command executor—it can be a
14
- **dynamic skill module** that provides context management, self-documentation, and
15
- seamless integration with multiple AI agents through a single npm package.
10
+ 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.
16
14
 
17
- **When to use this guideline**: When building a CLI tool that should work well with AI
18
- coding agents, when adding agent integration to an existing CLI, or when designing
19
- context management for agent-aware applications.
15
+ The patterns draw on the current (May 2026) state of the ecosystem and on `tbd`’s own
16
+ implementation, which serves as a reference for the advanced “CLI-as-skill” approach.
20
17
 
21
- ## Key Patterns to Consider for CLIs
18
+ **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
+ others without rewriting it per agent.
22
22
 
23
- 1. **CLI as Dynamic Skill Module:** CLIs can provide context management,
24
- self-documentation, and multi-agent integration through a single npm package.
25
-
26
- 2. **CLI as Knowledge Library:** Bundle guidelines, shortcuts, and templates that agents
27
- can query on-demand to improve work quality.
28
- This transforms the CLI from a tool the agent tells users about into a resource the
29
- agent uses to better serve users.
30
-
31
- 3. **Context Injection Loop:** A recursive architecture where skill documentation
32
- references commands, those commands output more context, and that context references
33
- further commands. This creates a self-directing knowledge system where agents get
34
- progressively smarter as they work.
35
-
36
- 4. **Task Management Integration:** CLIs that help agents track work across sessions,
37
- discover available tasks, and enforce session boundaries lead to more reliable
38
- agentic workflows.
23
+ > **The single most important shift since 2025**: skills and project instructions are
24
+ > now **open standards**, not per-vendor formats.
25
+ > `AGENTS.md` is governed under the Linux Foundation’s **Agentic AI Foundation (AAIF)**;
26
+ > the **Agent Skills (`SKILL.md`)** format is an open standard published at
27
+ > [agentskills.io](https://agentskills.io) and implemented by 20+ agents.
28
+ > Write to the standard once; most agents pick it up for free.
39
29
 
40
30
  * * *
41
31
 
42
- ## 1. CLI as Skill Architecture
32
+ ## 0. Start Here The Simple Baseline
43
33
 
44
- ### 1.1 Bundled Documentation Pattern
34
+ Read this section first.
35
+ For the large majority of cases, you are done after it.
45
36
 
46
- - **Bundle documentation files with CLI**: Include skill files, `README.md`, and docs in
47
- the CLI distribution.
48
- Maintain tiered skill files for different contexts:
37
+ ### 0.1 If you just want a skill (prompt-only capability)
49
38
 
50
- | Tier | File | Tokens | Purpose |
51
- | --- | --- | --- | --- |
52
- | Full | `skill-baseline.md` | ~2000 | Default installation, full workflow guide |
53
- | Brief | `skill-brief.md` | ~400 | Condensed version for `--brief` flag |
54
-
55
- ```typescript
56
- function getDocPath(filename: string): string {
57
- const __dirname = dirname(fileURLToPath(import.meta.url));
58
- return join(__dirname, 'docs', filename);
59
- }
39
+ Create one folder with one file:
60
40
 
61
- async function loadDocContent(filename: string): Promise<string> {
62
- // Try bundled location first
63
- try {
64
- return await readFile(getDocPath(filename), 'utf-8');
65
- } catch {
66
- // Fallback chain: dev path → repo path → error
67
- }
68
- }
69
41
  ```
70
-
71
- - **Use a `dist/docs/` directory**: Store bundled docs alongside the CLI for
72
- self-contained packages that work in sandboxed environments, containers, and CI.
73
-
74
- - **Implement fallback loading**: Support bundled → development source → repo-level
75
- docs.
76
-
77
- - **Provide a `skill` subcommand**: Output skill content to stdout so agents can inspect
78
- or pipe it. Support verbosity flags:
79
- ```bash
80
- mycli skill # Full skill with dynamic content
81
- mycli skill --brief # Condensed version (~400 tokens)
82
- ```
83
-
84
- ### 1.2 Multi-Agent Integration Files
85
-
86
- Each agent platform has different file format requirements:
87
-
88
- | Agent | File | Format | Location |
89
- | --- | --- | --- | --- |
90
- | Claude Code | SKILL.md | YAML frontmatter + Markdown | `.claude/skills/name/` |
91
- | Cursor IDE | CURSOR.mdc | MDC frontmatter + Markdown | `.cursor/rules/` |
92
- | Codex | AGENTS.md | HTML markers + Markdown | repo root |
93
-
94
- **SKILL.md Format** (Claude Code):
95
-
96
- ```yaml
97
- ---
98
- name: mycli
99
- description: Lightweight, git-native issue tracking...
100
- allowed-tools: Bash(mycli:*)
101
- ---
102
- # mycli Workflow
103
- ...
42
+ my-skill/
43
+ └── SKILL.md
104
44
  ```
105
45
 
106
- **CURSOR.mdc Format** (Cursor IDE):
107
-
108
- ```yaml
46
+ ```markdown
109
47
  ---
110
- description: mycli workflow rules for git-native issue tracking...
111
- alwaysApply: false
48
+ name: my-skill
49
+ description: >-
50
+ Analyze Excel spreadsheets, build pivot tables, and export results.
51
+ Use when the user mentions .xlsx files, tabular data, or spreadsheets.
112
52
  ---
113
- # mycli Workflow
114
- ...
115
- ```
116
-
117
- **AGENTS.md Format** (Codex):
118
-
119
- ```markdown
120
- <!-- BEGIN MYCLI INTEGRATION -->
121
- # mycli Workflow
122
- ...
123
- <!-- END MYCLI INTEGRATION -->
124
- ```
125
-
126
- * * *
127
-
128
- ## 2. Context Management Commands
129
-
130
- ### 2.1 Prime Command Pattern
131
-
132
- The `prime` command is the key context management primitive.
133
- It outputs contextual information appropriate to the current state:
134
-
135
- - **Initialized repo**: Dashboard with status, rules, quick reference
136
- - **Not initialized**: Setup instructions
137
- - **Migration detected**: Migration warning and guidance
138
-
139
- **Key Features**:
140
-
141
- - Called automatically via hooks at session start and before context compaction
142
- - `--brief` flag for constrained contexts (~200 tokens)
143
- - `--full` flag for complete skill documentation
144
- - Custom override via `.mycli/PRIME.md` file
145
- - CLI with no args shows help with prominent prompt to run `mycli prime` for full
146
- context
147
-
148
- **Relationship with `skill` Command**:
149
-
150
- The `prime` and `skill` commands serve different purposes:
151
-
152
- | Command | Purpose | When Called |
153
- | --- | --- | --- |
154
- | `mycli prime` | Dashboard + status + workflow rules | Session start, context compaction |
155
- | `mycli skill` | Pure skill content (no status/dashboard) | Agent inspection, installation preview |
156
-
157
- Use `prime` for context restoration with current state, `skill` for static skill
158
- documentation.
159
-
160
- **Dashboard Output Structure**:
53
+ # My Skill
161
54
 
55
+ Step-by-step instructions the agent should follow...
162
56
  ```
163
- mycli v1.0.0
164
-
165
- --- INSTALLATION ---
166
- ✓ mycli installed (v1.0.0)
167
- ✓ Initialized in this repo
168
- ✓ Hooks installed
169
-
170
- --- PROJECT STATUS ---
171
- Repository: proj
172
- Tasks: 3 open (1 in_progress) | 1 blocked
173
-
174
- --- WORKFLOW RULES ---
175
- - Track all task work using mycli
176
- - Check `mycli ready` for available work
177
- - Run `mycli sync` at session end
178
-
179
- --- QUICK REFERENCE ---
180
- mycli ready Show tasks ready to work
181
- mycli show <id> View task details
182
- ...
183
- ```
184
-
185
- ### 2.2 Progressive Disclosure Architecture
186
-
187
- The most important concept for building agent-integrated CLIs is **Progressive
188
- Disclosure**—showing just enough information to help agents decide what to do next, then
189
- revealing more details as needed.
190
- This minimizes token overhead while maintaining full capability.
191
-
192
- **Three-Level Architecture**:
193
-
194
- | Level | Content | Token Budget | When Loaded |
195
- | --- | --- | --- | --- |
196
- | Level 1 | Metadata only (name + description) | ~100 tokens | Always in system prompt |
197
- | Level 2 | SKILL.md body | ~1,500-5,000 tokens | On skill trigger |
198
- | Level 3 | Bundled resources (scripts, references) | Unlimited | As-needed |
199
-
200
- **Key Constraints**:
201
-
202
- - Keep SKILL.md under 500 lines
203
- - Reference files should stay one level deep from SKILL.md
204
- - Avoid chains like SKILL.md → advanced.md → details.md
205
- - Scripts execute outside context; only output uses tokens
206
-
207
- ### 2.3 Description Optimization Pattern
208
-
209
- Skill activation relies on **pure LLM reasoning**, not keyword matching or embeddings.
210
- Description quality directly impacts activation reliability.
211
-
212
- **Activation Reliability Data** (from real-world testing across 200+ prompts):
213
57
 
214
- | Approach | Success Rate |
215
- | --- | --- |
216
- | No optimization / vague descriptions | ~20% |
217
- | Optimized descriptions with “Use when …” | ~50% |
218
- | Descriptions with concrete examples | 72-90% |
219
- | Forced evaluation hooks | 80-84% |
220
-
221
- **The Two-Part Rule**: Every description must answer:
58
+ That is the entire artifact — no build step, no runtime, no dependencies.
59
+ This is the **Agent Skills open standard** ([agentskills.io](https://agentskills.io)),
60
+ and the same folder works in Claude Code, Codex CLI, Gemini CLI, GitHub Copilot, Cursor,
61
+ Windsurf, Cline, pi, and 20+ other tools.
62
+ 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.
222
64
 
223
- 1. **What does it do?** (capabilities)
224
- 2. **When to use it?** (activation triggers)
65
+ **The only two things that matter for a basic skill:**
225
66
 
226
- **Anti-Pattern**:
67
+ 1. A **`description`** that says *what it does* AND *when to use it* (this drives
68
+ activation — see §4.2).
69
+ 2. A **body under ~500 lines** of clear, imperative instructions.
227
70
 
228
- ```yaml
229
- description: Helps with documents
230
- ```
231
-
232
- **Preferred Pattern**:
233
-
234
- ```yaml
235
- description: >
236
- Analyze Excel spreadsheets, create pivot tables, and export data.
237
- Use when analyzing .xlsx files, working with tabular data, or
238
- when the user mentions spreadsheets or Excel.
239
- ```
240
-
241
- **Writing Guidelines**:
242
-
243
- - Use third person always ("Processes files" not “I can help you”)
244
- - Include explicit “Use when …” triggers with concrete scenarios
245
- - Be specific with keywords users would naturally say
246
- - State both capabilities AND activation conditions
247
- - Front-load the most important trigger keywords in the first 50 characters
248
- (descriptions may be truncated in large skill collections)
249
-
250
- ### 2.4 Description Length and Budget Constraints
251
-
252
- Claude Code has a **cumulative character budget** for all skill descriptions combined.
253
- Understanding these limits is critical for CLIs that install multiple skills.
254
-
255
- **Hard Limits**:
256
-
257
- | Constraint | Limit | Notes |
258
- | --- | --- | --- |
259
- | Individual description | 1,024 characters | Per-skill maximum |
260
- | Skill name | 64 characters | Lowercase, numbers, hyphens only |
261
- | SKILL.md body | ~500 lines | Soft limit; use supporting files for more |
262
- | **Cumulative budget** | ~15,000-16,000 chars | For ALL skill descriptions combined |
263
-
264
- **Per-Skill Overhead**: Each skill consumes ~109 characters of XML overhead (tags, name,
265
- location) plus the description length.
266
-
267
- **Truncation Behavior**: When the cumulative budget is exceeded, skills are hidden:
268
-
269
- | Skills Installed | Skills Visible | Hidden |
270
- | --- | --- | --- |
271
- | 63 | 42 | 33% |
272
- | 92 | 36 | 60% |
273
-
274
- **No warning is shown** when skills are truncated.
275
- Run `/context` to check for excluded skills.
276
-
277
- **Description Length Guidelines by Collection Size**:
278
-
279
- | Skill Collection Size | Recommended Description Length |
280
- | --- | --- |
281
- | < 40 skills | Up to 1,024 characters (full limit) |
282
- | 40-60 skills | ≤150 characters |
283
- | 60+ skills | ≤130 characters |
284
-
285
- **Override**: Set `SLASH_COMMAND_TOOL_CHAR_BUDGET` environment variable to increase the
286
- limit.
287
-
288
- **Meta-Skill Pattern**: For CLIs with many resources (50+), use a single meta-skill that
289
- exposes resources via CLI commands rather than individual skills.
290
- This consumes only one description slot (~200 chars) instead of 50+ slots that would
291
- exceed the budget. See
292
- [Skills vs Meta-Skill Architecture Research](../../project/research/current/research-skills-vs-meta-skill-architecture.md).
293
-
294
- ### 2.5 Skill Command Architecture
295
-
296
- Every agent-integrated CLI should have a `skill` subcommand that outputs skill content
297
- to stdout.
298
- This enables agents to inspect skill content, preview before installation, and
299
- pipe to other commands.
300
-
301
- **Basic Pattern**:
71
+ **Install it** by copying into a known directory, or with the cross-agent package
72
+ manager:
302
73
 
303
74
  ```bash
304
- mycli skill # Full skill content
305
- mycli skill --brief # Condensed version for constrained contexts
75
+ npx skills add owner/repo # Vercel's skills.sh ecosystem (symlinks, 27+ agents)
76
+ # or commit it to a discovery directory:
77
+ # .agents/skills/my-skill/SKILL.md (cross-agent: Codex, pi, others)
78
+ # .claude/skills/my-skill/SKILL.md (Claude Code, project)
79
+ # ~/.claude/skills/my-skill/SKILL.md (Claude Code, personal)
306
80
  ```
307
81
 
308
- **Key Behaviors**:
309
-
310
- - Outputs composed skill content (doesn’t just read a static file)
311
- - Dynamically generates resource directories from available docs
312
- - Supports verbosity flags for different contexts
313
- - Can be piped to files or other commands
82
+ The `SKILL.md` folder is the portable **authoring** format; some agents add their own
83
+ discovery paths (Codex/pi also read `.agents/skills/`) and their own **distribution**
84
+ layers on top (Claude Code plugins, Codex plugins) see §5.
85
+
86
+ ### 0.2 If your capability is a CLI
87
+
88
+ Most agents already know how to run CLIs from their training data, and benchmarks show a
89
+ CLI is far cheaper and more reliable than an MCP server for tools that have one (§7).
90
+ So:
91
+
92
+ 1. Make the CLI **agent-friendly**: a clear `--help`, a `--json` flag on every command,
93
+ actionable errors, and idempotent, non-interactive operation (`--yes`/`--auto`).
94
+ 2. Ship a **`SKILL.md`** (or an `AGENTS.md` snippet) that tells the agent the tool
95
+ exists, what it’s for, and the handful of commands to run.
96
+ 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.
98
+ zero-install is its own design dimension (§6.7).
99
+ 3. That’s the baseline.
100
+ 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).
102
+
103
+ ### 0.3 The one-paragraph decision guide
104
+
105
+ - **Prompt/instructions only** → ship a `SKILL.md`. (§3, §4)
106
+ - **Project-wide conventions** (build/test/style) → add an `AGENTS.md`. (§2)
107
+ - **You have a CLI** → `SKILL.md` + agent-friendly `--json` CLI. (§0.2, §6)
108
+ - **Many subcommands / a knowledge library** → CLI-as-skill meta-pattern.
109
+ (§6)
110
+ - **A service with no CLI, or you need OAuth / multi-tenant / audit** → MCP server.
111
+ (§7)
112
+ - **Maximum reach across many agents** → layer them: AGENTS.md + SKILL.md + CLI + MCP.
113
+ (§1)
114
+ - **Self-installs into agents & ships evolving skills?** → that is the advanced Tier 2
115
+ pattern (self-upgrade + format versioning); most tools are Tier 1: a pure skill run
116
+ via a **pinned** `npx`/`uvx`. (§6.0)
117
+
118
+ Everything below is reference material.
119
+ You do not need most of it for most tools.
314
120
 
315
- #### 2.5.1 Tiered Skill Files
316
-
317
- Maintain two tiers of skill content for different contexts:
318
-
319
- | Tier | File | Tokens | When Used |
320
- | --- | --- | --- | --- |
321
- | Full | `skill-baseline.md` | ~2000 | Default setup, `skill` command |
322
- | Brief | `skill-brief.md` | ~400 | `skill --brief`, compacted contexts |
323
-
324
- #### 2.5.2 Skill Composition Pattern
325
-
326
- Compose full skill content from separate components:
327
-
328
- ```
329
- ┌─────────────────────────────────────┐
330
- │ claude-header.md (YAML frontmatter) │
331
- ├─────────────────────────────────────┤
332
- │ skill-baseline.md (workflow guide) │
333
- ├─────────────────────────────────────┤
334
- │ <!-- BEGIN SHORTCUT DIRECTORY --> │
335
- │ (dynamically generated tables) │
336
- │ <!-- END SHORTCUT DIRECTORY --> │
337
- └─────────────────────────────────────┘
338
- ```
339
-
340
- **Benefits**:
341
-
342
- - Header can be updated independently from content
343
- - Dynamic sections stay current with available resources
344
- - HTML comment markers enable partial updates without full regeneration
345
-
346
- **Implementation Pattern**:
347
-
348
- ```typescript
349
- async function composeFullSkill(): Promise<string> {
350
- // Load YAML header (Claude Code metadata)
351
- const header = await loadDocContent('install/claude-header.md');
352
-
353
- // Load base skill content
354
- const baseSkill = await loadDocContent('shortcuts/system/skill-baseline.md');
355
-
356
- // Generate dynamic resource directory
357
- const directory = await generateShortcutDirectory();
358
-
359
- // Compose: header + base + dynamic content
360
- let result = header + baseSkill;
361
- if (directory) {
362
- result = result.trimEnd() + '\n\n' + directory;
363
- }
364
-
365
- return result;
366
- }
367
- ```
368
-
369
- **Updatable Regions with HTML Markers**:
370
-
371
- When installing skill files, use HTML comment markers to identify sections that can be
372
- updated independently:
373
-
374
- ```markdown
375
- <!-- BEGIN SHORTCUT DIRECTORY -->
376
- ## Available Shortcuts
377
- ...generated table...
378
- <!-- END SHORTCUT DIRECTORY -->
379
- ```
380
-
381
- This allows the CLI to update just the directory section when resources change, without
382
- regenerating the entire skill file.
383
-
384
- **“DO NOT EDIT” Markers**:
385
-
386
- For generated skill files installed in `.claude/skills/`, insert a “DO NOT EDIT” marker
387
- after the frontmatter to warn users:
388
-
389
- ```markdown
390
- ---
391
- name: mycli
392
- description: ...
393
- ---
394
- <!-- DO NOT EDIT: Generated by mycli setup.
395
- Run 'mycli setup' to update.
396
- -->
397
- # mycli Workflow
398
- ...
399
- ```
400
-
401
- #### 2.5.3 File Management Patterns
121
+ * * *
402
122
 
403
- **Critical Architecture Principle**: CLIs should version control **source files**, not
404
- final installed files.
405
- Different file types have different management patterns.
123
+ ## 1. The Layered Model “Write Once, Integrate Many”
406
124
 
407
- **File Ownership Summary**:
125
+ There is no single integration surface that every agent uses, but the surfaces compose
126
+ cleanly.
127
+ Pick the lowest layer that satisfies your need; add higher layers only for reach
128
+ or capability.
408
129
 
409
- | File | Location | Managed By | User Editable? |
130
+ | Layer | Artifact | What it’s for | Reach (May 2026) |
410
131
  | --- | --- | --- | --- |
411
- | **SKILL.md** | `.claude/skills/mycli/` | CLI (fully) | Never |
412
- | **AGENTS.md** | Repo root | CLI + User (hybrid) | Outside markers |
413
- | **CLAUDE.md** | Repo root | User (optional) | Fully |
414
-
415
- **Pattern 1: SKILL.md (CLI-Managed Only)**
416
-
417
- The SKILL.md file is **entirely managed by the CLI**. Neither users nor agents should
418
- edit it directly—it will be overwritten on the next `setup` run.
132
+ | 1. Project baseline | `AGENTS.md` | Build/test/style/conventions for *this repo* | Codex, Cursor, Copilot, Gemini CLI, Windsurf, Amp, Jules, Goose, Factory, Aider, opencode, pi |
133
+ | 2. Portable capability | `SKILL.md` (Agent Skills) | A reusable, on-demand capability | Claude Code, Codex, Gemini CLI, Copilot (VS Code), Cursor, Windsurf, Cline, pi, 20+ |
134
+ | 3. Execution | A CLI | Efficient, composable tool the agent invokes via shell | Every agent with a shell tool |
135
+ | 4. Structured/remote | MCP server | Services without a CLI; OAuth, multi-tenant, audit | Every major agent except Aider (native); pi via extension |
136
+ | 5. Per-agent polish | `.cursor/rules/*.mdc`, plugin packaging, ACP, etc. | Glob-scoped activation, enterprise distribution, editor discovery | Per-agent |
419
137
 
420
- ```
421
- project-root/.claude/skills/mycli/SKILL.md # Generated, never edit
422
- ```
138
+ **Recommended default for a tool author who wants broad reach**: ship an `AGENTS.md`
139
+ snippet (universal baseline) + a `SKILL.md` (portable capability) + an agent-friendly
140
+ CLI. Add an MCP server only when a CLI can’t serve the need.
141
+ Add agent-specific files last, and only where they buy something.
423
142
 
424
- **How tbd implements this**:
425
- - `tbd setup --auto` composes and installs `.claude/skills/tbd/SKILL.md`
426
- - Inserts “DO NOT EDIT” marker after frontmatter
427
- - Regenerates on each setup with latest CLI content + dynamic shortcut directory
428
-
429
- **Pattern 2: AGENTS.md (Hybrid Management)**
143
+ * * *
430
144
 
431
- The AGENTS.md file uses **HTML comment markers** to separate CLI-managed sections from
432
- user-editable content.
145
+ ## 2. AGENTS.md The Universal Project Baseline
146
+
147
+ `AGENTS.md` is a plain-Markdown file at the repo root that tells any agent how your
148
+ project works: build commands, test commands, conventions, gotchas.
149
+ It is **not** capability-specific — think of it as the README written for agents.
150
+
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).
154
+ Used by **60,000+** open-source projects.
155
+ Canonical spec: [agents.md](https://agents.md).
156
+
157
+ **Discovery & precedence** vary by agent — know your targets:
158
+
159
+ - **Codex**: reads global `~/.codex/AGENTS.md` (or `AGENTS.override.md`), then walks
160
+ from repo root down to the working directory, concatenating one file per directory
161
+ (root→leaf, deeper overrides shallower).
162
+ Combined content is capped at `project_doc_max_bytes` (**default 32 KiB**). It does
163
+ **not** lazy-load nested files when reading child directories (open request).
164
+ - **Cursor** (since v1.6), **Copilot** (since Aug 2025), **Windsurf**, **Gemini CLI**
165
+ (alongside `GEMINI.md`), **Amp** (falls back to `CLAUDE.md`), **Jules**, **Goose**
166
+ (hierarchical scoping), **Factory**, **opencode**, **pi**: all read `AGENTS.md`
167
+ natively.
168
+ - **Claude Code**: as of May 2026 does **not** auto-load `AGENTS.md`; it uses
169
+ `CLAUDE.md`. A common pattern is to symlink `CLAUDE.md → AGENTS.md`, or to maintain
170
+ both. (`tbd` writes a marked section into `AGENTS.md` and lets users keep a separate
171
+ `CLAUDE.md`.)
172
+ - **Aider**: uses `CONVENTIONS.md` but recommends `AGENTS.md` for interoperability.
173
+
174
+ **Author tip**: keep `AGENTS.md` concise (it loads into every turn and competes for
175
+ context).
176
+ Put deep, on-demand material in skills or files the agent can open when needed.
177
+ `AGENTS.override.md` lets a developer override the committed file locally without
178
+ editing it. If a CLI writes a managed `AGENTS.md` block, keep that block as a compact
179
+ bootstrap: name the tool, state the always-on operating rule, and point to commands such
180
+ as `mycli prime`, `mycli skill`, `mycli shortcut --list`, and `mycli guidelines --list`.
181
+ Do not paste the full skill body or generated resource directories into `AGENTS.md`;
182
+ prefer less than 80-150 lines, and shorter is better.
183
+ If `AGENTS.md` already exists without your markers, preserve the file and append a
184
+ compact marked block instead of overwriting user content.
185
+ Version the managed block by carrying the format on the **begin marker line itself** (an
186
+ `fNN` string, like a config-format version) so future setup runs can upgrade old
187
+ generated content without touching user-authored text:
433
188
 
434
189
  ```markdown
435
- # My Project
190
+ <!-- BEGIN MYCLI INTEGRATION format=f02 surface=agents-md -->
191
+ ## mycli
436
192
 
437
- User-written context here... User can edit
193
+ - Run `mycli prime` for current project context.
194
+ - Run `mycli skill` for complete skill instructions.
438
195
 
439
- <!-- BEGIN MYCLI INTEGRATION -->
440
- ...CLI-generated content...
441
196
  <!-- END MYCLI INTEGRATION -->
442
-
443
- More user content... ✓ User can edit
444
197
  ```
445
198
 
446
- **Marker-based updates**:
447
- - CLI owns content **between markers** (`<!-- BEGIN ... -->` to `<!-- END ... -->`)
448
- - User can freely edit content **outside markers**
449
- - `mycli setup --auto` updates only the marked section, preserving user content
450
-
451
- **How tbd implements this**:
452
- ```typescript
453
- // Define marker boundaries
454
- const BEGIN_MARKER = '<!-- BEGIN TBD INTEGRATION -->';
455
- const END_MARKER = '<!-- END TBD INTEGRATION -->';
456
-
457
- // Update only marked section
458
- function updateSection(existingContent: string, newSection: string): string {
459
- const start = existingContent.indexOf(BEGIN_MARKER);
460
- const end = existingContent.indexOf(END_MARKER) + END_MARKER.length;
461
- return existingContent.slice(0, start) + newSection + existingContent.slice(end);
462
- }
463
- ```
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
201
+ current ones. Only the `format=fNN` value changes when the block’s shape changes.
464
202
 
465
- **Pattern 3: CLAUDE.md (Optional User File)**
203
+ * * *
466
204
 
467
- CLAUDE.md is typically **user-managed** for project-specific instructions.
468
- CLIs can support different approaches:
205
+ ## 3. The Agent Skills Standard (SKILL.md)
469
206
 
470
- 1. **Symlink to AGENTS.md** (recommended for identical content):
471
- ```bash
472
- ln -s AGENTS.md CLAUDE.md
473
- ```
207
+ **What it is**: a folder with a `SKILL.md` file (YAML frontmatter + Markdown body), plus
208
+ optional supporting files.
209
+ Created by Anthropic (Dec 2025), published under Apache 2.0 at
210
+ [agentskills.io](https://agentskills.io).
211
+ 280,000+ public skills exist as of early 2026.
474
212
 
475
- 2. **Copy of AGENTS.md** (for separate content):
476
- ```bash
477
- mycli setup --create-claude-md # CLI creates initial copy
478
- ```
213
+ **Standard frontmatter** (portable across agents): `name`, `description`. Optional but
214
+ widely recognized: `license`, `compatibility`, `metadata`, `allowed-tools`. Agents
215
+ silently ignore frontmatter keys they don’t understand, which is what makes a single
216
+ `SKILL.md` portable.
479
217
 
480
- 3. **Separate user-maintained file** (tbd’s approach):
481
- - CLI doesn’t manage it
482
- - Users create/maintain manually
218
+ ### 3.1 Progressive disclosure (the core design principle)
483
219
 
484
- **What to Version Control in Your CLI Package**:
220
+ Skills are loaded in three levels so they cost almost nothing until used:
485
221
 
486
- ```
487
- packages/mycli/
488
- ├── docs/
489
- │ ├── install/
490
- │ │ └── claude-header.md # YAML frontmatter source
491
- │ └── shortcuts/system/
492
- │ ├── skill-baseline.md # ✓ Full skill source
493
- │ └── skill-brief.md # ✓ Brief skill source
494
- └── dist/docs/
495
- └── SKILL.md # ✓ Bundled during build
496
- ```
222
+ | Level | Content | Loaded | Budget |
223
+ | --- | --- | --- | --- |
224
+ | 1. Discovery | `name` + `description` only | Always (in the skill listing) | ~100 tokens |
225
+ | 2. Activation | Full `SKILL.md` body | When invoked (by user or model) | keep < ~5,000 tokens / 500 lines |
226
+ | 3. Execution | Supporting files, scripts, references | On demand, by the model reading the filesystem | unbounded |
497
227
 
498
- **What NOT to Version in CLI Package**:
228
+ **Constraints that matter**: keep the body **under 500 lines**; keep reference files
229
+ **one level deep** from `SKILL.md` (avoid `SKILL.md → a.md → b.md` chains); put bulky
230
+ material (schemas, examples, scripts) in supporting files.
231
+ Scripts execute *outside* the context window — only their output costs tokens, which is
232
+ why bundling a script can be far cheaper than inlining instructions.
499
233
 
500
- - ❌ `.claude/skills/mycli/SKILL.md` (installed per-project)
501
- - ❌ `AGENTS.md` (created in user projects)
502
- - ❌ `CLAUDE.md` (user-managed)
234
+ ### 3.2 Bundled scripts and resources
503
235
 
504
- **User Project Structure** (after `mycli setup --auto`):
236
+ A skill folder can ship executable helpers:
505
237
 
506
238
  ```
507
- user-project/
508
- ├── .claude/skills/mycli/
509
- │ └── SKILL.md # CLI-managed, DO NOT EDIT
510
- ├── AGENTS.md # Hybrid: CLI section + user content
511
- └── CLAUDE.md # Optional: User-managed or symlink
239
+ my-skill/
240
+ ├── SKILL.md
241
+ ├── reference.md # loaded only when the body points to it
242
+ ├── scripts/
243
+ └── transform.py # run by the agent; only stdout enters context
244
+ └── assets/
245
+ └── template.xlsx
512
246
  ```
513
247
 
514
- **Correct Workflows**:
515
-
516
- ```bash
517
- # Setup in user project
518
- npm install -g mycli@latest
519
- cd /path/to/project
520
- mycli setup --auto
521
-
522
- # ✓ Users can edit AGENTS.md outside markers
523
- vim AGENTS.md # Edit user sections, avoid marked regions
524
-
525
- # ✓ Update CLI-managed content by re-running setup
526
- mycli setup --auto # Idempotent, preserves user edits
527
-
528
- # ❌ Don't edit CLI-managed files
529
- vim .claude/skills/mycli/SKILL.md # Will be overwritten!
530
- ```
531
-
532
- **Key Principles**:
533
-
534
- 1. **Single Source of Truth**: Source files in CLI package are canonical
535
- 2. **Clear Ownership Boundaries**: Use markers and “DO NOT EDIT” warnings
536
- 3. **Preserve User Content**: Surgical updates to marked sections only
537
- 4. **Idempotent Setup**: Safe to run `setup --auto` multiple times
538
- 5. **Dynamic Per-Project Content**: Installed files may include project-specific
539
- additions
248
+ In Claude Code, `${CLAUDE_SKILL_DIR}` resolves to the skill’s directory for portable
249
+ script references. Anthropic’s own document skills (docx/pdf/pptx/xlsx) and the
250
+ `skill-creator` skill are good worked examples of this layout.
540
251
 
541
252
  * * *
542
253
 
543
- ## 3. Context Injection Loop Pattern
544
-
545
- One of the most powerful patterns in agent-integrated CLIs is the **context injection
546
- loop**—a recursive architecture where skill documentation references commands, those
547
- commands output more context, and that context references further commands.
548
-
549
- **The Loop Structure**:
550
-
551
- ```
552
- ┌─────────────────────────────────────────────────────────────────────┐
553
- │ SKILL.md (Level 2 - loaded on activation) │
554
- │ ├── Describes capabilities and when to use them │
555
- │ ├── References: "For TypeScript work, run `cli guidelines ts`" │
556
- │ └── References: "To plan features, run `cli shortcut new-plan`" │
557
- └─────────────────────────┬───────────────────────────────────────────┘
558
- │ Agent runs referenced command
559
-
560
- ┌─────────────────────────────────────────────────────────────────────┐
561
- │ Guidelines/Shortcuts (Level 3 - loaded on demand) │
562
- │ ├── Domain-specific knowledge injected into context │
563
- │ ├── References: "Create issues with `cli create`" │
564
- │ ├── References: "For testing patterns, see `cli guidelines tdd`" │
565
- │ └── References: "Use template: `cli template plan-spec`" │
566
- └─────────────────────────┬───────────────────────────────────────────┘
567
- │ Agent follows instructions, may run more commands
568
-
569
- ┌─────────────────────────────────────────────────────────────────────┐
570
- │ Action Commands or More Context │
571
- │ ├── Agent executes actions with full accumulated context │
572
- │ └── Or loads additional guidelines/templates as needed │
573
- └─────────────────────────────────────────────────────────────────────┘
574
- ```
575
-
576
- **Key Properties**:
577
-
578
- | Property | Description |
579
- | --- | --- |
580
- | **Self-directing** | Each context layer tells the agent what to do next |
581
- | **Just-in-time** | Context loads only when relevant, preserving token budget |
582
- | **Composable** | Guidelines can reference other guidelines |
583
- | **Actionable** | Context always leads to concrete actions |
584
-
585
- **Implementation Guidelines**:
586
-
587
- 1. **Every guideline should reference related guidelines**: If typescript-rules mentions
588
- testing, it should reference `cli guidelines testing-rules`
254
+ ## 4. Writing a Great SKILL.md
589
255
 
590
- 2. **Every shortcut should reference action commands**: Shortcuts are workflows—they
591
- must tell the agent which commands to run
256
+ ### 4.1 Frontmatter: standard vs. Claude Code extensions
592
257
 
593
- 3. **Limit chain depth to 3**: SKILL.md Guideline → Sub-guideline is fine; deeper
594
- chains confuse agents
258
+ Only `name` and `description` are required by the open standard.
259
+ Claude Code recognizes a larger set (other agents ignore the extras):
595
260
 
596
- 4. **Use consistent reference syntax**: Always `cli command arg` format, never prose
597
- like “you might want to check the testing guidelines”
261
+ | Field | Standard? | Notes |
262
+ | --- | --- | --- |
263
+ | `name` | ✓ | ≤ 64 chars; lowercase, digits, hyphens; defaults to directory name |
264
+ | `description` | ✓ | ≤ 1,024 chars in the field; see §4.2 |
265
+ | `license`, `compatibility`, `metadata` | ✓ (optional) | Portability/metadata |
266
+ | `allowed-tools` | ✓ (optional) | Pre-grant tools, e.g. `Bash(mycli:*), Read, Write` |
267
+ | `when_to_use` | Claude Code | Appended to `description` in the listing (shares the cap) |
268
+ | `argument-hint`, `arguments` | Claude Code | Autocomplete + `$name`/`$ARGUMENTS` substitution |
269
+ | `disable-model-invocation` | Claude Code | Skill won’t auto-trigger; user/explicit only |
270
+ | `user-invocable` | Claude Code | `false` = background knowledge, hidden from `/` menu |
271
+ | `model`, `effort` | Claude Code | Override model / reasoning effort for the skill’s turn |
272
+ | `context: fork`, `agent` | Claude Code | Run the skill in an isolated subagent |
273
+ | `paths` | Claude Code | Glob patterns that gate auto-activation to matching files |
274
+ | `hooks`, `shell` | Claude Code | Skill-scoped lifecycle hooks; `bash`/`powershell` |
275
+
276
+ Keep your committed `SKILL.md` to the **standard fields plus `allowed-tools`** if you
277
+ want maximum portability; add Claude-specific fields when you’re targeting Claude Code
278
+ specifically.
279
+
280
+ ### 4.2 Description optimization (this is what makes skills activate)
281
+
282
+ Activation is **pure LLM reasoning** — the model reads every installed skill’s `name` +
283
+ `description` and decides what to invoke.
284
+ There is no keyword matcher or embedding step.
285
+ So the description is the single highest-leverage thing you write.
286
+
287
+ **The two-part rule** — every description answers:
598
288
 
599
- **Anti-patterns**:
289
+ 1. **What does it do?** (capabilities)
290
+ 2. **When should it be used?** (explicit triggers, in the user’s words)
600
291
 
601
- ```markdown
602
- # BAD: Vague reference
603
- See the testing documentation for more details.
292
+ ```yaml
293
+ # Anti-pattern
294
+ description: Helps with documents
604
295
 
605
- # GOOD: Explicit command reference
606
- For testing patterns, run `mycli guidelines general-testing-rules`.
296
+ # Preferred
297
+ description: >-
298
+ Analyze Excel spreadsheets, create pivot tables, and export data.
299
+ Use when analyzing .xlsx files, working with tabular data, or when the
300
+ user mentions spreadsheets or Excel.
607
301
  ```
608
302
 
609
- * * *
610
-
611
- ## 4. Agent Mental Model Patterns
612
-
613
- ### 4.1 Agent as Partner, Not Messenger
614
-
615
- The fundamental mental model shift for agent-integrated CLIs is from:
616
- > “Here are commands you can tell the user about”
617
-
618
- To:
619
- > “Here’s how this tool helps you (the agent) serve the user better”
620
-
621
- Structure skill file orientation around capabilities, not commands:
622
-
623
- ```markdown
624
- ## What This Tool Does
625
-
626
- 1. **Issue Tracking**: Track tasks, bugs, features. Never lose discovered work.
627
- 2. **Coding Guidelines**: Best practices the agent can pull in when relevant.
628
- 3. **Workflow Shortcuts**: Pre-built processes for common tasks.
629
- 4. **Templates**: Starting points for common document types.
303
+ **Writing rules**: third person ("Processes files," not “I can help you”); front-load
304
+ the most important trigger keywords in the first ~50 characters (descriptions can be
305
+ truncated in large collections); state both capability and trigger.
306
+
307
+ **Activation reliability** (community 650-trial sandboxed eval — directional, not
308
+ official): vague descriptions ~20% → optimized “Use when…” descriptions ~50% → adding
309
+ 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
311
+ clearer, checklist-style instructions).
312
+
313
+ ### 4.3 The description budget (changed in 2026 verify against your target)
314
+
315
+ Earlier guidance cited a flat ~15K-character budget.
316
+ **Claude Code’s current model is different**:
317
+
318
+ - The skill listing gets a budget of **~1% of the model’s context window** by default
319
+ (`skillListingBudgetFraction`, default `0.01`). When it overflows, the
320
+ least-recently-invoked skills lose their descriptions first.
321
+ - Per-skill listing text (`description` + `when_to_use`) is truncated at **1,536 chars**
322
+ (`maxSkillDescriptionChars`).
323
+ - `SLASH_COMMAND_TOOL_CHAR_BUDGET` overrides the fraction with a fixed character count.
324
+ - `skillOverrides` can set any skill to `on` / `name-only` / `user-invocable-only` /
325
+ `off` without editing the file; `/doctor` reports overflow.
326
+
327
+ **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
329
+ single listing slot instead of N. This is the strongest architectural reason to prefer
330
+ CLI-as-skill once you have more than a handful of capabilities.
331
+
332
+ ### 4.4 Test the skill before publishing
333
+
334
+ Because activation is probabilistic (§4.2) and the body is executable influence, test
335
+ it:
336
+
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?
340
+ - **Explicit invocation**: `/skill-name` (or the agent equivalent) loads and runs
341
+ cleanly.
342
+ - **Sandbox / write-denial**: the skill (and any bundled script) degrades gracefully
343
+ when the agent runs read-only or without network (§5, Codex/Claude Code sandboxes).
344
+ - **CI validation**: lint the frontmatter (required `name`/`description`, length caps)
345
+ and check that every referenced supporting file and link resolves.
346
+ For a CLI-as-skill, also run every `cli guidelines/shortcut/<name>` reference and
347
+ assert it exists.
348
+
349
+ ### 4.5 Keep portable; version deliberately
350
+
351
+ - **Portability**: keep the committed `SKILL.md` to the standard fields (plus
352
+ `allowed-tools`). Put vendor-specific behavior behind clearly labeled sections or
353
+ generated per-agent variants rather than non-standard frontmatter that other agents
354
+ silently drop.
355
+ - **Versioning**: for packaged skills/plugins, use semantic versions, keep a changelog,
356
+ and state compatibility (`compatibility` field / a “requires” note).
357
+ Pin consumers to a commit or version, not a moving tag.
358
+ - **Deprecation**: when removing or renaming a skill, leave a deprecation window with a
359
+ pointer to the replacement; don’t silently delete an activation trigger users rely on.
630
360
 
631
- ## How to Use It to Help Users
632
-
633
- - User describes a bug → create an issue
634
- - User wants a feature → create a plan spec, then break into issues
635
- - Starting a session → check for available work
636
- - Completing work → close issues with clear reasons
637
- ```
361
+ * * *
638
362
 
639
- ### 4.2 Informational Commands Pattern
363
+ ## 5. Per-Agent Integration Reference
364
+
365
+ Targets differ.
366
+ This matrix reflects May 2026; verify against current docs for the agents
367
+ you care about.
368
+
369
+ | Agent | Project file | Skill / rules mechanism | MCP | Hooks | Best integration path |
370
+ | --- | --- | --- | --- | --- | --- |
371
+ | **Claude Code** | `CLAUDE.md` | Agent Skills (`SKILL.md`), `.claude/skills/`; plugins/marketplaces | Yes (stdio + Streamable HTTP) | 29 events | SKILL.md (+ plugin for distribution) |
372
+ | **Codex CLI** | `AGENTS.md` | `SKILL.md` skills + plugins (skills+MCP); `~/.codex/prompts` (deprecated) | Yes (stdio + Streamable HTTP) | Claude-compatible engine (`SessionStart`, `Pre/PostCompact`, `Pre/PostToolUse`, `UserPromptSubmit`, `Stop`, …) | AGENTS.md + skills/plugins + MCP |
373
+ | **Cursor** | `.cursor/rules/*.mdc`, `AGENTS.md` | MDC rules (Always/Auto-glob/Agent-requested/Manual) | Yes | 6 events (incl. `beforeShellExecution`) | AGENTS.md + `.mdc` for glob scoping |
374
+ | **GitHub Copilot** | `.github/copilot-instructions.md`, `AGENTS.md` | `SKILL.md` (VS Code); `.agent.md` custom agents | Yes | `preToolUse`/`postToolUse`/… | SKILL.md + MCP; enterprise-managed plugins |
375
+ | **Gemini CLI** | `GEMINI.md` + `AGENTS.md` | Agent Skills; extensions (bundle hooks) | Yes (stdio + SSE) | ~12 events | AGENTS.md + MCP/extension |
376
+ | **Windsurf** | `.windsurf/rules/*.md` + `AGENTS.md` | Rules with activation modes | Yes (OAuth, Streamable HTTP) | pre-hooks can **block** (exit 2) | AGENTS.md + MCP |
377
+ | **Cline** | `.clinerules/` | Glob-scoped rules; Cline SDK plugins | Yes (mature marketplace) | SDK lifecycle events | `.clinerules` + MCP |
378
+ | **Aider** | `CONVENTIONS.md` / `AGENTS.md` | Conventions file (read-only context) | No native (proxy only) | Git hooks only | AGENTS.md/CONVENTIONS.md |
379
+ | **opencode** | `AGENTS.md` + `opencode.jsonc` | JS/TS plugins; skills dir | Yes | 25+ events, tool interception | Plugin + MCP |
380
+ | **Amp** | `AGENTS.md` (→ `CLAUDE.md`) | Plugins (tools + hooks) | Yes (Sourcegraph MCP + custom) | session/turn/tool | MCP + plugin |
381
+ | **Jules** (Google) | `AGENTS.md` | AGENTS.md only | Yes (curated, since Feb 2026) | — (cloud async) | AGENTS.md + Jules REST API |
382
+ | **Goose** (Block) | `AGENTS.md` | Recipes; 70+ MCP extensions | Yes (deepest) | extension lifecycle | MCP (primary) |
383
+ | **Zed** | `.rules` (reads `.cursorrules`, `CLAUDE.md`) | Rules Library | Yes (extensions) | — | MCP extension + `.rules` |
384
+ | **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 |
386
+
387
+ **Notes on the minimal end (pi)**: pi (Mario Zechner’s `@mariozechner/pi-coding-agent`,
388
+ ~44K stars) ships four tools (read/write/edit/bash) and treats context as a scarce
389
+ 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
391
+ write a TypeScript extension (`pi.registerTool()` / `pi.registerCommand()`). This is a
392
+ clean endorsement of the CLI-as-skill approach: a self-documenting CLI plus a `SKILL.md`
393
+ is exactly what a minimal agent wants.
394
+
395
+ **Codex specifics** (it gained a real skill system in 2026): skills are `SKILL.md`
396
+ folders with the same progressive disclosure.
397
+ 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
399
+ `<dir>/.agents/skills/` from the project root down to cwd), `User`
400
+ (`$HOME/.agents/skills/`), `Admin`, plus plugin roots and `$CODEX_HOME/skills`. So a
401
+ **plain repo-root `.agents/skills/<name>/SKILL.md` is read directly**, no manifest
402
+ required. (The repo path is built by joining `.agents` + `skills` at runtime, so it does
403
+ *not* appear as a contiguous `.agents/skills` literal in the binary — a `strings`-based
404
+ inspection will miss it and see only `.agents/plugins/marketplace.json`; confirm against
405
+ the source, not binary strings.)
406
+ **Plugins** are an *additional* distribution layer (installable units bundling skills +
407
+ MCP servers — 90+ ship with Codex), declared in `.agents/plugins/marketplace.json` (also
408
+ reads `.claude-plugin/marketplace.json`) — useful for *publishing a bundle*, but not
409
+ needed to make a repo-local skill load.
410
+ Codex skills may carry a richer **`agents/openai.yaml`** companion (e.g.
411
+ `interface.display_name`, icons, `dependencies.tools[]`,
412
+ `policy.allow_implicit_invocation`); map the portable
413
+ `name`/`description`/`allowed-tools` onto it only when you specifically want that Codex
414
+ polish — it’s optional.
415
+ An experimental, off-by-default **`external_migration`** feature can import `.claude/`
416
+ config (hooks/MCP/skills) into `.codex/`; don’t depend on it yet, but expect the
417
+ portable duplication to shrink if it stabilizes.
418
+ Operational config lives in `~/.codex/config.toml` (or trusted per-project
419
+ `.codex/config.toml`): `model`, `approval_policy`
420
+ (`untrusted`/`on-request`/`granular`/`never`), `sandbox_mode`
421
+ (`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
423
+ limited to workspace roots and network is off unless explicitly enabled.
424
+ Design your CLI to work read-only where possible and to fail with a clear message when
425
+ sandboxed.
640
426
 
641
- A key architectural pattern is the distinction between **action commands** and
642
- **informational commands**:
427
+ * * *
643
428
 
644
- | Type | Purpose | Example |
429
+ ## 6. CLI-as-Skill (Advanced) One Tool, Many Self-Injecting Commands
430
+
431
+ This is the pattern for a richer tool: a CLI that is itself a skill, exposing many
432
+ capabilities as subcommands while costing a single description slot.
433
+ `tbd` is the reference implementation; **Beads/`bd`** (Steve Yegge), `tbd`’s lineage,
434
+ follows the same shape (subcommands + `AGENTS.md` + `--json` + an optional MCP server).
435
+
436
+ Use this when you have many capabilities, need cross-session state, or want a curated
437
+ knowledge library the agent pulls from.
438
+ For a single capability, the §0 baseline is better — don’t reach for this prematurely.
439
+
440
+ ### 6.0 Two integration tiers — pick the lighter one
441
+
442
+ 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.
451
+ Pinning the version here does **double duty**:
452
+ - **Supply-chain control** — an unpinned runner (`npx pkg`, `uvx --from pkg`) silently
453
+ re-resolves to the latest published version on every run and bypasses any cool-off
454
+ 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.
469
+
470
+ ### 6.1 Two kinds of commands
471
+
472
+ | Type | Purpose | Examples |
645
473
  | --- | --- | --- |
646
- | Action commands | Perform operations | `create`, `close`, `sync` |
647
- | Informational commands | Output guidance for the agent to follow | `shortcut`, `guidelines`, `template` |
648
-
649
- Informational commands don’t perform actions—they display instructions, best practices,
650
- or templates that tell the agent *how* to do something well.
651
- The agent reads the output and follows the guidance.
474
+ | **Action commands** | Perform operations | `create`, `close`, `sync` |
475
+ | **Informational commands** | Output guidance for the agent to *follow* | `guidelines <name>`, `shortcut <name>`, `template <name>` |
652
476
 
653
- ### 4.3 Resource Library Pattern
477
+ Informational commands don’t *do* anything — they print instructions, best practices, or
478
+ templates the agent reads and acts on.
479
+ This is the mechanism behind tbd’s **knowledge-injection-via-subcommands**: rather than
480
+ installing dozens of skills, tbd installs *one* meta-skill and exposes its entire
481
+ library (`tbd guidelines --list`, `tbd guidelines typescript-rules`, …) as commands the
482
+ agent calls just-in-time.
654
483
 
655
- Beyond core functionality, agent-integrated CLIs can bundle **resource libraries**—
656
- collections of guidelines, shortcuts, and templates that agents access on-demand.
484
+ This works well in practice and is the right answer for a many-subcommand CLI because:
657
485
 
658
- **Resource Types**:
486
+ - **Budget**: one listing slot, unbounded resources (vs.
487
+ the per-skill budget in §4.3).
488
+ - **Currency**: resources ship and version with the CLI; `--list` is generated from
489
+ what’s actually installed, so it never goes stale.
490
+ - **Composability**: each resource can reference other commands, forming a
491
+ self-directing context loop (§6.4).
659
492
 
660
- | Resource | Purpose | Access Pattern |
661
- | --- | --- | --- |
662
- | Guidelines | Best practices for specific domains | `cli guidelines <name>` |
663
- | Shortcuts | Step-by-step workflow instructions | `cli shortcut <name>` |
664
- | Templates | Document starting points | `cli template <name>` |
493
+ ### 6.2 The meta-skill composition
665
494
 
666
- **Benefits**:
495
+ tbd’s `skill` command composes the installed `SKILL.md` from parts so the static guide
496
+ and the dynamic catalog stay in sync:
667
497
 
668
- 1. **Self-contained**: Resources ship with the CLI, no external dependencies
669
- 2. **Versionable**: Resource improvements ship with CLI updates
670
- 3. **Discoverable**: `--list` flags help agents find available resources
671
- 4. **Contextual**: Agents query relevant resources just-in-time
672
-
673
- ### 4.4 Resource Directory Pattern
674
-
675
- When documenting available resources, show the **full command to run**, not just the
676
- resource name. This removes friction for agents.
498
+ ```
499
+ ┌─────────────────────────────────────┐
500
+ │ claude-header.md (YAML frontmatter) │ ← name + two-part description + allowed-tools
501
+ ├─────────────────────────────────────┤
502
+ │ skill-baseline.md (workflow guide) │ ← the durable "how to use this tool" body
503
+ ├─────────────────────────────────────┤
504
+ │ <!-- BEGIN SHORTCUT DIRECTORY --> │ ← generated from the live DocCache
505
+ │ | command | title | description | │
506
+ <!-- END SHORTCUT DIRECTORY --> │
507
+ └─────────────────────────────────────┘
508
+ ```
677
509
 
678
- **Anti-pattern** (name only):
510
+ Maintain **two tiers** of skill content: a full `skill-baseline.md` (~2,000 tokens, the
511
+ default and the `skill` command) and a `skill-brief.md` (~400 tokens, for constrained or
512
+ post-compaction contexts).
679
513
 
680
- ```markdown
681
- ## Available Shortcuts
682
- - code-review-and-commit
683
- - create-or-update-pr-simple
684
- - new-plan-spec
685
- ```
514
+ ### 6.3 Resource directories: show the full command
686
515
 
687
- **Preferred pattern** (full command):
516
+ When listing resources, print the command to run, not just a name — it removes a step
517
+ for the agent.
688
518
 
689
519
  ```markdown
690
520
  ## Available Shortcuts
691
-
692
521
  | Command | Purpose | Description |
693
522
  |---------|---------|-------------|
694
- | `mycli shortcut code-review-and-commit` | Commit Code | How to run pre-commit checks and commit |
695
- | `mycli shortcut create-pr` | Create PR | How to create a pull request |
696
- | `mycli shortcut new-plan-spec` | Plan Feature | How to create a planning specification |
697
- ```
698
-
699
- * * *
700
-
701
- ## 5. Setup Flow Patterns
702
-
703
- ### 5.1 Two-Tier Command Structure
704
-
705
- Implement two levels of setup commands:
706
-
707
- | Command | Purpose | Audience |
708
- | --- | --- | --- |
709
- | `mycli setup --auto` | Full setup with auto-detection | Agents, scripts |
710
- | `mycli setup --interactive` | Prompted setup | Humans |
711
- | `mycli init --prefix=X` | Surgical initialization only | Advanced users |
712
-
713
- ### 5.2 Mode Flags Pattern
714
-
715
- Always require explicit mode selection for setup commands:
716
-
717
- ```bash
718
- mycli setup # Shows help, requires mode flag
719
- mycli setup --auto # Non-interactive (for agents)
720
- mycli setup --interactive # Interactive (for humans)
721
- ```
722
-
723
- **Why This Matters**:
724
-
725
- - Prevents agents from getting stuck in interactive prompts
726
- - Ensures humans get guided experience when they want it
727
- - Explicit is better than implicit for setup operations
728
-
729
- ### 5.3 Setup Idempotency Requirements
730
-
731
- **Setup MUST be idempotent**—safe to run repeatedly without side effects or errors.
732
- This is critical because:
733
-
734
- - Agents may run setup multiple times to refresh configuration
735
- - Users may run setup after CLI updates to get new features
736
- - Setup may be called automatically via scripts or CI
737
-
738
- **Idempotency Patterns**:
739
-
740
- 1. **Hook Deduplication**: When merging hooks into `.claude/settings.json`, filter out
741
- existing hooks before adding new ones:
742
-
743
- ```typescript
744
- // Filter out existing CLI hooks before merging
745
- const existingHooks = currentSettings.hooks.SessionStart || [];
746
- const filtered = existingHooks.filter(
747
- (entry) => !entry.hooks?.some((h) => h.command?.includes('mycli'))
748
- );
749
- mergedHooks.SessionStart = [...filtered, ...newHooks];
750
- ```
751
-
752
- 2. **Skill File Regeneration**: Always regenerate skill files with fresh content on each
753
- setup run. Don’t try to update in place—overwrite:
754
-
755
- ```typescript
756
- // Always regenerate skill file
757
- const skillContent = await composeFullSkill();
758
- await writeFile(skillPath, skillContent); // Overwrite, don't append
759
- ```
760
-
761
- 3. **Legacy Cleanup**: Remove deprecated patterns on each run:
762
-
763
- ```typescript
764
- // Clean up old hook patterns
765
- const oldScripts = ['setup-mycli.sh', 'ensure-mycli.sh'];
766
- for (const script of oldScripts) {
767
- await rm(join(projectDir, '.claude/scripts', script)).catch(() => {});
768
- }
769
- ```
770
-
771
- 4. **Directory Creation**: Use `mkdir -p` style recursive creation that succeeds if
772
- directory already exists:
773
-
774
- ```typescript
775
- await mkdir(dirname(skillPath), { recursive: true });
776
- ```
777
-
778
- **Testing Idempotency**:
779
-
780
- Run setup twice and verify:
781
- - No duplicate hooks in settings.json
782
- - Skill file content is identical on both runs (except timestamps)
783
- - No error messages about existing files/configs
784
- - All features work correctly after both runs
785
-
786
- ### 5.4 Never Guess User Preferences
787
-
788
- For configuration values that are matters of user taste (not technical requirements),
789
- **never guess or auto-detect**. Always ask the user.
790
-
791
- **Examples of preference values**:
792
- - Project prefixes/abbreviations
793
- - Naming conventions
794
- - Style choices
795
-
796
- * * *
797
-
798
- ## 6. Agent Integration Patterns
799
-
800
- ### 6.1 Claude Code Hooks
801
-
802
- Configure Claude Code hooks for automatic context management:
803
-
804
- **Global Hooks** (`~/.claude/settings.json`):
805
-
806
- ```json
807
- {
808
- "hooks": {
809
- "SessionStart": [{
810
- "matcher": "",
811
- "hooks": [{ "type": "command", "command": "mycli prime" }]
812
- }],
813
- "PreCompact": [{
814
- "matcher": "",
815
- "hooks": [{ "type": "command", "command": "mycli prime" }]
816
- }]
817
- }
818
- }
819
- ```
820
-
821
- **Alternative PreCompact Hook Pattern (Optional)**:
822
-
823
- For CLIs where token efficiency is critical, consider using `skill --brief` instead of
824
- `prime` in the PreCompact hook:
825
-
826
- ```json
827
- "PreCompact": [{
828
- "matcher": "",
829
- "hooks": [{ "type": "command", "command": "mycli skill --brief" }]
830
- }]
523
+ | `mycli shortcut code-review` | Commit code | Pre-commit checks and commit flow |
524
+ | `mycli shortcut new-plan-spec` | Plan a feature | Create a planning specification |
831
525
  ```
832
526
 
833
- **Tradeoffs**:
834
- - More token-efficient (~~400 tokens vs ~~800-1200 for `prime`)
835
- - Pure skill content without status/dashboard noise
836
- - ✗ No project-specific status information before compaction
837
- - ✗ Agent loses current state context
527
+ Back resource lookup with a **path-ordered cache** so project- and user-level files can
528
+ shadow built-ins (like `$PATH`): project `.mycli/docs/` user `~/.mycli/docs/`
529
+ bundled. This lets teams customize without forking.
838
530
 
839
- Use `skill --brief` when the condensed workflow rules are sufficient, or `prime` when
840
- current project status is valuable for context restoration.
531
+ ### 6.4 The context-injection loop
841
532
 
842
- **Project Hooks** (`.claude/settings.json`):
533
+ The payoff of informational commands is a self-reinforcing chain:
843
534
 
844
- ```json
845
- {
846
- "hooks": {
847
- "PostToolUse": [{
848
- "matcher": "Bash",
849
- "hooks": [{
850
- "type": "command",
851
- "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/closing-reminder.sh"
852
- }]
853
- }]
854
- }
855
- }
856
535
  ```
857
-
858
- ### 6.2 PostToolUse Hook with JSON Parsing
859
-
860
- PostToolUse hooks receive JSON input describing the tool invocation.
861
- Use bash scripts with jq to parse and conditionally respond.
862
-
863
- ```bash
864
- #!/bin/bash
865
- input=$(cat)
866
- command=$(echo "$input" | jq -r '.tool_input.command // empty')
867
-
868
- # Trigger on specific patterns
869
- if [[ "$command" == git\ push* ]] || [[ "$command" == *"&& git push"* ]]; then
870
- if [ -d ".mycli" ]; then
871
- mycli closing
872
- fi
873
- fi
874
- exit 0
536
+ SKILL.md ── "for TypeScript work, run `mycli guidelines typescript-rules`"
537
+ └──▶ guideline ── "create issues with `mycli create`; for tests see `mycli guidelines testing`"
538
+ └──▶ action commands / more guidelines, loaded just-in-time
875
539
  ```
876
540
 
877
- ### 6.3 Help Structure for Agent Discovery
878
-
879
- Agents need clear signals about how to get started with your CLI. Structure help output
880
- to make setup commands and context restoration prominent.
881
-
882
- **Pattern 1: Help Epilog with IMPORTANT Section**
883
-
884
- Add prominent sections at the bottom of `--help` output:
541
+ Rules: reference commands **explicitly** (`mycli command arg`, never “see the docs”);
542
+ **limit chain depth to 3**; make every layer end in a concrete action.
543
+
544
+ ### 6.5 Making the CLI agent-friendly
545
+
546
+ - **`--json` on every command** one output path that renders human or machine output.
547
+ - **`--brief`/`--quiet`** for constrained contexts and scripts.
548
+ - **Idempotent `setup --auto`** (non-interactive) vs.
549
+ `setup --interactive` for humans; never let an agent get stuck on a prompt.
550
+ - **Actionable errors** that include the next command to run.
551
+ - **Discoverable help**: an `IMPORTANT:` epilog pointing at a context-restore command
552
+ (e.g., `mycli prime`), and a “Getting Started” one-liner.
553
+ - **A `prime` command** (dashboard + status + rules) for session start and post-compact,
554
+ distinct from `skill` (pure documentation).
555
+
556
+ ### 6.6 Distribution & multi-agent install
557
+
558
+ A CLI can install itself into multiple agents from one `setup` run.
559
+ Use the portable Agent Skills location as the primary project skill surface and mirror
560
+ only where a target agent requires it:
561
+
562
+ - `.agents/skills/<tool>/SKILL.md` — the portable project skill.
563
+ **Be precise about who reads this path natively vs.
564
+ who reaches it via an installer**, rather than claiming a flat “all agents read it”:
565
+ - **Scans repo-root `.agents/skills/` natively** (verified): **Codex** (source above)
566
+ and **Gemini CLI** (documents `.agents/skills/` as a workspace/user alias).
567
+ **pi** / **OpenCode** scan project Agent Skills dirs.
568
+ - **Reached via the cross-agent installer**: `npx skills add` copies the same
569
+ `SKILL.md` into `.agents/skills/` and **symlinks it into each agent’s own dir**
570
+ (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
572
+ Cursor/Copilot/…” means “via skills.sh”, not “Cursor scans `.agents/skills/`
573
+ itself.”
574
+ - **Claude Code does NOT scan `.agents/`** at all — it reads only `.claude/skills/`
575
+ (next bullet), which is why the mirror is required, not optional.
576
+ - When in doubt, verify against the agent’s source/docs before asserting native
577
+ scanning.
578
+ - `.claude/skills/<tool>/SKILL.md` — Claude Code compatibility mirror (required: Claude
579
+ 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
582
+ text or skill content.
583
+
584
+ tbd should write a CLI-managed `SKILL.md` to `.agents/skills/tbd/`, mirror it to
585
+ `.claude/skills/tbd/`, and maintain a **marker-bounded section** in `AGENTS.md` (which
586
+ also feeds Cursor, Codex, and Factory), preserving user content outside the markers:
885
587
 
886
- ```bash
887
- $ mycli --help
888
- Usage: mycli [options] [command]
889
- ...
588
+ ```markdown
589
+ <!-- BEGIN MYCLI INTEGRATION format=f02 surface=agents-md -->
590
+ ## mycli
890
591
 
891
- IMPORTANT:
892
- Agents unfamiliar with mycli should run `mycli prime` for full context.
592
+ - Run `mycli prime` for current project context.
593
+ - Run `mycli skill` for the full reusable skill instructions.
594
+ - Run `mycli shortcut --list` and `mycli guidelines --list` for on-demand resources.
893
595
 
894
- Getting Started:
895
- npm install -g mycli@latest && mycli setup --auto --prefix=<name>
596
+ <!-- END MYCLI INTEGRATION -->
896
597
  ```
897
598
 
898
- **Implementation with Commander.js**:
599
+ **Quick recipe for a new project** (portable-first, both agents covered):
899
600
 
900
- ```typescript
901
- program
902
- .name('mycli')
903
- .description('Brief description')
904
- .addHelpText('after', `
905
- IMPORTANT:
906
- Agents unfamiliar with mycli should run \`mycli prime\` for full context.
907
-
908
- Getting Started:
909
- npm install -g mycli@latest && mycli setup --auto --prefix=<name>
910
- `);
601
+ ```text
602
+ .agents/skills/<tool>/SKILL.md # canonical portable skill (Codex, Gemini, Cursor, …)
603
+ .claude/skills/<tool>/SKILL.md # identical copy — Claude Code mirror
604
+ AGENTS.md # compact marked block (see above), every agent reads it
605
+ CLAUDE.md # symlink → AGENTS.md, or a short separate file (Claude only)
606
+ scripts/agent/<tool>-session.sh # shared hook script, referenced by both agents
607
+ .codex/hooks.json # Codex hook entry shared script (or inline [hooks])
608
+ .claude/settings.json # Claude hook entry → same shared script
911
609
  ```
912
610
 
913
- **Pattern 2: Context Recovery Prompt**
914
-
915
- When the CLI runs without arguments, don’t just show help—prompt for context:
611
+ Copy (don’t symlink) the `SKILL.md` payload to both skill paths — symlinks behave
612
+ unevenly across Windows, sandboxes, and remote worktrees.
613
+ Claude Code does **not** auto-load `AGENTS.md` (it reads `CLAUDE.md`), so a multi-agent
614
+ project needs both.
615
+
616
+ **File-ownership rules** — distinguish three categories:
617
+
618
+ - **Project instruction files** (`AGENTS.md`, `CLAUDE.md`): *commit these*. They hold
619
+ human-authored project norms (§2). A CLI may own a **marker-bounded section** inside
620
+ `AGENTS.md` (regenerated on setup) while the user owns everything outside the markers.
621
+ - **Fully generated install artifacts** (`.agents/skills/<tool>/SKILL.md`,
622
+ `.claude/skills/<tool>/SKILL.md`, generated hook scripts, and the like): CLI-owned;
623
+ mark them “DO NOT EDIT.” Pick **one of two modes** and be consistent:
624
+ - **Commit + dogfood** (what `tbd` does): check the generated artifacts in, and add a
625
+ **drift test** that regenerates them and fails if they differ.
626
+ Pros: browsable on GitHub / skills.sh, the repo demonstrates its own output,
627
+ reviewers see changes.
628
+ Con: a regeneration shows up as a diff to commit.
629
+ Keep generated output deterministic and formatter-stable (below) or the drift
630
+ test/commits will churn.
631
+ - **Gitignore + regenerate** (what `metaproc` does): add `.../skills/*/SKILL.md` to
632
+ `.gitignore` and let `setup`/`--install` (re)create them on demand.
633
+ Pros: zero commit churn, no drift to guard.
634
+ Con: not browsable in the repo, and no committed artifact to diff in review.
635
+ With this mode a format-version stamp matters less (there is no committed artifact
636
+ for an older tool to clobber).
637
+ - **Source files** in the CLI package (header, baseline, brief): the canonical inputs —
638
+ always version-controlled.
639
+
640
+ Make setup idempotent: dedupe hooks before merging, overwrite generated skills rather
641
+ than patching them, update only the marked section of `AGENTS.md`, and clean up legacy
642
+ files each run.
643
+
644
+ **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
646
+ unstable ordering. This is what makes the artifact diff-stable, drift-testable, and safe
647
+ 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
650
+ frontmatter block mid-document).
651
+ Because Codex and Claude Code now share a hook event schema (§8), prefer **one shared
652
+ script referenced by two thin per-agent configs**: keep the logic in a neutral location
653
+ (e.g. `scripts/agent/<tool>-session.sh`) and reference it from both
654
+ `.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.
661
+ Treat generated integration files like config migrations:
662
+
663
+ - 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
665
+ existing config/data-format version as the single source of truth (tbd stamps the
666
+ 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.
669
+ - Stamp the format on the generated artifact itself: on the `AGENTS.md` begin-marker
670
+ line (`<!-- BEGIN … format=fNN … -->`), the skill “DO NOT EDIT” marker, script
671
+ headers, or an equivalent hook signature.
672
+ Prefer one marker line over a separate metadata comment.
673
+ - On every `setup`/`setup --auto` run, **self-upgrade in place, safely and
674
+ idempotently**: detect older formats and rewrite only the tool-owned regions (managed
675
+ `AGENTS.md` block, generated skills, tool-owned hooks, `.codex/` config), re-running
676
+ cleanly with no change when already current.
677
+ - Treat old marked `AGENTS.md` blocks with no metadata as legacy generated content and
678
+ replace only the managed region.
679
+ - Detect tool-owned hook entries by command/path/signature, replace only those entries,
680
+ and preserve unrelated user hooks.
681
+ - **Forward-compatibility guard.** When the tool finds a generated artifact whose
682
+ `integration-format` is **newer** than the running version understands, it must **stop
683
+ and tell the user to upgrade the tool** (e.g. `npm install -g get-tbd@latest`) rather
684
+ than overwrite or downgrade it.
685
+ This is what makes pinning safe for teams: a teammate on an older version fails loudly
686
+ instead of silently clobbering a newer managed block.
687
+ - Print an itemized setup summary: current, installed, upgraded, removed legacy, skipped
688
+ by config, user-owned/unmarked, and format-too-new (upgrade required).
689
+ - Test upgrades from at least the previous shipped setup layout plus partial installs,
690
+ and test that a too-new format string produces the upgrade-the-tool error.
691
+
692
+ Recommended setup flags:
693
+
694
+ | Flag | Purpose |
695
+ | --- | --- |
696
+ | `--auto` | Detect and refresh relevant project-local integrations |
697
+ | `--all` | Install every supported project-local integration surface |
698
+ | `--claude` | Install or refresh the Claude Code surface (skill mirror + hooks) |
699
+ | `--codex` | Install or refresh the Codex surface (`AGENTS.md` block + `.codex` hooks) |
700
+ | `--skip-<surface>` | Suppress a surface (e.g. `--skip-claude`) that auto-detection would otherwise update |
701
+
702
+ Use a true tri-state: with no targeting flag a surface is detection-based; a positive
703
+ 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.
706
+ (`tbd` itself ships `--all`, `--claude`, `--codex`, `--skip-claude`, `--skip-codex`;
707
+ `AGENTS.md` installs as part of the Codex surface.)
708
+
709
+ Keep project-local setup separate from global/user setup.
710
+ Writing `~/.codex/AGENTS.md`, `~/.agents/skills/`, or `~/.claude/skills/` should be an
711
+ explicit global install command or documented manual step, not something `setup --auto`
712
+ does silently.
713
+
714
+ #### 6.6.1 Extensible skill registries (let other packages contribute skills)
715
+
716
+ A single bundled skill is enough for most tools.
717
+ 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.
720
+
721
+ The clean implementation is the host language’s plugin mechanism:
722
+
723
+ - **Python**: an entry-point group.
724
+ The host defines a group (e.g. `[project.entry-points."mytool.skills"]`); each plugin
725
+ package points an entry at a factory that returns a skill spec; the host enumerates
726
+ them with `importlib.metadata`. (`metaproc` does exactly this: a `metaproc.skills`
727
+ group, with `metaproc skill --list` / `--install` composing each registered skill.
728
+ Its `earnings_predictions` package registers an `eia-batch` skill that the core tool
729
+ never hard-codes.)
730
+ - **Node/TypeScript**: a documented `package.json` key or a registration API a plugin
731
+ calls on load.
732
+
733
+ Keep each registered skill a **spec** (name, two-part description, `allowed-tools`, a
734
+ baseline source, and an optional dynamic catalog function) and run them all through the
735
+ **same** `compose` + `--install` path, so every skill — first-party or third-party —
736
+ gets identical frontmatter, the `DO NOT EDIT`/format marker, and deterministic output.
737
+ This keeps the “one tool, many self-injecting commands” model open for extension without
738
+ the core tool taking a dependency on every plugin.
739
+
740
+ ### 6.7 Making the CLI available: global install vs. zero-install
741
+
742
+ A separate design dimension from §6.6 (how the CLI installs *itself into agents*) is how
743
+ the CLI **binary** is made available so the skill can invoke it.
744
+ Decide this explicitly and state the chosen invocation in `SKILL.md`/`AGENTS.md`.
745
+
746
+ **The two ends of the spectrum** (plus a useful middle):
747
+
748
+ | Approach | How | Best when |
749
+ | --- | --- | --- |
750
+ | **Global install** | `npm i -g pkg`, `uv tool install pkg`, `pipx install pkg`, Homebrew, prebuilt binary | Persistent dev machines; offline/perf-sensitive use; the **project pins the version** (in `package.json`/lockfile or a tool manifest) so every run is identical |
751
+ | **Zero-install runner** | `npx pkg@x.y.z`, `bunx`, `pnpm dlx`, `uvx pkg@x.y.z`, `pipx run`, `go run mod@x.y.z` | Ephemeral/cloud agents (Claude Code Cloud, CI, fresh containers) where nothing persists; broad reach with no setup |
752
+ | **Persistent-on-first-use** | `uv tool install` then `uvx pkg` reuses it; a `SessionStart` bootstrap that installs once if absent | You want zero-install ergonomics *and* warm-start speed within a session |
753
+
754
+ **Trade-offs**
755
+
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
758
+ 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;
763
+ ideal default for portability.
764
+ *Cons*: cold-start download/cache cost on first call (uvx cold ≈ 1s, cached ≈ tens of
765
+ ms; npx similar), needs network, and an **unpinned** invocation (`npx pkg`, `uvx pkg`)
766
+ silently pulls the newest release.
767
+
768
+ **Cloud / ephemeral bootstrap.** If you choose global install but target cloud agents,
769
+ ship a **`SessionStart` hook** (or an `ensure-installed` script) that installs/updates
770
+ the CLI if absent before first use.
771
+ tbd does exactly this: a `tbd-session.sh` hook ensures the `tbd` CLI is present, then
772
+ runs `tbd prime`. Without a bootstrap, a globally-installed CLI referenced by a skill
773
+ will fail on a fresh cloud session.
774
+
775
+ **Pin the version (security).** Whichever you choose, the skill’s referenced invocation
776
+ 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:
916
778
 
917
779
  ```bash
918
- $ mycli
919
- Usage: mycli [command] [options]
920
- ...
921
- Tip: Run `mycli prime` to restore full workflow context.
780
+ uvx mytool@1.4.2 ... # not `uvx mytool`
781
+ npx mytool@1.4.2 ... # not `npx mytool@latest`
922
782
  ```
923
783
 
924
- **Pattern 3: Setup Command Prominence**
925
-
926
- Ensure `setup` appears in a dedicated “Setup & Configuration” category in help output,
927
- not buried in a long alphabetical list:
784
+ Global installs get the same guarantee from the lockfile/manifest; zero-install gets it
785
+ only from an explicit `@version`. Generated skill instructions should use a local-first,
786
+ pinned fallback chain:
787
+
788
+ 1. Try `mycli <command>` if it is already on `PATH`.
789
+ 2. Fall back to a version-pinned runner:
790
+ - npm: `npx --yes my-package@<version> mycli <command>`
791
+ - uv: `uvx --from my-package@<version> mycli <command>`
792
+ - pipx: `pipx run my-package==<version> mycli <command>`
793
+ - Go: `go run module/path@<version> <args>`
794
+ 3. If the local command and pinned fallback both fail, stop and tell the user how to
795
+ install the CLI.
796
+
797
+ Never put an unpinned network runner such as `uvx --from my-package` or `npx my-package`
798
+ in generated skill instructions unless the user explicitly opts into that risk.
799
+ This is a supply-chain control, not just ergonomics: an unpinned runner re-resolves to
800
+ the latest published version on every run and bypasses any cool-off window.
801
+ See `tbd guidelines supply-chain-hardening` for the cross-ecosystem policy.
802
+
803
+ **Current tooling (May 2026)**
804
+
805
+ - **Node / TypeScript**: zero-install via `npx <pkg>@<ver>` (`-y` to skip the prompt),
806
+ `bunx`, `pnpm dlx`, or `deno run`; persistent via `npm i -g` / a project
807
+ devDependency.
808
+ - **Python**: `uvx --from <pkg>@<ver> <entrypoint>` (= `uv tool run`, bundled with
809
+ Astral’s `uv`, Rust-fast, no Python prereq) or `pipx run <pkg>==<ver>`; persistent via
810
+ `uv tool install` / `pipx install`. `uvx` reuses a persistent install if one exists.
811
+ - **Go**: `go run <module>@<ver>` (compiles on the fly) or `go install`.
812
+ - **Rust**: no first-class zero-install runner — ship **prebuilt binaries** (GitHub
813
+ releases + a `curl … | sh` installer) or `cargo binstall`; `cargo install` compiles.
814
+ - **Cross-language**: a prebuilt binary + install script, or a container image (Docker
815
+ is emerging as the production-grade distribution for MCP servers).
816
+
817
+ This mirrors how the ecosystem ships agent tooling today: **MCP servers** are most often
818
+ referenced as `command: npx <pkg>` (Node) or `command: uvx <pkg>` (Python) in agent
819
+ configs; **CLIs** like Beads offer `brew` / `npm -g` / `curl` installers, while tbd uses
820
+ `npm -g` plus the bootstrap hook above.
821
+
822
+ **Recommendation**: default the skill to a **pinned zero-install invocation**
823
+ (`uvx`/`npx <pkg>@<version>`) for maximum reach across ephemeral and cloud agents; offer
824
+ **global install + a `SessionStart` bootstrap** as the optimization for persistent
825
+ environments where the project wants lockfile-managed versions and warm-start speed.
826
+
827
+ ### 6.8 Publishing & discovery — make the skill installable
828
+
829
+ Most “skill registries” (May 2026) are **GitHub-repo discoverers, not gated app
830
+ stores**. You don’t submit a form; you put a spec-compliant `SKILL.md` in a public repo
831
+ and the ecosystem finds it.
832
+ The landscape worth targeting:
833
+
834
+ - **`skills.sh` / `npx skills add <owner/repo>`** (Vercel) — the cross-agent “npm for
835
+ skills”: one command installs into `.agents/skills/` + symlinks per agent (Claude
836
+ Code, Codex, Cursor, Copilot, Gemini, …). No review; ranked by install telemetry.
837
+ **This is the highest-leverage target** and needs zero extra infra.
838
+ - **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 + discoverable.
841
+ - **Plugin marketplaces** — `.claude-plugin/marketplace.json` (Claude Code, the official
842
+ Anthropic channel) and `.agents/plugins/marketplace.json` (Codex; Codex reads both).
843
+ These are *plugin* channels: bundles of skills + MCP + hooks + commands.
844
+ They are **only for publishing a bundle** — a repo-local skill already loads from
845
+ `.claude/skills/` (Claude Code) and `.agents/skills/` (Codex) **without any
846
+ manifest**, so don’t add one just to be discovered.
847
+ If you *do* emit a `marketplace.json` / `.codex-plugin/plugin.json`, treat it like any
848
+ generated artifact (§6.6): point it at the same generated `SKILL.md` payload (no body
849
+ duplication), mark it `DO NOT EDIT`, make it deterministic so re-install is a no-op,
850
+ and pick the same commit-vs-gitignore mode as the skill it references.
851
+
852
+ **The simplest publishable structure** (works for all of the above at once):
928
853
 
929
854
  ```
930
- Setup & Configuration:
931
- init [options] Initialize mycli in a repository
932
- setup [options] Configure mycli integration with editors and tools
933
- config Manage configuration
855
+ your-repo/
856
+ └── skills/
857
+ └── <name>/
858
+ └── SKILL.md # spec frontmatter: name + two-part description
934
859
  ```
935
860
 
936
- **Why This Matters**:
937
-
938
- - Agents often lose context after compaction or in new sessions
939
- - Prominent `prime` references help agents restore workflow rules
940
- - Clear setup commands help agents guide users through installation
941
- - “IMPORTANT” section is scanned even when full help is ignored
861
+ `skills/<name>/SKILL.md` at the repo root is the universal discovery location
862
+ (`npx skills add`, the indexers, and agent installers all scan it).
863
+ That’s the whole publishing step push it public.
864
+
865
+ **For a CLI-backed skill** (the §6 pattern), one extra rule matters: a registry installs
866
+ **only the Markdown**, never your binary.
867
+ So the published `SKILL.md` must **bootstrap its own CLI** — lead with a pinned install
868
+ line (`npm i -g <pkg>@<ver>` / `uvx --from <pkg>@<ver>`) and a one-time `setup`, and
869
+ have commands degrade with a clear “install the CLI first” message.
870
+ Treat the registry copy as a **landing page that installs the engine**, not the engine
871
+ itself. Generate this distribution `SKILL.md` from the same source as your in-repo skill
872
+ (so it can’t drift), and validate it with `npx skills-ref validate skills/<name>` before
873
+ pushing.
874
+
875
+ `tbd` does exactly this: `skills/tbd/SKILL.md` is generated at build time from the same
876
+ baseline, carries `name: tbd` + a trigger-rich description, and opens with the
877
+ `npm install -g get-tbd` + `tbd setup --auto` bootstrap — so `npx skills add jlevy/tbd`
878
+ gives an agent a working landing page, and `tbd setup` then upgrades it to the full
879
+ multi-agent install (§6.6).
942
880
 
943
881
  * * *
944
882
 
945
- ## 7. Task Management Integration Patterns
946
-
947
- ### 7.1 Task Tracking Strategy Selection
883
+ ## 7. CLI vs MCP vs Skill — Choosing the Surface
948
884
 
949
- Agent-integrated CLIs often need to track work across sessions.
950
- The key architectural decision is **where task state lives** and **how complex the
951
- tracking needs to be**.
885
+ These are complementary, not competing.
886
+ Pick by need:
952
887
 
953
- **Three Strategies**:
954
-
955
- | Strategy | State Location | Complexity | Use Case |
956
- | --- | --- | --- | --- |
957
- | **Ephemeral** | None | Minimal | Quick calculations, queries, one-shot tasks |
958
- | **Session-local** | In-memory or temp file | Low | Multi-step tasks within a single session |
959
- | **Persistent** | Git-tracked files | Medium-High | Multi-session projects, team collaboration |
960
-
961
- **Decision Framework**:
962
-
963
- ```
964
- Is the task done in one command?
965
- → Yes: Ephemeral (no tracking needed)
966
- → No: Does it span multiple sessions?
967
- → No: Session-local (agent's internal todo list)
968
- → Yes: Persistent (tbd integration or equivalent)
969
- ```
970
-
971
- ### 7.2 Agent-Aware Task Patterns
972
-
973
- **Pattern 1: Auto-Discovery of Work**
974
-
975
- Include a “what should I work on?”
976
- command:
977
-
978
- ```bash
979
- mycli ready # Show tasks ready to work
980
- mycli next # Suggest the highest-priority task
981
- ```
982
-
983
- **Pattern 2: Context-Preserving Task Creation**
984
-
985
- When creating tasks from agent context, preserve relevant information:
986
-
987
- ```bash
988
- mycli task create "Fix authentication bug" \
989
- --context "User reported login fails after password reset" \
990
- --related-files "src/auth/login.ts,src/auth/reset.ts"
991
- ```
992
-
993
- **Pattern 3: Session Boundary Enforcement**
994
-
995
- The CLI should remind agents to handle tasks at session end:
996
-
997
- ```markdown
998
- ## Session Closing Protocol
999
-
1000
- Before completing a session:
1001
- 1. Close or update all tasks you worked on
1002
- 2. Create tasks for any discovered work
1003
- 3. Sync task state: `mycli sync`
1004
- ```
1005
-
1006
- * * *
1007
-
1008
- ## 8. Dynamic Generation Patterns
1009
-
1010
- ### 8.1 Dynamic Skill and Resource Directory Generation
1011
-
1012
- Rather than maintaining static content that can become stale, generate skill files and
1013
- resource directories dynamically at runtime from source components and installed
1014
- documents.
1015
-
1016
- **Pattern 1: Skill Composition from Multiple Sources**
1017
-
1018
- Compose skill content from separate files for maintainability:
1019
-
1020
- ```typescript
1021
- async function composeFullSkill(): Promise<string> {
1022
- // 1. Load YAML header (Claude Code metadata)
1023
- const header = await loadDocContent('install/claude-header.md');
1024
-
1025
- // 2. Load base skill workflow content
1026
- const baseSkill = await loadDocContent('shortcuts/system/skill-baseline.md');
1027
-
1028
- // 3. Generate dynamic resource directory from current docs
1029
- const directory = await generateShortcutDirectory();
1030
-
1031
- // 4. Compose final skill: header + base + dynamic content
1032
- let result = header + baseSkill;
1033
- if (directory) {
1034
- result = result.trimEnd() + '\n\n' + directory;
1035
- }
1036
-
1037
- return result;
1038
- }
1039
- ```
1040
-
1041
- **Pattern 2: Resource Directory Generation**
1042
-
1043
- Generate tables of available resources from loaded documents:
1044
-
1045
- ```typescript
1046
- async function generateShortcutDirectory(): Promise<string> {
1047
- const shortcuts = await docCache.listDocuments('shortcuts');
1048
- const rows = shortcuts.map(doc => {
1049
- const meta = doc.frontmatter;
1050
- return `| ${doc.name} | ${meta.title} | ${meta.description} |`;
1051
- });
1052
-
1053
- // Wrap in HTML markers for incremental updates
1054
- return [
1055
- '<!-- BEGIN SHORTCUT DIRECTORY -->',
1056
- '## Available Shortcuts',
1057
- '',
1058
- '| Name | Title | Description |',
1059
- '| --- | --- | --- |',
1060
- ...rows,
1061
- '<!-- END SHORTCUT DIRECTORY -->'
1062
- ].join('\n');
1063
- }
1064
- ```
1065
-
1066
- **Pattern 3: Incremental Updates with HTML Markers**
1067
-
1068
- Use HTML comment markers to identify sections that can be updated independently:
1069
-
1070
- ```markdown
1071
- <!-- BEGIN SHORTCUT DIRECTORY -->
1072
- ## Available Shortcuts
1073
- | Name | Description |
888
+ | Need | Surface |
1074
889
  | --- | --- |
1075
- | code-review | Run pre-commit checks and commit |
1076
- | new-plan-spec | Create a planning specification |
1077
-
1078
- <!-- END SHORTCUT DIRECTORY -->
1079
- ```
1080
-
1081
- This allows updating just the directory section when resources change, without
1082
- regenerating the entire skill file.
890
+ | Prompt/instructions, portable | **SKILL.md** |
891
+ | Local processing, composable, you have/can build a CLI | **CLI** |
892
+ | Service with no CLI; OAuth, multi-tenant, audit, remote | **MCP server** |
893
+ | Both local convenience and structured/remote access | **CLI + MCP** |
894
+
895
+ **Why CLI usually wins when one exists**: benchmarks (2026) put a CLI at ~100% task
896
+ reliability and ~1.3K–8.7K tokens, vs.
897
+ MCP at ~72% reliability and ~32K–82K tokens — roughly **17× cheaper** at scale — because
898
+ LLMs already know common CLI usage and no tool schema is injected.
899
+ Use MCP when there’s no CLI to lean on or you need its auth/permission machinery.
900
+
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.
907
+
908
+ **Code execution with MCP** ("Code Mode"): instead of exposing many MCP tools as direct
909
+ 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.
911
+ Worth it when an MCP server exposes *many* tools; overkill for one.
1083
912
 
1084
- **Pattern 4: “DO NOT EDIT” Warnings**
1085
-
1086
- For generated files installed in `.claude/skills/`, insert warnings after frontmatter:
1087
-
1088
- ```typescript
1089
- function insertDoNotEditMarker(content: string): string {
1090
- const marker = `<!-- DO NOT EDIT: Generated by mycli setup.
1091
- Run 'mycli setup' to update.
1092
- -->`;
1093
-
1094
- // Insert after YAML frontmatter
1095
- const lines = content.split('\n');
1096
- const endOfFrontmatter = lines.findIndex((l, i) => i > 0 && l === '---');
1097
- lines.splice(endOfFrontmatter + 1, 0, marker);
1098
- return lines.join('\n');
1099
- }
1100
- ```
1101
-
1102
- **Benefits of Dynamic Generation**:
1103
-
1104
- 1. **Always Current**: Resource directories reflect actual available docs
1105
- 2. **DRY Principle**: Single source of truth (frontmatter) drives multiple outputs
1106
- 3. **Partial Updates**: HTML markers enable surgical updates to sections
1107
- 4. **Version-Safe**: Content updates ship with CLI version updates
1108
-
1109
- ### 8.2 DocCache Shadowing Pattern
1110
-
1111
- Implement path-ordered document loading that allows project-level resources to shadow
1112
- (override) built-in resources, similar to how shell `$PATH` works.
1113
-
1114
- **Loading Order** (earlier paths take precedence):
1115
-
1116
- 1. Project-level: `.mycli/docs/shortcuts/`
1117
- 2. User-level: `~/.mycli/docs/shortcuts/`
1118
- 3. Built-in: Bundled with CLI
1119
-
1120
- ```typescript
1121
- class DocCache {
1122
- private paths: string[]; // Ordered by priority
913
+ * * *
1123
914
 
1124
- async loadDocument(name: string): Promise<Document | null> {
1125
- for (const basePath of this.paths) {
1126
- const doc = await this.tryLoad(join(basePath, name));
1127
- if (doc) return doc; // First match wins
1128
- }
1129
- return null;
915
+ ## 8. Hooks & Lifecycle (Cross-Agent)
916
+
917
+ Hooks let a tool inject context or enforce invariants automatically.
918
+ Support varies:
919
+
920
+ - **Claude Code** has the richest set (~29 events incl.
921
+ `SessionStart`, `Setup`, `UserPromptSubmit`, `PreToolUse`, `PostToolUse`,
922
+ `PreCompact`/`PostCompact`, `Stop`, `SubagentStart/Stop`, `SessionEnd`). Inject
923
+ context via `additionalContext` (most events) or stdout
924
+ (`SessionStart`/`UserPromptSubmit`). Skills can declare their own scoped `hooks:`.
925
+ - **Cursor** (6 events, incl.
926
+ `beforeShellExecution`/`beforeMCPExecution`), **Windsurf** (pre-hooks can **block**
927
+ via exit code 2), **Gemini CLI** (~12), and **opencode** (25+, with tool interception)
928
+ all have lifecycle hooks.
929
+ - **Codex** (as of May 2026) ships a **Claude-style hooks engine that uses the same
930
+ event schema as Claude Code** — `SessionStart`, `PreCompact`/`PostCompact`,
931
+ `PreToolUse`/`PostToolUse`, `UserPromptSubmit`, `Stop`,
932
+ `SubagentStart`/`SubagentStop`, and `PermissionRequest`. Hooks load from `hooks.json`
933
+ **or an inline `[hooks]` table in `config.toml`** next to an active config layer
934
+ (`~/.codex/…` for user scope, `<repo>/.codex/…` for project scope).
935
+ Only **command** handlers run today; `prompt`/ `agent` handlers are parsed but
936
+ skipped. Because the schema matches Claude’s, a tool’s
937
+ `SessionStart`/`PreCompact`/`PostToolUse` hooks map almost 1:1 across both agents.
938
+ Repo-local hooks should resolve scripts from the git root or `.codex/`, not from
939
+ `.claude/`, so Codex setup stays independent of Claude Code setup.
940
+ - **Aider**, **Jules**, **Zed** have no agent hooks (Aider integrates Git pre-commit
941
+ hooks only).
942
+
943
+ **Common, portable use**: a `SessionStart` hook that runs your CLI’s `prime`/`skill`
944
+ command to restore workflow context; a `PreCompact` hook that re-injects a brief
945
+ (`skill --brief`) before the window is trimmed.
946
+ Keep injected context small — it competes with everything else.
947
+
948
+ ```jsonc
949
+ // Claude Code ~/.claude/settings.json
950
+ {
951
+ "hooks": {
952
+ "SessionStart": [{ "matcher": "", "hooks": [{ "type": "command", "command": "mycli prime" }] }],
953
+ "PreCompact": [{ "matcher": "", "hooks": [{ "type": "command", "command": "mycli skill --brief" }] }]
1130
954
  }
1131
955
  }
1132
956
  ```
1133
957
 
1134
958
  * * *
1135
959
 
1136
- ## 9. MCP Integration Patterns
1137
-
1138
- MCP (Model Context Protocol) and CLI-as-Skill are complementary approaches.
1139
- Understanding when to use each is critical.
1140
-
1141
- | Aspect | CLI-as-Skill | MCP Server |
1142
- | --- | --- | --- |
1143
- | **Deployment** | npm install | Separate process |
1144
- | **Integration** | SKILL.md + hooks | MCP protocol |
1145
- | **Context** | Skill content in prompt | Tool calls |
1146
- | **State** | Stateless (per-command) | Can maintain state |
1147
- | **Scope** | Single CLI capabilities | Ecosystem of servers |
1148
- | **Complexity** | Lower | Higher |
1149
-
1150
- **When to Use CLI-as-Skill**:
1151
-
1152
- - Self-contained functionality
1153
- - Workflow guidance and documentation
1154
- - Resource libraries (guidelines, templates)
1155
- - Simple tool integration
1156
- - Quick setup requirements
1157
-
1158
- **When to Use MCP**:
1159
-
1160
- - Persistent connections (databases, APIs)
1161
- - Stateful operations
1162
- - Cross-tool orchestration
1163
- - Real-time data streaming
1164
- - Complex tool ecosystems
960
+ ## 9. Security & Supply Chain (Don’t Skip This)
961
+
962
+ Skills and instruction files are **executable influence** on an agent, which makes them
963
+ an attack surface. Treat them with the same care as dependencies.
964
+
965
+ - **Prompt injection via skills/instructions is real and effective**: 2026 security
966
+ research demonstrated up to ~80% attack success against frontier models using
967
+ malicious skills (instructions that exfiltrate data or escalate tool use).
968
+ Anything in `AGENTS.md`, `SKILL.md`, a fetched skill, or tool output is **untrusted
969
+ input**.
970
+ - **Never put secrets in skill/instruction files or tool output.** `AGENTS.md`,
971
+ `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
973
+ secrets from the environment at runtime instead.
974
+ - **Vet third-party skills before install.** Prefer sources that scan (skills.sh runs
975
+ Snyk on every install).
976
+ Read the body and any bundled scripts — review them like dependency code.
977
+ Pin to a commit, not a moving tag.
978
+ - **Scope tools tightly.** Use `allowed-tools` to grant the minimum (e.g.,
979
+ `Bash(mycli:*)` not blanket `Bash`). Prefer `disable-model-invocation` for
980
+ destructive/action-heavy skills so they require explicit invocation.
981
+ - **Lean on sandboxing.** Claude Code’s OS-level sandbox and Codex’s
982
+ `read-only`/`workspace-write` modes contain damage; design your CLI to run within them
983
+ and degrade gracefully (clear error, no silent failure) when writes/network are
984
+ denied.
985
+ - **Apply the same currency discipline** you use for packages: if your skill ships a
986
+ 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.
989
+ See `tbd guidelines supply-chain-hardening` for the cross-ecosystem policy, or
990
+ `tbd guidelines bun-monorepo-patterns` / `pnpm-monorepo-patterns` for monorepo
991
+ specifics.
1165
992
 
1166
993
  * * *
1167
994
 
1168
- ## Best Practices Summary
1169
-
1170
- ### Architecture
1171
-
1172
- 1. **Bundle documentation with CLI**: Self-contained packages work in all environments
1173
- 2. **Maintain tiered skill files**: Full (baseline) and brief versions for different
1174
- contexts
1175
- 3. **Provide a `skill` subcommand**: Output skill content to stdout with `--brief` flag
1176
- 4. **Implement fallback loading**: Support both bundled and development modes
1177
- 5. **Use platform-appropriate formats**: SKILL.md for Claude, MDC for Cursor, markers
1178
- for AGENTS.md
1179
-
1180
- ### Context Management
1181
-
1182
- 6. **Implement a `prime` command**: Dashboard at session start, brief mode for
1183
- constrained contexts
1184
- 7. **Implement a `skill` command**: Output pure skill content (no dashboard) for
1185
- inspection and installation preview
1186
- 8. **Separate skill from dashboard**: `prime` = status + context, `skill` = pure
1187
- documentation
1188
- 9. **Compose skills from multiple sources**: Header + baseline + dynamic directory
1189
- 10. **Include context recovery instructions**: Agents need to know how to restore
1190
- context
1191
- 11. **Two-level orientation only**: Full (default) and brief—avoid more granularity
1192
- 12. **Use progressive disclosure**: Level 1 (metadata) → Level 2 (skill body) → Level 3
1193
- (resources)
1194
- 13. **Keep SKILL.md under 500 lines**: Move detailed content to reference files
1195
-
1196
- ### Description Optimization
1197
-
1198
- 10. **Use the two-part rule**: What does it do?
1199
- + When to use it?
1200
- 11. **Write in third person**: “Processes files” not “I can help you”
1201
- 12. **Include explicit trigger phrases**: Match how users naturally describe needs
1202
- 13. **Front-load keywords**: Put most important triggers in first 50 characters
1203
- 14. **Respect cumulative budget**: All descriptions share a ~15K character limit
1204
- 15. **Use meta-skill pattern for 50+ resources**: One skill + CLI beats 50 individual
1205
- skills
1206
-
1207
- ### Self-Documentation
1208
-
1209
- 14. **Provide documentation commands**: `readme`, `docs`, `design` as built-in commands
1210
- 15. **Include Getting Started in help epilog**: One-liner must be easily accessible
1211
- 16. **Add IMPORTANT section to help**: Prominently reference `prime` command for context
1212
- restoration
1213
-
1214
- ### Setup Flows
1215
-
1216
- 17. **Two-tier command structure**: High-level (`setup`) and surgical (`init`)
1217
- 18. **Require explicit mode flags**: `--auto` for agents, `--interactive` for humans
1218
- 19. **Make setup idempotent**: Safe to run multiple times without errors or duplicates
1219
- 20. **Deduplicate hooks on each run**: Filter existing hooks before merging new ones
1220
- 21. **Regenerate skill files**: Always overwrite with fresh content, don’t try to update
1221
- in place
1222
- 22. **Clean up legacy patterns**: Remove deprecated files/configs on each setup run
1223
- 23. **Never guess user preferences**: For taste-based config (prefixes), always ask
1224
-
1225
- ### Agent Integration
1226
-
1227
- 24. **Install hooks programmatically**: SessionStart, PreCompact, PostToolUse
1228
- 25. **Use skill directories**: `.claude/skills/`, `.cursor/rules/`
1229
- 26. **Support multiple agents**: Single CLI, multiple integration points
1230
- 27. **Structure help for agent discovery**: IMPORTANT section, Getting Started
1231
- one-liner, prominent setup commands
1232
-
1233
- ### Output
1234
-
1235
- 28. **Implement `--json` for all commands**: Machine-readable output is essential
1236
- 29. **Use `output.data()` pattern**: Single code path for JSON and human output
1237
- 30. **Provide `--quiet` mode**: For scripted usage without noise
1238
-
1239
- ### Error Handling
1240
-
1241
- 31. **Include next steps in errors**: Actionable guidance, not just error messages
1242
- 32. **Graceful deprecation**: Keep old commands working with migration guidance
1243
- 33. **Explicit completion protocols**: Checklists prevent premature completion
1244
-
1245
- ### Agent Mental Model
1246
-
1247
- 34. **Design for agent-as-partner**: Help agents serve users, not relay commands
1248
- 35. **Lead with value proposition**: Explain *why* before *how*
1249
- 36. **Distinguish action from informational commands**: Some commands teach, not do
1250
-
1251
- ### Resource Libraries
1252
-
1253
- 37. **Bundle guidelines, shortcuts, templates**: Ship curated knowledge with CLI
1254
- 38. **Show full commands in directories**: `cli shortcut X`, not just `X`
1255
- 39. **Organize resources by purpose**: Categories by workflow phase or domain
1256
- 40. **Enable on-demand knowledge queries**: Agents pull in relevant resources JIT
1257
- 41. **Implement shadowing for customization**: Project-level overrides without forking
1258
- 42. **Generate directories dynamically**: Avoid stale documentation
1259
- 43. **Use HTML markers for updatable sections**: Enable partial updates without full
1260
- regeneration
1261
-
1262
- ### Context Injection
1263
-
1264
- 44. **Design self-reinforcing context chains**: SKILL.md → guidelines → actions
1265
- 45. **Reference commands explicitly**: Always `cli command arg`, never vague prose
1266
- 46. **Limit chain depth to 3**: Avoid deep reference chains that confuse agents
1267
- 47. **Make every layer actionable**: Each context injection should lead to actions
1268
-
1269
- ### Task Management
1270
-
1271
- 48. **Choose appropriate tracking strategy**: Ephemeral, session-local, or persistent
1272
- 49. **Implement work discovery**: `ready` or `next` commands for session start
1273
- 50. **Add session boundary enforcement**: Remind agents to sync/close at session end
1274
- 51. **Consider tbd integration**: For persistent multi-session task tracking
995
+ ## 10. Emerging & Forward-Looking (Know It Exists)
996
+
997
+ You usually don’t need these to ship a skill, but they shape where the ecosystem is
998
+ going:
999
+
1000
+ - **ACP (Agent Client Protocol)** Zed’s “LSP for agents” (JSON-RPC over stdio); 25+
1001
+ agents (Claude Code, Codex, Gemini CLI, opencode) and editors (Zed, JetBrains, Kiro).
1002
+ Complements MCP (editor↔agent, while MCP is agent↔tools).
1003
+ Your agent runtime speaks it; a skill author doesn’t implement it.
1004
+ - **A2A (Agent2Agent)** Google/Linux Foundation, v1.0, 150+ orgs; for enterprise
1005
+ agent-to-agent delegation, not skill authoring.
1006
+ Ignore unless you build autonomous multi-agent systems.
1007
+ - **Codex App-Server** — JSON-RPC (Thread/Turn/Item) decoupling Codex logic from client
1008
+ surfaces; relevant only for Codex-specific integration surfaces.
1009
+ - **Plugin marketplaces & `npx skills`** distribution is consolidating: Claude Code
1010
+ plugin marketplaces (official + community), Codex plugins, and Vercel’s
1011
+ `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).
1275
1016
 
1276
1017
  * * *
1277
1018
 
1278
- ## Integration Checklist for New CLIs
1279
-
1280
- **Agent Integration Files**
1281
-
1282
- - [ ] SKILL.md with YAML frontmatter (name, description, allowed-tools)
1283
- - [ ] CURSOR.mdc with MDC frontmatter (description, alwaysApply)
1284
- - [ ] AGENTS.md section with HTML markers
1285
- - [ ] Tiered skill files: skill-baseline.md, skill-brief.md
1286
- - [ ] Separate header file: claude-header.md with YAML frontmatter
1287
-
1288
- **Description Quality**
1289
-
1290
- - [ ] Two-part description: capabilities + activation triggers
1291
- - [ ] Third-person language only
1292
- - [ ] Explicit “Use when …” trigger phrases matching user language
1293
- - [ ] Front-load important keywords in first 50 characters
1294
- - [ ] Description length appropriate for skill collection size (≤130 chars for 60+
1295
- skills)
1019
+ ## 11. Best-Practices Summary
1296
1020
 
1297
- **Budget Management** (for CLIs installing multiple skills)
1021
+ **Start simple**
1298
1022
 
1299
- - [ ] Calculate cumulative description size (descriptions + ~109 chars overhead each)
1300
- - [ ] Verify total stays under 15K character budget
1301
- - [ ] Use meta-skill pattern if resources exceed 50
1302
- - [ ] Run `/context` to verify skills aren’t being truncated
1023
+ - One capability one `SKILL.md` (name + two-part description + < 500-line body).
1024
+ Stop.
1025
+ - Project conventions `AGENTS.md` (concise; it loads every turn).
1026
+ - Have a CLI make it agent-friendly (`--json`, idempotent, actionable errors) and
1027
+ point a `SKILL.md` at it.
1303
1028
 
1304
- **Context Management**
1029
+ **Descriptions & disclosure**
1305
1030
 
1306
- - [ ] `prime` command with dashboard and brief modes (two levels only)
1307
- - [ ] `skill` command for full documentation output with `--brief` flag
1308
- - [ ] Skill composition from header + baseline + dynamic directory
1309
- - [ ] HTML markers for updatable sections (<!-- BEGIN/END -->)
1310
- - [ ] “DO NOT EDIT” warnings in generated skill files
1311
- - [ ] Value-first orientation in skill file (why before how)
1312
- - [ ] Context recovery instructions in all docs
1313
- - [ ] Session closing protocol checklist
1314
- - [ ] SKILL.md under 500 lines (progressive disclosure)
1031
+ - Two-part rule: *what it does* + *when to use it*; third person; front-load keywords.
1032
+ - Progressive disclosure: metadata body supporting files; bundle scripts
1033
+ (output-only cost).
1034
+ - Respect the budget; verify the current model for your target agent (Claude Code ≈ 1%
1035
+ of context window, not a flat char count).
1315
1036
 
1316
- **Setup Flow**
1037
+ **Scale up only when needed**
1317
1038
 
1318
- - [ ] `setup --auto` for agent-friendly installation
1319
- - [ ] `init --prefix` for surgical initialization
1320
- - [ ] Multi-contributor detection (skip init if already configured)
1321
- - [ ] Setup is idempotent (safe to run multiple times)
1322
- - [ ] Hook deduplication (filter existing before merging)
1323
- - [ ] Skill file regeneration (always overwrite, don’t update in place)
1324
- - [ ] Legacy pattern cleanup on each setup run
1039
+ - Many capabilities meta-skill + informational, self-injecting subcommands (one
1040
+ listing slot, unbounded resources).
1041
+ This is tbd’s validated approach.
1042
+ - Path-ordered resource cache for project/user shadowing; generate `--list` dynamically.
1043
+ - Context-injection loop with explicit `cli command arg` references; depth ≤ 3.
1325
1044
 
1326
- **Hooks**
1045
+ **Reach & surface**
1327
1046
 
1328
- - [ ] SessionStart hook to call `prime`
1329
- - [ ] PreCompact hook to call `prime`
1330
- - [ ] PostToolUse hook for session completion reminders
1047
+ - Layer for reach: `AGENTS.md` + `SKILL.md` + CLI + (MCP if no CLI fits).
1048
+ - Prefer CLI over MCP when a CLI exists (cheaper, more reliable); use MCP for
1049
+ auth/multi-tenant/remote; consider code-execution mode for many-tool MCP servers.
1050
+ - Add agent-specific files (`.cursor/rules`, plugins, ACP) last, only where they pay
1051
+ off.
1331
1052
 
1332
- **Self-Documentation**
1053
+ **Operate safely**
1333
1054
 
1334
- - [ ] Help epilog with “IMPORTANT” section referencing `prime`
1335
- - [ ] Help epilog with “Getting Started” one-liner installation command
1336
- - [ ] Setup command in dedicated “Setup & Configuration” category
1337
- - [ ] Context recovery prompt when CLI runs without args
1338
- - [ ] Documentation commands (`readme`, `docs`)
1339
- - [ ] `--json` flag on all commands
1055
+ - Treat all skill/instruction content and tool output as untrusted; vet and pin
1056
+ third-party skills.
1057
+ - Scope `allowed-tools` tightly; gate destructive skills; design for sandboxes.
1058
+ - Idempotent multi-agent install with marker-bounded sections; version source files, not
1059
+ fully generated install artifacts; mark generated files “DO NOT EDIT.”
1340
1060
 
1341
- **Resource Libraries**
1342
-
1343
- - [ ] `shortcut` command with `--list` and category filtering
1344
- - [ ] `guidelines` command with `--list` and category filtering
1345
- - [ ] `template` command with `--list`
1346
- - [ ] Resources organized by purpose/workflow phase
1347
- - [ ] Resource directories generated dynamically
1348
- - [ ] Shadowing support for project-level overrides
1349
-
1350
- **Task Management**
1061
+ * * *
1351
1062
 
1352
- - [ ] Decide tracking strategy: ephemeral, session-local, or persistent
1353
- - [ ] Implement work discovery command (`ready`, `next`)
1354
- - [ ] Add session closing reminders for task sync
1063
+ ## 12. Integration Checklist
1064
+
1065
+ **Baseline (every skill)**
1066
+ - [ ] `SKILL.md` with `name` + two-part `description`
1067
+ - [ ] Body < 500 lines; bulky material in supporting files one level deep
1068
+ - [ ] Third-person description, trigger keywords front-loaded
1069
+ - [ ] Installable via commit to `.agents/skills/`, Claude mirror at `.claude/skills/`,
1070
+ and/or `npx skills add`
1071
+
1072
+ **Project**
1073
+ - [ ] `AGENTS.md` with build/test/style/conventions (concise)
1074
+ - [ ] Managed `AGENTS.md` block uses a stable begin/end marker with a `format=fNN` field
1075
+ on the begin line
1076
+ - [ ] `CLAUDE.md` strategy decided (symlink to `AGENTS.md`, copy, or separate)
1077
+
1078
+ **CLI tool (if applicable)**
1079
+ - [ ] `--json` on all commands; `--brief`/`--quiet`; actionable errors
1080
+ - [ ] Idempotent `setup --auto`; `init` for surgical config
1081
+ - [ ] Help epilog with `IMPORTANT:` + Getting Started one-liner
1082
+ - [ ] `prime` (status/context) and `skill` (pure docs) commands
1083
+ - [ ] Invocation strategy chosen (§6.7): local-first plus pinned zero-install fallback
1084
+ by default, or global install + `SessionStart` bootstrap for cloud/ephemeral agents
1085
+
1086
+ **Advanced (many subcommands / knowledge library)**
1087
+ - [ ] Meta-skill composition (header + baseline + dynamic directory)
1088
+ - [ ] Informational commands (`guidelines`/`shortcut`/`template`) with `--list`
1089
+ - [ ] Path-ordered DocCache with shadowing
1090
+ - [ ] Tiered skill files (baseline + brief)
1091
+ - [ ] Context-injection loop, explicit references, depth ≤ 3
1092
+
1093
+ **Reach**
1094
+ - [ ] Decide target agents; add per-agent files only where needed
1095
+ - [ ] MCP server only if no CLI fits, or for OAuth/multi-tenant/remote
1096
+ - [ ] Marker-bounded multi-agent install; “DO NOT EDIT” on generated files
1097
+ - [ ] Existing installs upgrade item-by-item without rewriting user-owned content
1098
+
1099
+ **Security**
1100
+ - [ ] Third-party skills vetted, scanned, and pinned
1101
+ - [ ] `allowed-tools` minimally scoped; destructive skills gated
1102
+ - [ ] CLI works within agent sandboxes and degrades gracefully
1355
1103
 
1356
1104
  * * *
1357
1105
 
1358
1106
  ## References
1359
1107
 
1360
- ### Official Documentation
1361
-
1362
- - Claude Code Skills Documentation: https://code.claude.com/docs/en/skills
1363
- - Agent Skills Open Standard: https://agentskills.io
1364
- - Cursor IDE MDC Format: https://cursor.sh/docs/rules
1365
-
1366
- ### Community Resources
1367
-
1368
- - Claude Skills Best Practices:
1369
- https://github.com/Dicklesworthstone/meta_skill/blob/main/BEST_PRACTICES_FOR_WRITING_AND_USING_SKILLS_MD_FILES.md
1370
- - Claude Code Skills Guide (Gist):
1371
- https://gist.github.com/mellanon/50816550ecb5f3b239aa77eef7b8ed8d
1372
- - Awesome Claude Skills: https://github.com/travisvn/awesome-claude-skills
1373
- - Skills Character Budget Research:
1374
- https://github.com/anthropics/claude-code/issues/11045
1375
- - Skill Activation Reliability Testing:
1376
- https://scottspence.com/posts/how-to-make-claude-code-skills-activate-reliably
1377
-
1378
- ### MCP Resources
1379
-
1380
- - Anthropic MCP Engineering Blog:
1381
- https://www.anthropic.com/engineering/code-execution-with-mcp
1382
- - MCP Agent Frameworks Comparison:
1383
- https://clickhouse.com/blog/how-to-build-ai-agents-mcp-12-frameworks
1384
- - GitHub MCP Registry: https://github.com/modelcontextprotocol
1385
-
1386
- ### Implementation References
1387
-
1388
- - Commander.js: https://github.com/tj/commander.js
1389
- - tbd Source Code: https://github.com/jlevy/tbd
1108
+ ### Open standards & governance
1109
+
1110
+ - Agent Skills standard: https://agentskills.io (spec:
1111
+ https://agentskills.io/specification)
1112
+ - AGENTS.md: https://agents.md
1113
+ - Agentic AI Foundation (Linux Foundation):
1114
+ https://www.linuxfoundation.org/press/linux-foundation-announces-the-formation-of-the-agentic-ai-foundation
1115
+
1116
+ ### Claude Code
1117
+
1118
+ - Skills: https://code.claude.com/docs/en/skills
1119
+ - Hooks: https://code.claude.com/docs/en/hooks
1120
+ - Plugins: https://code.claude.com/docs/en/plugins
1121
+ - Skill authoring best practices:
1122
+ https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices
1123
+ - Sandboxing: https://www.anthropic.com/engineering/claude-code-sandboxing
1124
+
1125
+ ### Codex
1126
+
1127
+ - AGENTS.md: https://developers.openai.com/codex/guides/agents-md
1128
+ - Config reference: https://developers.openai.com/codex/config-reference
1129
+ - Skills: https://developers.openai.com/codex/skills
1130
+ - MCP: https://developers.openai.com/codex/mcp
1131
+ - Sandboxing: https://developers.openai.com/codex/concepts/sandboxing
1132
+
1133
+ ### Other agents
1134
+
1135
+ - Cursor rules: https://cursor.com/docs/rules
1136
+ - GitHub Copilot custom instructions:
1137
+ https://docs.github.com/copilot/customizing-copilot/adding-custom-instructions-for-github-copilot
1138
+ - Gemini CLI: https://geminicli.com/docs/cli/gemini-md/
1139
+ - Windsurf AGENTS.md: https://docs.windsurf.com/windsurf/cascade/agents-md
1140
+ - Cline rules: https://docs.cline.bot/customization/cline-rules
1141
+ - Aider conventions: https://aider.chat/docs/usage/conventions.html
1142
+ - opencode: https://opencode.ai/docs/rules/
1143
+ - Amp: https://ampcode.com/manual
1144
+ - pi: https://github.com/badlogic/pi-mono
1145
+
1146
+ ### MCP & protocols
1147
+
1148
+ - 2026 MCP roadmap: https://blog.modelcontextprotocol.io/posts/2026-mcp-roadmap/
1149
+ - Code execution with MCP: https://www.anthropic.com/engineering/code-execution-with-mcp
1150
+ - CLI vs MCP benchmarks: https://www.firecrawl.dev/blog/mcp-vs-cli
1151
+ - ACP: https://zed.dev/acp
1152
+ - A2A:
1153
+ https://www.linuxfoundation.org/press/a2a-protocol-surpasses-150-organizations-lands-in-major-cloud-platforms-and-sees-enterprise-production-use-in-first-year
1154
+
1155
+ ### Distribution & ecosystem
1156
+
1157
+ - Vercel skills / skills.sh:
1158
+ https://vercel.com/changelog/introducing-skills-the-open-agent-skills-ecosystem
1159
+ - npx skills: https://github.com/vercel-labs/skills
1160
+ - Anthropic skills (examples): https://github.com/anthropics/skills
1161
+ - gstack: https://github.com/garrytan/gstack
1162
+ - Beads (bd): https://github.com/gastownhall/beads
1163
+
1164
+ ### Security
1165
+
1166
+ - Securing the skill ecosystem (Snyk):
1167
+ https://snyk.io/blog/snyk-vercel-securing-agent-skill-ecosystem/
1168
+ - Malicious-skill research:
1169
+ https://labs.reversec.com/posts/2026/05/skill-issues-compromising-claude-code-with-malicious-skills-agents-part-1
1390
1170
 
1391
1171
  ## Related Guidelines
1392
1172
 
1393
- - For TypeScript CLI implementation details, see
1394
- `tbd guidelines typescript-cli-tool-rules`
1395
- - For testing patterns, see `tbd guidelines general-testing-rules`
1396
- - For monorepo setup, see `tbd guidelines pnpm-monorepo-patterns` or
1397
- `bun-monorepo-patterns`
1173
+ - TypeScript CLI implementation: `tbd guidelines typescript-cli-tool-rules`
1174
+ - Supply-chain / dependency currency: `tbd guidelines bun-monorepo-patterns` or
1175
+ `pnpm-monorepo-patterns`
1176
+ - Testing: `tbd guidelines general-testing-rules`