@zalom/plastic 1.0.0-beta.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/PLASTIC-reference.md +133 -0
  2. package/PLASTIC.md +398 -82
  3. package/README.md +99 -82
  4. package/agents/plastic-brainstorming.md +12 -9
  5. package/agents/plastic-enforcer.md +52 -12
  6. package/agents/plastic-executor.md +10 -10
  7. package/agents/plastic-future-intent-researcher.md +4 -8
  8. package/agents/plastic-intent-curator.md +12 -14
  9. package/agents/plastic-intent-discovery.md +35 -0
  10. package/agents/plastic-planner.md +15 -10
  11. package/agents/plastic-spec-specialist.md +15 -10
  12. package/bin/plastic.js +7 -3
  13. package/hooks/code-gate +10 -1
  14. package/hooks/hooks.json +28 -3
  15. package/hooks/lock-gate +21 -0
  16. package/hooks/retrieval-gate +10 -0
  17. package/hooks/savepoint-pre +10 -0
  18. package/hooks/statusline +48 -6
  19. package/package.json +2 -1
  20. package/scripts/agent-report +21 -0
  21. package/scripts/dashboard.rb +98 -23
  22. package/scripts/doctor.rb +232 -5
  23. package/scripts/hook-auto-arm +1 -1
  24. package/scripts/hook-bash-gate +22 -4
  25. package/scripts/hook-code-gate +11 -6
  26. package/scripts/hook-continue +17 -0
  27. package/scripts/hook-create-gate +45 -9
  28. package/scripts/hook-gate-check +24 -23
  29. package/scripts/hook-lock-gate +83 -0
  30. package/scripts/hook-retrieval-gate +148 -0
  31. package/scripts/hook-savepoint-pre +32 -0
  32. package/scripts/hook-session-start +1 -1
  33. package/scripts/insight-append +51 -0
  34. package/scripts/install.rb +44 -7
  35. package/scripts/lib/agent_models.rb +43 -0
  36. package/scripts/lib/bridge.rb +924 -84
  37. package/scripts/lib/dashboard_banner.rb +42 -0
  38. package/scripts/lib/hook_registry.rb +95 -0
  39. package/scripts/lib/insights.rb +86 -0
  40. package/scripts/lib/installer_core.rb +100 -60
  41. package/scripts/lib/link_suggestions.rb +319 -0
  42. package/scripts/lib/lock.rb +375 -0
  43. package/scripts/lib/power_tools.rb +22 -21
  44. package/scripts/lib/preflight.rb +79 -0
  45. package/scripts/lib/qmd_sync.rb +15 -0
  46. package/scripts/lib/retrieval_gate.rb +211 -0
  47. package/scripts/lib/worktree.rb +384 -0
  48. package/scripts/link-suggest +213 -0
  49. package/scripts/new-intent +9 -1
  50. package/scripts/plastic-lock +164 -0
  51. package/scripts/read-config +4 -0
  52. package/scripts/spawn-preamble +11 -3
  53. package/scripts/update.rb +16 -7
  54. package/skills/auto/SKILL.md +126 -19
  55. package/skills/auto/references/agent-architecture.md +7 -4
  56. package/skills/auto/references/agent-report-contract.md +36 -1
  57. package/skills/auto/references/end-tail.md +56 -0
  58. package/skills/auto/references/human-report-contract.md +55 -0
  59. package/skills/auto/references/tiers.md +77 -0
  60. package/skills/brainstorming/SKILL.md +7 -34
  61. package/skills/brainstorming/references/design-principles.md +49 -0
  62. package/skills/continuing/SKILL.md +26 -7
  63. package/skills/creating-intent/SKILL.md +13 -28
  64. package/skills/creating-project/SKILL.md +11 -74
  65. package/skills/creating-project/references/project-scaffolding.md +97 -0
  66. package/skills/creating-skills/SKILL.md +65 -0
  67. package/skills/creating-skills/evals/evals.json +108 -0
  68. package/skills/creating-skills/references/agents.md +168 -0
  69. package/skills/creating-skills/references/evals.md +41 -0
  70. package/skills/creating-skills/references/hooks.md +248 -0
  71. package/skills/creating-skills/references/progressive-disclosure.md +176 -0
  72. package/skills/creating-skills/references/scripts.md +166 -0
  73. package/skills/creating-skills/references/skills.md +165 -0
  74. package/skills/creating-skills/scripts/scaffold.rb +313 -0
  75. package/skills/dashboard/SKILL.md +13 -11
  76. package/skills/dashboard/references/classification.md +22 -0
  77. package/skills/doctor/SKILL.md +10 -7
  78. package/skills/executing-plan/SKILL.md +4 -4
  79. package/skills/humanizer/SKILL.md +39 -0
  80. package/skills/humanizer/evals/evals.json +70 -0
  81. package/skills/humanizer/references/always-on-snippet.md +9 -0
  82. package/skills/humanizer/references/examples.md +48 -0
  83. package/skills/install/SKILL.md +75 -84
  84. package/skills/intent-curator/SKILL.md +5 -1
  85. package/skills/intent-discovery/SKILL.md +47 -0
  86. package/skills/intent-starting/SKILL.md +130 -0
  87. package/skills/intent-starting/evals/evals.json +117 -0
  88. package/skills/intent-starting/references/boarding-matrix.md +35 -0
  89. package/skills/linking-intents/SKILL.md +48 -12
  90. package/skills/lock/SKILL.md +41 -0
  91. package/skills/managing-index/SKILL.md +6 -0
  92. package/skills/releasing/SKILL.md +44 -29
  93. package/skills/releasing/references/promotion-and-tagging.md +60 -0
  94. package/skills/roadmap/SKILL.md +51 -0
  95. package/skills/roadmap/references/file-format.md +91 -0
  96. package/skills/roadmap/references/operations.md +78 -0
  97. package/skills/uninstall/SKILL.md +29 -11
  98. package/skills/update/SKILL.md +34 -23
  99. package/skills/versions/SKILL.md +27 -12
  100. package/skills/writing-plans/SKILL.md +10 -88
  101. package/skills/writing-plans/references/plan-format.md +102 -0
  102. package/templates/config.yml +8 -0
  103. package/templates/outcome.md +3 -0
  104. package/templates/revisions.md +58 -0
  105. package/templates/roadmap.md +30 -0
  106. package/skills/writing-instructions/SKILL.md +0 -159
  107. package/skills/writing-instructions/references/agentskills-spec.md +0 -135
@@ -0,0 +1,176 @@
1
+ # Progressive Disclosure
2
+
3
+ The canonical load-level model for Plastic skills, agents, and hooks. Every other
4
+ reference and the SKILL.md body point here for this model and must not restate it (C7).
5
+ Read it before authoring any skill body, before splitting content into `references/`,
6
+ and before deciding where a file goes (scripts, references, or assets).
7
+
8
+ ## Contents
9
+
10
+ - [The three load levels](#the-three-load-levels)
11
+ - [When to split the body into references](#when-to-split-the-body-into-references)
12
+ - [Bucket selection: scripts vs references vs assets](#bucket-selection-scripts-vs-references-vs-assets)
13
+ - [Reference-link discipline (C4)](#reference-link-discipline-c4)
14
+ - [One level deep, with a table of contents (C5, C6)](#one-level-deep-with-a-table-of-contents-c5-c6)
15
+ - [Store each fact once (C7)](#store-each-fact-once-c7)
16
+ - [Cross-reference other skills by name (C8)](#cross-reference-other-skills-by-name-c8)
17
+ - [Ship only what does the job (C9)](#ship-only-what-does-the-job-c9)
18
+ - [The thin-router pattern (C10)](#the-thin-router-pattern-c10)
19
+ - [Quarantine worked examples (C11)](#quarantine-worked-examples-c11)
20
+
21
+ ## The three load levels
22
+
23
+ Treat each level as a hard design target, not a guideline. The agent platform loads
24
+ each level at a different moment, so a fact in the wrong level either burns context that
25
+ is always present or never arrives when needed. [C1]
26
+
27
+ | Level | What lives here | Budget | When it loads |
28
+ |-------|-----------------|--------|---------------|
29
+ | Metadata | `name` + `description` frontmatter | ~100 tokens | Always, for every skill in the catalog |
30
+ | Body | `SKILL.md` after the frontmatter | under 5000 tokens / under 500 lines | On trigger (description matches the request) |
31
+ | Resources | files in `references/`, `scripts/`, `assets/` | unbounded | On demand (the body points to them, or the agent runs them) |
32
+
33
+ Consequences that drive every other rule in this file:
34
+
35
+ 1. Metadata is paid for on every request, so the description earns its ~100 tokens by
36
+ triggering correctly and nothing more. Authoring rules for the description live in
37
+ `skills.md`.
38
+ 2. Body tokens are paid for only when the skill fires, but then they are paid in full.
39
+ Keep the body to the non-skippable rules plus routing. Push how-to down to resources.
40
+ 3. Resource tokens are paid for only when the agent reaches the file. This is where
41
+ depth, variants, and worked examples belong.
42
+
43
+ ## When to split the body into references
44
+
45
+ Split when the body approaches the budget or carries material the agent does not need on
46
+ every run. Move out first, in this order: advanced cases, variant paths, long worked
47
+ examples, deep domain background. Keep inline only the core workflow plus the selection
48
+ guidance that tells the agent which path or reference to take. [C2]
49
+
50
+ Move to `references/`:
51
+
52
+ - Detailed procedures the agent needs only for one task shape.
53
+ - Advanced or edge-case handling most runs never hit.
54
+ - Variant flows (one file per variant) so the common path stays short.
55
+ - Long examples and tables that document rather than instruct.
56
+
57
+ Keep in the body:
58
+
59
+ - The non-skippable rules (the ones an agent must not get wrong even if it never opens a
60
+ reference).
61
+ - The routing table that maps a request shape to the right reference.
62
+ - Selection guidance: how to choose between the references and paths on offer.
63
+
64
+ ## Bucket selection: scripts vs references vs assets
65
+
66
+ Choose the bucket by how the file touches the context window, not by file type. [C3]
67
+
68
+ | Bucket | Relationship to context | Use for |
69
+ |--------|-------------------------|---------|
70
+ | `scripts/` | Executed, not read. Output enters context, the source does not. | Deterministic logic the agent would otherwise re-derive each run: validators, generators, formatters. See `scripts.md`. |
71
+ | `references/` | Read only when the body points the agent to it. | Depth, procedures, variants, examples that instruct. |
72
+ | `assets/` | Copied into output, never read into context. | Templates, boilerplate, fixtures the agent emits or copies verbatim. |
73
+
74
+ Decision rule: if the content is logic that runs, put it in `scripts/` and document the
75
+ interface (`--help`, exit codes) rather than the implementation. If it is knowledge the
76
+ agent reads to decide or act, put it in `references/`. If it is bytes the agent copies
77
+ into its output without reading, put it in `assets/`.
78
+
79
+ ## Reference-link discipline (C4)
80
+
81
+ Bind every reference link to an observable trigger: a condition the agent can check
82
+ against the request or the run state. Never ship a bare "see references/ for more". A
83
+ bare pointer makes loading a judgment call, so the agent either loads everything (burning
84
+ the budget the split was meant to save) or loads nothing (and acts blind). [C4]
85
+
86
+ | Form | Verdict |
87
+ |------|---------|
88
+ | `Read references/hooks.md when authoring a lifecycle hook.` | Good. Trigger is the task shape. |
89
+ | `Read references/errors.md when the API returns a non-200 status.` | Good. Trigger is observable run state. |
90
+ | `See references/ for more detail.` | Bad. No trigger; loading is a guess. |
91
+ | `Refer to the references as needed.` | Bad. "As needed" is not a condition. |
92
+
93
+ Write the trigger as the request shape the agent can match ("when authoring an agent",
94
+ "when the user names a hook event") or a run-state signal it can read ("when the test
95
+ suite reports a failure", "when the frontmatter validator exits non-zero").
96
+
97
+ ## One level deep, with a table of contents (C5, C6)
98
+
99
+ Keep every reference exactly one level deep from `SKILL.md`: the body links to
100
+ `references/x.md`, and `references/x.md` does not link onward to a further file the agent
101
+ must chase. Nested references get head-previewed by the platform, so the agent acts on a
102
+ partial read and misses content below the preview window. Flatten instead: if a reference
103
+ grows a second level, split it into sibling files the body routes to directly. [C5]
104
+
105
+ Add a table of contents to the top of any reference over 100 lines so the agent can jump
106
+ to the relevant section instead of reading linearly. For very large files, put grep
107
+ patterns in the body so the agent can locate a section without loading the whole file.
108
+ [C6]
109
+
110
+ ## Store each fact once (C7)
111
+
112
+ Keep each fact in exactly one place. Do not restate a rule across the body and a
113
+ reference, across two references, or across two skills. Duplicated doctrine drifts: one
114
+ copy gets updated, the other goes stale, and the agent cannot tell which is current. When
115
+ two files need the same fact, one owns it and the other points to the owner.
116
+
117
+ This file owns the load-level model. The body and the other references point here for it
118
+ and do not repeat the table or the budgets. [C7]
119
+
120
+ ## Cross-reference other skills by name (C8)
121
+
122
+ Name a required companion skill with a requirement marker, not a path. Use a line the
123
+ agent reads as a dependency it loads on its own terms. [C8]
124
+
125
+ | Form | Effect |
126
+ |------|--------|
127
+ | `REQUIRED BACKGROUND: superpowers:test-driven-development` | Good. Names the dependency; the agent loads it when relevant. |
128
+ | `For eval depth, use plastic-evaluating-skills.` | Good. Names the skill, leaves loading to the agent. |
129
+ | `@skills/evaluating-skills/SKILL.md` | Bad. `@`-path syntax force-loads the file immediately, defeating disclosure. |
130
+
131
+ The `@`-path form pulls the target into context the moment the line is read, so it spends
132
+ the budget the level split was built to protect. Name the skill and let the trigger
133
+ decide when it loads.
134
+
135
+ ## Ship only what does the job (C9)
136
+
137
+ Ship the SKILL.md, the references the body routes to, the scripts it runs, and the assets
138
+ it copies. Nothing else. No README, CHANGELOG, or QUICK_REFERENCE inside a skill: the
139
+ description is the skill's front door, and a second front door duplicates it (C7) and adds
140
+ files the agent must skip past. No orphan files (a file no link points to and no script
141
+ runs). If nothing reaches a file, delete it. [C9]
142
+
143
+ ## The thin-router pattern (C10)
144
+
145
+ For a knowledge-heavy domain (one with many distinct request shapes, each needing
146
+ different depth), make the body a thin router: a short header of non-skippable rules plus
147
+ a table that maps a request shape to the one reference that handles it. The body inlines
148
+ no how-to. It decides which reference to load and stops. [C10]
149
+
150
+ Router body shape:
151
+
152
+ ```
153
+ # skill-name
154
+
155
+ <non-skippable rules: the few facts an agent must not get wrong>
156
+
157
+ ## Routing
158
+
159
+ | When the task is... | Read |
160
+ |---------------------|------|
161
+ | authoring an Agent Skill | references/skills.md |
162
+ | authoring a subagent | references/agents.md |
163
+ | authoring a lifecycle hook | references/hooks.md |
164
+ ```
165
+
166
+ The router keeps the always-paid body cost flat as the domain grows: adding a new request
167
+ shape adds one reference and one table row, not more body. Each reference stays focused on
168
+ its one shape.
169
+
170
+ ## Quarantine worked examples (C11)
171
+
172
+ Keep the maxim in context, keep the example out of it. State the rule in the body or the
173
+ reference; move long worked examples to a file the agent loads only when it needs to see
174
+ the rule applied. An example is illustration, not instruction: it is paid for on every run
175
+ if it sits in the body, but it is needed only when the rule alone is not enough. Put the
176
+ short rule where it triggers, and route to the example with a trigger condition (C4). [C11]
@@ -0,0 +1,166 @@
1
+ # Scripts: when deterministic code beats prose
2
+
3
+ Decide whether a skill ships a script, and write scripts that hold their determinism.
4
+ Read this when choosing script versus prose, or when writing a script that ships with a
5
+ skill.
6
+
7
+ For which bucket holds a given piece of content (scripts versus references versus
8
+ assets), read `references/progressive-disclosure.md`. This file covers only the
9
+ script-or-prose decision and script discipline.
10
+
11
+ ## Contents
12
+
13
+ - [Ship a script or write prose](#ship-a-script-or-write-prose)
14
+ - [The three-way test](#the-three-way-test)
15
+ - [Make scripts solve, not punt](#make-scripts-solve-not-punt)
16
+ - [Test by running](#test-by-running)
17
+ - [Match freedom to fragility](#match-freedom-to-fragility)
18
+ - [Wire validators into hooks](#wire-validators-into-hooks)
19
+ - [Script hard requirements](#script-hard-requirements)
20
+ - [Plastic conventions](#plastic-conventions)
21
+ - [Worked example](#worked-example)
22
+ - [Self-check](#self-check)
23
+
24
+ ## Ship a script or write prose
25
+
26
+ Ship a script when either condition holds:
27
+
28
+ 1. The same code gets rewritten on every run.
29
+ 2. Deterministic reliability matters (one wrong character breaks the result).
30
+
31
+ Otherwise write prose. A script is executed, not loaded, so its body stays out of
32
+ context and costs no tokens at trigger time. The price is an indirection: the agent must
33
+ find the script, learn its interface, and run it. Pay that price only when repetition or
34
+ determinism earns it. [G1]
35
+
36
+ ## The three-way test
37
+
38
+ When something repeats, route it by what repeats, not by gut feel. [G2]
39
+
40
+ | What repeats | Bucket | Why |
41
+ | --- | --- | --- |
42
+ | Identical code | `scripts/` | Run it; do not regenerate it each time. |
43
+ | Identical boilerplate output | `assets/` (template) | Copy the template into output; never read it into context. |
44
+ | Re-discovered facts | `references/` | Read it once, on the trigger that needs it. |
45
+
46
+ A symptom of the wrong choice: an agent pasting the same 30 lines of Ruby across three
47
+ runs belongs in `scripts/`, not in prose; a fixed file header the agent retypes belongs
48
+ in `assets/`; a constant the agent keeps looking up belongs in `references/`.
49
+
50
+ ## Make scripts solve, not punt
51
+
52
+ A script that hands its failure back to the agent loses the determinism that justified
53
+ shipping it. [G3]
54
+
55
+ - Handle errors inside the script. Catch the failure, print a clear diagnostic to stderr,
56
+ and exit non-zero. Do not raise a raw stack trace and leave the agent to interpret it.
57
+ - No voodoo constants. Every magic number, path, or threshold gets a name and a comment
58
+ stating where it came from. An unexplained `0.87` is a future break.
59
+ - State the mode. Say explicitly whether the agent executes the script or reads it. A
60
+ validator is executed; a snippet meant to be copied is read. Ambiguity makes the agent
61
+ guess.
62
+
63
+ ## Test by running
64
+
65
+ An untested script is a latent break. Run it against real input before shipping. [G4]
66
+
67
+ - Exercise the success path and at least one failure path; confirm the exit code and the
68
+ stderr message.
69
+ - Delete any example or scratch files the run generated that the skill does not ship.
70
+ Stray files are clutter and may load by accident.
71
+
72
+ ## Match freedom to fragility
73
+
74
+ Match degrees of freedom to fragility. Put guardrails on the narrow bridge, not the open
75
+ field. [G6]
76
+
77
+ | Task shape | Form | Reason |
78
+ | --- | --- | --- |
79
+ | Open, judgment-heavy | Prose | The agent needs room to adapt; code would over-constrain. |
80
+ | A preferred, repeatable pattern | Parameterized script (flags/env) | One correct shape, with controlled variation. |
81
+ | Fragile or destructive sequence | Fixed "do not modify" script | One exact path; any edit risks data loss. |
82
+
83
+ Mark a fragile script as "do not modify" in its `--help` and in the pointer that sends the
84
+ agent to it. For side-effecting workflows, gate execution behind a validator (see below)
85
+ rather than trusting the agent to check preconditions by hand.
86
+
87
+ ## Wire validators into hooks
88
+
89
+ When a rule must hold every time, wire a deterministic validator into a hook rather than
90
+ restating the rule in prose. [G5]
91
+
92
+ - A `PreToolUse` validator can refuse an action before it runs; a packaging step can
93
+ refuse to ship a skill that fails validation.
94
+ - Gate destructive steps behind validate-then-act: the validator passes, then the action
95
+ runs. A prose reminder ("remember to check X first") is probabilistic; a hook is not.
96
+
97
+ For hook event selection, exit-code semantics, and path conventions, read
98
+ `references/hooks.md`.
99
+
100
+ ## Script hard requirements
101
+
102
+ Every script that ships with a skill meets these, because an agent runs it unattended:
103
+
104
+ 1. No interactive prompts. A blocking `gets` or `read -p` hangs the agent forever. Take
105
+ all input up front.
106
+ 2. Input via flags, environment variables, or stdin. Never mid-run questions.
107
+ 3. `--help` is the primary documentation. Describe purpose, every flag, input, output, and
108
+ exit codes there, so the agent learns the interface without reading the source.
109
+ 4. Structured output. Data on stdout, diagnostics and progress on stderr, so the caller
110
+ can capture one without the other.
111
+ 5. Idempotent operations. Running twice produces the same end state; re-running after a
112
+ partial failure is safe.
113
+ 6. Meaningful, documented exit codes. 0 for success, distinct non-zero codes for distinct
114
+ failures, each named in `--help`.
115
+
116
+ ## Plastic conventions
117
+
118
+ - Scripts ship in Ruby. A worked example that shows a script shows Ruby.
119
+ - Any shell script runs under macOS `/bin/bash` 3.2. No `bash` 4.x features (no
120
+ associative arrays, no `mapfile`, no `${var^^}`), and no heredocs inside `$(...)`.
121
+
122
+ ## Worked example
123
+
124
+ A skill validates that an intent slug is well formed before any directory is created. The
125
+ check runs on every intent and must be exact, so it ships as a script, not prose. [G1][G3]
126
+
127
+ `scripts/validate_slug.rb`:
128
+
129
+ ```ruby
130
+ #!/usr/bin/env ruby
131
+ # Validate an intent slug. Execute this; do not inline its logic.
132
+ # Usage: validate_slug.rb SLUG
133
+ # Exit: 0 valid, 1 malformed, 2 wrong argument count.
134
+
135
+ # Convention source: A5 of the best-practices standard (lowercase,
136
+ # digits, single hyphens, no leading/trailing/consecutive hyphens).
137
+ SLUG_PATTERN = /\A[a-z0-9]+(-[a-z0-9]+)*\z/
138
+
139
+ if ARGV.length != 1
140
+ warn "usage: validate_slug.rb SLUG"
141
+ exit 2
142
+ end
143
+
144
+ slug = ARGV.fetch(0)
145
+ if SLUG_PATTERN.match?(slug)
146
+ puts slug # data on stdout
147
+ exit 0
148
+ else
149
+ warn "malformed slug: #{slug.inspect}" # diagnostic on stderr
150
+ exit 1
151
+ end
152
+ ```
153
+
154
+ This script earns its place: identical code on every run, one exact rule, errors handled
155
+ inside, the named constant cites its source, data on stdout and diagnostics on stderr,
156
+ documented exit codes, and the header states it is executed. An open task ("name this
157
+ intent well") would stay prose; this fixed check is a script.
158
+
159
+ ## Self-check
160
+
161
+ - Does this code repeat or demand exactness? If not, it stays prose. [G1]
162
+ - Did the right bucket win the three-way test? [G2]
163
+ - Are errors handled inside, constants named, and the execute-or-read mode stated? [G3]
164
+ - Did the script run green on a success path and a failure path, with scratch files
165
+ removed? [G4]
166
+ - Does fragility match form, with destructive steps gated by a validator? [G5][G6]
@@ -0,0 +1,165 @@
1
+ # Authoring an Agent Skill
2
+
3
+ Open this when writing or restructuring a single Agent Skill: the frontmatter, the
4
+ description that triggers it, the body voice, and the on-disk layout. Rule ids in brackets
5
+ (A1 through B10) point at the synthesis standard the rules come from.
6
+
7
+ For the three load levels (metadata, body, resources), the thin-router pattern, and how to
8
+ split a body into `references/`, read `progressive-disclosure.md`. This file does not repeat
9
+ that model.
10
+
11
+ ## Contents
12
+
13
+ - Skill file layout
14
+ - Frontmatter fields
15
+ - The `name` field
16
+ - The `description` field (triggering)
17
+ - Optional frontmatter fields
18
+ - Body voice
19
+ - Body content
20
+ - Self-check
21
+
22
+ ## Skill file layout
23
+
24
+ A skill is a directory whose name matches the `name` field. The directory holds `SKILL.md`
25
+ plus optional buckets. Pick a bucket by how the file touches context.
26
+
27
+ | Path | Loads when | Holds |
28
+ |------|-----------|-------|
29
+ | `SKILL.md` | The skill triggers | Frontmatter plus the body |
30
+ | `references/` | The body points at it, on demand | Deep how-to, specs, variant material |
31
+ | `scripts/` | Executed, never read into context | Repeated deterministic code |
32
+ | `assets/` | Copied into output, never read | Templates, boilerplate the output needs |
33
+ | `evals/` | Run by the eval harness | Eval cases for the skill |
34
+
35
+ When picking a bucket, follow `progressive-disclosure.md` for the cross-cutting layout rules:
36
+ references one level deep (C5), no orphan or auxiliary files in the skill (C9), and each fact
37
+ stored once (C7).
38
+
39
+ ## Frontmatter fields
40
+
41
+ `SKILL.md` opens with YAML frontmatter. Two fields are required.
42
+
43
+ | Field | Required | Constraints |
44
+ |-------|----------|-------------|
45
+ | `name` | Yes | 1 to 64 chars. Lowercase alphanumeric plus hyphens. No leading, trailing, or consecutive hyphens. Matches the directory name. |
46
+ | `description` | Yes | 1 to 1024 chars. Non-empty. States what and when. |
47
+
48
+ Invent no other top-level fields. Unknown fields are ignored or rejected and add noise [A6].
49
+
50
+ ## The `name` field
51
+
52
+ Rules [A5]:
53
+
54
+ 1. 64 chars or fewer.
55
+ 2. Lowercase letters, numbers, and hyphens only.
56
+ 3. No leading, trailing, or consecutive hyphens.
57
+ 4. Must match the parent directory name exactly.
58
+ 5. Must not contain `anthropic` or `claude`.
59
+ 6. Prefer the gerund form, which reads as a capability (`processing-pdfs`, `creating-skills`,
60
+ not `pdf-tool`).
61
+
62
+ ## The `description` field (triggering)
63
+
64
+ The description is the only text loaded at discovery time. The body is not loaded when the
65
+ agent decides whether to trigger, so the description alone has to win the match.
66
+
67
+ Rules:
68
+
69
+ 1. Write the description as triggering conditions only ("Use when ..."), never as a summary of
70
+ the workflow [A1]. A workflow summary makes the agent act on the summary and skip the body,
71
+ dropping steps. Documented failure: a description that summarized "code review between
72
+ tasks" produced one review instead of two.
73
+ 2. Write in the third person [A2]. The description is injected into the system prompt, where
74
+ mixed point of view degrades discovery.
75
+ 3. State both what the skill does and when to use it, and front-load concrete trigger terms
76
+ [A3]. The model picks from many skills on this text and the listing is budget-truncated, so
77
+ terms placed late may never be read.
78
+ 4. Include at least one indirect trigger where the user does not name the domain [A4]. Real
79
+ prompts rarely name the skill, so a keyword-only description misses oblique requests.
80
+
81
+ Shape:
82
+
83
+ ```yaml
84
+ description: >
85
+ [One clause: what it does]. Use when [primary trigger], [secondary trigger],
86
+ or when [indirect trigger where the user does not name the domain].
87
+ ```
88
+
89
+ For side-effecting workflows (deploy, release, destructive ops), set
90
+ `disable-model-invocation: true` so only the user fires the skill [A7]. Auto-triggering on
91
+ irreversible work is a known failure mode.
92
+
93
+ ## Optional frontmatter fields
94
+
95
+ Use only the documented optionals below. Add nothing beyond them [A6].
96
+
97
+ | Field | Holds |
98
+ |-------|-------|
99
+ | `license` | Short name or filename reference |
100
+ | `compatibility` | Environment requirements, 1 to 500 chars, only when needed |
101
+ | `metadata` | String-to-string map with unique keys |
102
+ | `allowed-tools` | Space-separated tool list (experimental) |
103
+ | `model` | Claude Code extension: pin the model for this skill |
104
+ | `disable-model-invocation` | Claude Code extension: only the user may fire the skill |
105
+ | `context: fork` | Claude Code extension: run the body as a forked task |
106
+ | `paths` | Claude Code extension: scope the skill to matching paths |
107
+
108
+ ## Body voice
109
+
110
+ Rules:
111
+
112
+ 1. Write in imperative or infinitive voice ("Run the validator", "Extract the text"), never
113
+ second person ("you should", "you can") [B1]. Command voice is shorter and binds tighter;
114
+ hedged second-person language is a known slop pattern.
115
+ 2. Use one consistent term per concept ("extract", never also "pull", "get", "retrieve")
116
+ [B6]. Synonym drift makes the agent unsure whether two terms name the same operation.
117
+
118
+ ## Body content
119
+
120
+ The body persists in context every turn the skill is active, so each line is a recurring
121
+ cost. Spend lines only where the agent would otherwise go wrong.
122
+
123
+ Rules:
124
+
125
+ 1. State what to do, not how or why, and cut anything the model already knows [B2]. Claude is
126
+ already capable; the body is for the project-specific and the non-obvious.
127
+ 2. Apply the test "would the agent get this wrong without it?" to every instruction. If no,
128
+ delete it [B7]. Instructions that restate default competence are pure token cost.
129
+ 3. Challenge every paragraph with "does this justify its token cost?" and prefer one excellent
130
+ example over many mediocre ones [B3].
131
+ 4. Lead each section with one bold maxim and close it with one concrete self-check [B4]. The
132
+ maxim is what survives in context; the check lets the agent apply the rule mid-task.
133
+ 5. Put gotchas as concrete corrections, placed early [B5]. A correction only helps if the
134
+ agent reads it before it makes the mistake. Write the specific fact, not general advice:
135
+
136
+ ```markdown
137
+ ## Gotchas
138
+ - The `users` table uses soft deletes. Queries must include `WHERE deleted_at IS NULL`.
139
+ - User id is `user_id` in the DB, `uid` in auth, `accountId` in billing. Same value.
140
+ - The `/health` endpoint returns 200 even when the DB is down. Use `/ready`.
141
+ ```
142
+
143
+ 6. Carry reference and decision material in tables and numbered lists. Use a flowchart only
144
+ for a genuinely non-obvious decision or an early-stop loop [B10]. Tables are denser per
145
+ token; flowcharts waste tokens on reference, code, or linear steps.
146
+ 7. State the tradeoff and ship an escape hatch instead of policing edge cases with long
147
+ rationalization tables [B8]. Add an Excuse-and-Reality table only for a discipline skill
148
+ where an eval has actually shown the agent rationalizing a violation.
149
+ 8. Avoid time-sensitive content. Move deprecated material into a collapsed "Old patterns"
150
+ section [B9]. Dated instructions rot and mislead.
151
+
152
+ ## Self-check
153
+
154
+ Before shipping the skill, confirm each line:
155
+
156
+ - [ ] `name` matches the directory, is lowercase-hyphen, and carries no `claude`/`anthropic`.
157
+ - [ ] `description` reads as "Use when ...", third person, with front-loaded triggers and at
158
+ least one indirect trigger.
159
+ - [ ] No invented frontmatter fields; optionals are drawn only from the table above.
160
+ - [ ] Side-effecting skill sets `disable-model-invocation`.
161
+ - [ ] Body is imperative, with one term per concept.
162
+ - [ ] Every instruction passes "would the agent get this wrong without it?".
163
+ - [ ] Gotchas are concrete corrections, placed early.
164
+ - [ ] Reference and decision material is in tables or lists, not prose.
165
+ - [ ] `references/` files are one level deep; no orphan or auxiliary files in the skill.