@zalom/plastic 1.0.0-alpha.1 → 1.0.0-alpha.11

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 (41) hide show
  1. package/PLASTIC.md +106 -475
  2. package/hooks/hooks.json +0 -11
  3. package/hooks/statusline +50 -10
  4. package/package.json +1 -1
  5. package/scripts/doctor.rb +931 -0
  6. package/scripts/hook-session-start +47 -10
  7. package/scripts/install.rb +218 -30
  8. package/scripts/lib/bridge.rb +34 -0
  9. package/skills/_active-intent-gate.md +26 -0
  10. package/skills/auto/SKILL.md +22 -4
  11. package/skills/auto/references/agent-architecture.md +60 -0
  12. package/skills/brainstorming/SKILL.md +143 -0
  13. package/skills/continuing/SKILL.md +4 -0
  14. package/skills/continuing/references/context-management.md +32 -0
  15. package/skills/creating-intent/SKILL.md +5 -0
  16. package/skills/creating-intent/references/lifecycle.md +74 -0
  17. package/skills/creating-intent/references/wikilinks.md +8 -0
  18. package/skills/creating-project/SKILL.md +4 -0
  19. package/skills/creating-project/references/hubs-projects.md +55 -0
  20. package/skills/doctor/SKILL.md +116 -0
  21. package/skills/doctor/references/gates-stuck-detection.md +38 -0
  22. package/skills/doctor/report.md +96 -0
  23. package/skills/evaluating-skills/SKILL.md +140 -0
  24. package/skills/evaluating-skills/assets/eval-template.json +12 -0
  25. package/skills/evaluating-skills/evals/evals.json +75 -0
  26. package/skills/evaluating-skills/references/convention-checks.md +76 -0
  27. package/skills/evaluating-skills/references/eval-methodology.md +154 -0
  28. package/skills/linking-intents/SKILL.md +4 -0
  29. package/skills/linking-intents/references/zettelkasten.md +33 -0
  30. package/skills/managing-index/SKILL.md +4 -0
  31. package/skills/releasing/SKILL.md +92 -17
  32. package/skills/releasing/references/deprecations.md +44 -0
  33. package/skills/research/SKILL.md +114 -0
  34. package/skills/savepoint/SKILL.md +4 -0
  35. package/skills/savepoint/references/context-management.md +32 -0
  36. package/skills/update/SKILL.md +10 -2
  37. package/skills/writing-instructions/SKILL.md +159 -0
  38. package/skills/writing-instructions/references/agentskills-spec.md +135 -0
  39. package/skills/writing-plans/SKILL.md +183 -0
  40. package/templates/agents.md +16 -0
  41. package/templates/project.yml +5 -0
@@ -6,25 +6,62 @@ description: Use when merging a feature branch to main and tagging a release, bu
6
6
  # Releasing
7
7
 
8
8
  Merge, bump, tag, push. Annotated tags with changelogs. Semantic versioning.
9
+ Project configuration drives the workflow — no hardcoded assumptions.
9
10
 
10
11
  ## Checklist
11
12
 
12
- - [ ] All tests pass
13
+ - [ ] Read project config
14
+ - [ ] All tests pass (or verification skipped per config)
13
15
  - [ ] Merge feature branch to main
14
- - [ ] Bump version in plugin.json and marketplace.json
16
+ - [ ] Bump version in configured version files
15
17
  - [ ] Commit version bump
16
18
  - [ ] Create annotated tag
17
19
  - [ ] Push to remote with tags
20
+ - [ ] Run post-push actions (GitHub release, npm publish, etc.)
21
+ - [ ] Complete active intent
18
22
 
19
23
  ## Workflow
20
24
 
25
+ ### 0. Read Project Config
26
+
27
+ Before anything else, determine which project we are releasing and load its config.
28
+
29
+ 1. Read `~/.plastic/projects.yml` — find the project whose `path` matches the current working directory.
30
+ 2. Extract the project slug (the key under `projects:`).
31
+ 3. Read `~/.plastic/projects/{slug}/project.yml` — this contains the `release:` section.
32
+
33
+ Expected `release:` keys in project.yml:
34
+
35
+ ```yaml
36
+ release:
37
+ verify: "bin/rails test" # command to run before release
38
+ version_file: package.json # single file containing the version
39
+ version_files: # multiple files (overrides version_file)
40
+ - package.json
41
+ - .claude-plugin/plugin.json
42
+ tag_format: "v{{version}}" # tag naming pattern ({{version}} is replaced)
43
+ on_green: # actions to run after push succeeds
44
+ - github_release
45
+ - npm_publish
46
+ on_complete: commit_and_push # what to do with the version bump commit
47
+ on_red: stop # what to do if verification fails
48
+ ```
49
+
50
+ **Fallback:** If no project.yml exists or it has no `release:` section, fall back to asking the user for each step — verify command, version files, tag format, and post-push actions.
51
+
21
52
  ### 1. Verify Tests Pass
22
53
 
54
+ Run the verification command from `release.verify` in project.yml:
55
+
23
56
  ```bash
24
- ruby test/read_config_test.rb && ruby test/config_template_test.rb
57
+ # Example: release.verify = "ruby -Itest test/*_test.rb"
58
+ <verify-command-from-config>
25
59
  ```
26
60
 
27
- All tests must pass before release. Do not proceed if any fail.
61
+ - If `release.verify` is present: run it. All checks must pass before proceeding.
62
+ - If `release.verify` is absent or empty: skip verification. Log that no verify command is configured.
63
+ - If `release.on_red` is `stop`: abort the release on failure.
64
+ - If `release.on_red` is `fix_and_retry`: ask the user to fix and re-run.
28
65
 
29
66
  ### 2. Determine Version Bump
30
67
 
@@ -47,18 +84,26 @@ Always `--no-ff` to preserve branch history in the merge commit.
47
84
 
48
85
  ### 4. Bump Version
49
86
 
50
- Update ALL THREE files — they must stay in sync:
51
- - `package.json` → `"version": "X.Y.Z"`
52
- - `.claude-plugin/plugin.json` → `"version": "X.Y.Z"`
53
- - `.claude-plugin/marketplace.json` → `"version": "X.Y.Z"`
87
+ Determine which files to update from project.yml:
88
+
89
+ - If `release.version_files` is set: update ALL listed files (they must stay in sync).
90
+ - Else if `release.version_file` is set: update that single file.
91
+ - Else: ask the user which files contain the version.
92
+
93
+ Update the version string in each file, then commit:
54
94
 
55
95
  ```bash
56
- git add package.json .claude-plugin/plugin.json .claude-plugin/marketplace.json
96
+ git add <version-files>
57
97
  git commit -m "chore: bump version to X.Y.Z — [one-line summary]"
58
98
  ```
59
99
 
60
100
  ### 5. Create Annotated Tag
61
101
 
102
+ Read `release.tag_format` from project.yml to determine the tag name:
103
+
104
+ - If set (e.g. `"v{{version}}"`): replace `{{version}}` with the new version string.
105
+ - If not set: default to `vX.Y.Z`.
106
+
62
107
  Generate the changelog from commits since the last tag:
63
108
 
64
109
  ```bash
@@ -68,7 +113,7 @@ git log $(git describe --tags --abbrev=0)..HEAD --oneline --no-merges | grep -E
68
113
  Create the tag with a multi-line message:
69
114
 
70
115
  ```bash
71
- git tag -a vX.Y.Z -m "vX.Y.Z — [release name]
116
+ git tag -a <tag-name> -m "<tag-name> — [release name]
72
117
 
73
118
  - [changelog bullet points from feat/fix/refactor commits]"
74
119
  ```
@@ -79,16 +124,42 @@ git tag -a vX.Y.Z -m "vX.Y.Z — [release name]
79
124
  git push origin main --tags
80
125
  ```
81
126
 
82
- ### 7. GitHub Release
127
+ ### 7. Post-Push Actions
128
+
129
+ Read `release.on_green` from project.yml. This is a list of actions to run after a successful push. Execute each in order:
83
130
 
84
- Create a GitHub release from the tag. Use `--generate-notes` to auto-generate changelog from commits since the previous tag:
131
+ #### `github_release`
132
+
133
+ Create a GitHub release from the tag:
85
134
 
86
135
  ```bash
87
- gh release create vX.Y.Z --title "vX.Y.Z — [release name]" --generate-notes --notes-start-tag <previous-tag>
136
+ gh release create <tag-name> --title "<tag-name> — [release name]" --generate-notes --notes-start-tag <previous-tag>
88
137
  ```
89
138
 
90
139
  For the first release (no previous tag), write notes manually with `--notes "..."` instead.
91
140
 
141
+ #### `npm_publish`
142
+
143
+ Publish the package to npm:
144
+
145
+ ```bash
146
+ # For pre-release versions (0.x.y, or version contains -alpha/-beta/-rc):
147
+ npm publish --access public --tag alpha
148
+
149
+ # For stable versions (>= 1.0.0, no pre-release suffix):
150
+ npm publish --access public
151
+ ```
152
+
153
+ #### Other values
154
+
155
+ If `on_green` contains an action not listed above, log it:
156
+
157
+ ```
158
+ [releasing] Action "<action>" is configured but not yet implemented. Skipping.
159
+ ```
160
+
161
+ If `on_green` is empty or absent: skip post-push actions entirely.
162
+
92
163
  ### 8. Complete Active Intent
93
164
 
94
165
  A release IS a delivery. The active intent that drove this work must be completed as part of the release process. This is NOT optional.
@@ -100,17 +171,17 @@ A release IS a delivery. The active intent that drove this work must be complete
100
171
  c. Update `## Insights` with final observations
101
172
  d. Move from `## Active` to `## Completed` in INDEX.md (with today's date)
102
173
  e. Update clusters to show `_(completed)_`
103
- 3. Auto-commit: `cd ~/.plastic && git add . && git commit -m "feat: complete intent <ID> — delivered in v<X.Y.Z>"`
174
+ 3. Auto-commit: `cd ~/.plastic && git add . && git commit -m "feat: complete intent <ID> — delivered in <tag-name>"`
104
175
 
105
176
  **If no active intent exists for this release**, that itself is a problem — work happened outside the intent system. Log it and move on, but flag it.
106
177
 
107
178
  ## Conventions
108
179
 
109
180
  - **Annotated tags only** — `git tag -a`, never lightweight tags
110
- - **Tag format** — `vX.Y.Z` (lowercase v prefix)
111
- - **Tag message** — first line: `vX.Y.Z — [short name]`, then blank line, then bullet changelog
181
+ - **Tag format** — driven by `release.tag_format` in project.yml (default: `vX.Y.Z`)
182
+ - **Tag message** — first line: `<tag> — [short name]`, then blank line, then bullet changelog
112
183
  - **Commit prefixes** — `feat:`, `fix:`, `refactor:`, `chore:`, `docs:` (conventional commits)
113
- - **Version files** — package.json, plugin.json, and marketplace.json always match
184
+ - **Version files** — driven by project.yml; all listed files must always match
114
185
  - **Branch cleanup** — delete merged feature branches: `git branch -d <branch>`
115
186
 
116
187
  ## Retroactive Tagging
@@ -122,3 +193,7 @@ git tag -a v0.1.0 <commit-sha> -m "v0.1.0 — [description]"
122
193
  ```
123
194
 
124
195
  Use `git log --oneline` to find the right commits (look for version bump commits or major feature merges).
196
+
197
+ ## References
198
+
199
+ - Read `references/deprecations.md` for the full deprecation process, severity levels, deprecations.yml schema, and dismissal rules when adding or managing deprecations
@@ -0,0 +1,44 @@
1
+ # Deprecation Process
2
+
3
+ When removing a feature, changing a convention, or making a breaking change:
4
+
5
+ 1. Add entry to `deprecations.yml` in the Plastic source root
6
+ 2. Set severity: `info` (awareness), `warning` (action needed), `critical` (urgent)
7
+ 3. Provide clear migration steps
8
+ 4. Set `removal` version at least 2 minor versions ahead
9
+ 5. SessionStart hook displays active deprecations automatically
10
+ 6. Remove the feature AND the deprecation entry together
11
+
12
+ ## Severity Levels
13
+
14
+ | Severity | When to use | Dismissable? |
15
+ |----------|-------------|--------------|
16
+ | `info` | Upcoming change | Yes |
17
+ | `warning` | Action needed | Yes (re-shown at removal) |
18
+ | `critical` | Urgent/security | Never |
19
+
20
+ ## deprecations.yml Schema
21
+
22
+ ```yaml
23
+ deprecations:
24
+ - id: unique-slug
25
+ severity: info | warning | critical
26
+ summary: "One-line description"
27
+ migration_steps:
28
+ - "Step 1"
29
+ - "Step 2"
30
+ introduced: "0.9.0"
31
+ removal: "1.0.0"
32
+ link: "optional URL"
33
+ ```
34
+
35
+ ## Dismissal
36
+
37
+ Users dismiss by adding the id to `deprecations_dismissed` in `config.yml`:
38
+
39
+ ```yaml
40
+ deprecations_dismissed:
41
+ - some-deprecated-feature
42
+ ```
43
+
44
+ Critical deprecations and final-version warnings ignore dismissal.
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: plastic:research
3
+ description: "Research a topic for the active intent. Agent decides shallow vs deep based on scope. Produces reports in the intent's resources/ directory."
4
+ ---
5
+
6
+ # Research
7
+
8
+ Investigate a topic related to the active intent. Choose the right depth, produce a cited report.
9
+
10
+ **Announce at start:** "I'm researching [topic] for intent {id} — {name}."
11
+
12
+ ## Active Intent Gate
13
+
14
+ Before proceeding, resolve the active intent:
15
+
16
+ 1. **Detect store:** Read `~/.plastic/projects.yml`, match CWD against registered project paths. If match → project store at `~/.plastic/projects/{slug}/store/`. If no match → global store at `~/.plastic/store/`.
17
+ 2. **Find active intent:** Read `INDEX.md` from the detected store. Look under `## Active`. If exactly one → use it. If multiple → ask which. If none → refuse: "No active intent. Create one first with /plastic:creating-intent"
18
+ 3. **Resolve intent directory:** `{store}/store/{id}--{slug}/`
19
+
20
+ ## Depth Decision
21
+
22
+ Before starting research, assess the question against these criteria:
23
+
24
+ ### Shallow Research
25
+ Use when:
26
+ - The question is narrow and factual (e.g., "what's the API for X?", "does library Y support Z?")
27
+ - A single source or quick search is sufficient
28
+ - The answer is likely well-documented
29
+ - Time budget: minutes, not hours
30
+
31
+ **Method:** Direct web search + codebase exploration + single-pass synthesis.
32
+
33
+ ### Deep Research
34
+ Use when:
35
+ - The question needs multiple sources and cross-verification
36
+ - It's a landscape survey, competitive analysis, or architectural decision
37
+ - The user explicitly asks for thorough/exhaustive/comprehensive research
38
+ - Conflicting information exists and needs adversarial verification
39
+ - Time budget: significant, user expects depth
40
+
41
+ **Method:** Delegate to the native agent's deep research capability.
42
+ - On Claude Code: invoke the `deep-research` skill via `Skill` tool
43
+ - On other agents: use the agent's equivalent (see intent 7 for cross-agent mapping)
44
+ - If no native deep research exists: fan out multiple web searches manually, cross-reference, synthesize
45
+
46
+ ### Decision Heuristic
47
+
48
+ Ask yourself:
49
+ 1. Can I answer this with 1-2 searches? → **Shallow**
50
+ 2. Do I need to compare 3+ sources? → **Deep**
51
+ 3. Is the user asking for a survey or landscape view? → **Deep**
52
+ 4. Am I fact-checking a specific claim? → **Shallow**
53
+ 5. Could wrong information here cause architectural mistakes? → **Deep**
54
+
55
+ Announce your choice: "This needs [shallow/deep] research because [reason]."
56
+
57
+ ## Output
58
+
59
+ ### File Location
60
+ `{intent_dir}/resources/{type}--{topic}.md`
61
+
62
+ Create the resources/ directory if it doesn't exist.
63
+
64
+ ### Naming Convention
65
+ - `{type}` — one of: `deep-research`, `competitive-analysis`, `technical-spike`, `reference`, `landscape-survey`
66
+ - `{topic}` — kebab-case description of the research subject
67
+
68
+ Examples:
69
+ - `deep-research--installer-patterns.md`
70
+ - `technical-spike--sqlite-vec-performance.md`
71
+ - `reference--claude-code-hooks-api.md`
72
+ - `landscape-survey--ai-agent-ecosystem.md`
73
+
74
+ ### Report Structure
75
+
76
+ ```markdown
77
+ # {Type}: {Topic}
78
+
79
+ **Intent:** {id} — {name}
80
+ **Depth:** shallow | deep
81
+ **Date:** YYYY-MM-DD
82
+
83
+ ## Summary
84
+ [2-3 sentence executive summary]
85
+
86
+ ## Findings
87
+
88
+ ### [Finding 1 title]
89
+ [Details with inline citations where applicable]
90
+
91
+ ### [Finding 2 title]
92
+ ...
93
+
94
+ ## Sources
95
+ - [Source 1 title](url) — what was learned from this source
96
+ - [Source 2 title](url) — ...
97
+
98
+ ## Relevance to Intent
99
+ [How these findings affect the active intent's decisions or design]
100
+ ```
101
+
102
+ ## After Research
103
+
104
+ 1. Commit to store repo:
105
+ ```
106
+ cd {store_root} && git add . && git commit -m "research: {type} — {topic} (intent {id})"
107
+ ```
108
+
109
+ 2. Log in intent's `## Insights`:
110
+ ```
111
+ - Research: {type} — {topic}. Key finding: [one sentence]. See resources/{filename}.
112
+ ```
113
+
114
+ 3. Research does NOT chain to any other skill. It's a side quest — the user decides what to do with the findings.
@@ -55,3 +55,7 @@ git commit -m "chore: savepoint — [active intent name]"
55
55
 
56
56
  ### 5. Notify User
57
57
  Tell the user: "Context is getting large. I've saved progress to intent [ID] — [name]. Please run `/clear` and say `continue` to resume."
58
+
59
+ ## References
60
+
61
+ - Read `references/context-management.md` for the full save/continue protocol when the save flow needs debugging or you need to understand the full resume sequence
@@ -0,0 +1,32 @@
1
+ # Context Management (Start-Save-Continue)
2
+
3
+ ## Save Point
4
+ Triggered by PreCompact hook or manually:
5
+ 1. Find active intent(s) from `~/.plastic/INDEX.md`
6
+ 2. Update active intent's `checklist.md` (check off completed items)
7
+ 3. Update active intent's `savepoint.md` (in-progress, next steps, blockers, discoveries)
8
+ 4. Add observations to `## Insights`
9
+ 5. Update INDEX.md
10
+ 6. Commit: `cd ~/.plastic && git add . && git commit -m "chore: savepoint — [intent name]"`
11
+ 7. Notify user to `/clear`
12
+
13
+ ## Continue
14
+ Triggered by UserPromptSubmit hook when user says "continue". Priority order:
15
+
16
+ **1. Active intents first (resume work):**
17
+ 1. Read INDEX.md → find active intent(s)
18
+ 2. Read active intent's `intent.md` → what and why
19
+ 3. Read active intent's `savepoint.md` → where we left off
20
+ 4. Read active intent's `checklist.md` → what's next
21
+ 5. Announce: intent name, current state, next step, blockers
22
+ 6. Resume
23
+
24
+ **2. No active intents → offer future intents:**
25
+ 1. List all future intents from INDEX.md
26
+ 2. Present them as options
27
+ 3. When user picks one, move to Active in INDEX.md
28
+
29
+ **3. Stale future intents (untouched 3+ days) → triage:**
30
+ - **activate** — start working on it now
31
+ - **abandon** — mark as abandoned
32
+ - **defer to agent** — implement, research, or ideate
@@ -54,13 +54,21 @@ Key changes in this version:
54
54
  Recommendation: run /clear for a clean session with all new conventions loaded.
55
55
  ```
56
56
 
57
- ### Step 4: Commit
57
+ ### Step 4: Run health check
58
+
59
+ Invoke `plastic:doctor` to verify the installation is healthy after the update.
60
+
61
+ If all checks pass, show: **"Health check: all clear."**
62
+
63
+ If issues are found, show the full doctor report and offer to fix any fixable items.
64
+
65
+ ### Step 5: Commit
58
66
 
59
67
  ```bash
60
68
  cd ~/.plastic && git add PLASTIC.md scripts/ AGENTS.md VERSION 2>/dev/null && git commit -m "chore: update Plastic core files" --allow-empty
61
69
  ```
62
70
 
63
- ### Step 5: Clear update cache
71
+ ### Step 6: Clear update cache
64
72
 
65
73
  ```bash
66
74
  rm -f ~/.plastic/.cache/update-check.json
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: writing-instructions
3
+ description: >
4
+ Write or restructure agent instructions, conventions files, and SKILL.md
5
+ content using progressive disclosure and the agentskills.io specification.
6
+ Use when creating PLASTIC.md, rewriting convention docs, authoring new
7
+ skills, restructuring large instruction files to fit context budgets,
8
+ or when instructions feel too long, too vague, or agents aren't following
9
+ them. Also use when the user says "progressive disclosure", "restructure
10
+ instructions", or "the instructions are too big".
11
+ ---
12
+
13
+ # Writing Agent Instructions
14
+
15
+ Based on the [agentskills.io specification](https://agentskills.io).
16
+
17
+ ## Progressive Disclosure Architecture
18
+
19
+ All agent instructions follow three loading stages. Design for this — it's the
20
+ architecture, not a nice-to-have.
21
+
22
+ | Stage | What loads | Budget | Design for |
23
+ |-------|-----------|--------|------------|
24
+ | **Discovery** | name + description | ~100 tokens | Trigger accuracy |
25
+ | **Activation** | Full instruction body | <5000 tokens / <500 lines | Core procedures |
26
+ | **Execution** | references/, scripts/, assets/ | As needed | Deep detail |
27
+
28
+ **The description carries the entire burden of triggering.** If agents aren't
29
+ activating your skill, the description is the problem.
30
+
31
+ ## Procedure
32
+
33
+ ### Step 1: Audit the content
34
+
35
+ Before writing or restructuring, classify every piece of content:
36
+
37
+ | Classification | Where it goes | Example |
38
+ |---------------|---------------|---------|
39
+ | **Trigger context** | description field | "Use when...", keywords |
40
+ | **Core procedure** | SKILL.md body | Step-by-step workflows |
41
+ | **Gotchas** | SKILL.md body (early) | Facts that defy assumptions |
42
+ | **Deep reference** | references/ | API details, full schemas |
43
+ | **Templates** | assets/ or inline | Output format examples |
44
+ | **Executable logic** | scripts/ | Validation, data processing |
45
+
46
+ Ask for each piece: "Would the agent get this wrong without this?"
47
+ If no — cut it. If unsure — test it.
48
+
49
+ ### Step 2: Write the description
50
+
51
+ The description must convey WHEN to use, not just WHAT it does.
52
+
53
+ **Rules:**
54
+ - Imperative phrasing: "Use this skill when..." not "This skill does..."
55
+ - Focus on user intent, not implementation
56
+ - Err on the side of being pushy — list contexts explicitly
57
+ - Include cases where user doesn't name the domain directly
58
+ - Under 1024 characters (hard limit)
59
+ - Include specific trigger keywords
60
+
61
+ **Template:**
62
+ ```yaml
63
+ description: >
64
+ [One sentence: what it does]. Use when [primary trigger context],
65
+ [secondary trigger], or when [indirect trigger where user doesn't
66
+ name the domain]. Also use when [edge case trigger].
67
+ ```
68
+
69
+ ### Step 3: Write the body
70
+
71
+ **Principles (in priority order):**
72
+
73
+ 1. **Procedures over declarations** — Teach HOW to approach a class of problems,
74
+ not WHAT to produce for a specific instance
75
+ 2. **Defaults, not menus** — Pick one approach, mention alternatives briefly.
76
+ "Use X. For Y cases, use Z instead." Never present options as equals.
77
+ 3. **Calibrate control to fragility** — Prescriptive for fragile/sequential tasks,
78
+ flexible when multiple approaches are valid. Most skills have a mix.
79
+ 4. **Reasoning over rigid directives** — "Do X because Y tends to cause Z" beats
80
+ "ALWAYS do X, NEVER do Y"
81
+ 5. **Add what the agent lacks, omit what it knows** — No explaining HTTP, PDFs,
82
+ or what a migration is. Jump to what's non-obvious.
83
+
84
+ **Structure:**
85
+ ```markdown
86
+ # Title
87
+
88
+ [1-2 sentence purpose statement]
89
+
90
+ ## Gotchas
91
+ - [Highest-value content first — facts that defy assumptions]
92
+ - [Each gotcha is a concrete correction, not general advice]
93
+
94
+ ## Procedure
95
+ ### Step 1: ...
96
+ ### Step 2: ...
97
+
98
+ ## Patterns
99
+ [Only if the skill covers multiple approaches to similar problems]
100
+ ```
101
+
102
+ ### Step 4: Extract to references/
103
+
104
+ Anything over 500 lines or 5000 tokens goes to `references/`. But tell the
105
+ agent WHEN to load each file — conditional references, not a generic "see
106
+ references/ for details."
107
+
108
+ **Good:** "Read `references/api-errors.md` if the API returns a non-200 status"
109
+ **Bad:** "See references/ for more information"
110
+
111
+ ### Step 5: Validate
112
+
113
+ Run through this checklist:
114
+
115
+ - [ ] Description under 1024 chars
116
+ - [ ] Body under 500 lines / 5000 tokens
117
+ - [ ] Every instruction passes "would the agent get this wrong without it?"
118
+ - [ ] Gotchas are concrete corrections, not general advice
119
+ - [ ] Defaults chosen, not menus presented
120
+ - [ ] Control calibrated: prescriptive where fragile, flexible where tolerant
121
+ - [ ] References have conditional load triggers
122
+ - [ ] No explaining what the agent already knows
123
+
124
+ For structured evaluation beyond this checklist (paired evals, pass rate
125
+ tracking, regression testing), use `plastic:evaluating-skills`.
126
+
127
+ ## Gotchas
128
+
129
+ - Hook `additionalContext` truncates at **10,000 characters**. If instructions
130
+ must load via hooks (not skills), they must fit this budget.
131
+ - `~/.claude/rules/*.md` files load fully with no truncation — use for
132
+ always-loaded conventions that don't fit in a skill.
133
+ - CLAUDE.md supports `@path/to/file` imports (max depth 4) — another way
134
+ to load large instruction sets without truncation.
135
+ - Agents only consult skills for tasks beyond what they can handle alone.
136
+ Simple one-step requests may not trigger even with a perfect description.
137
+ - Content from real domain expertise (runbooks, incident reports, code review)
138
+ dramatically outperforms LLM-generated instructions without project context.
139
+ - The most common cause of agents not following instructions: the instruction
140
+ was too vague, didn't apply to the current task, or presented too many
141
+ options without a clear default. Read execution traces to diagnose.
142
+
143
+ ## For Convention Files (PLASTIC.md, CLAUDE.md)
144
+
145
+ Convention files aren't skills — they load differently. Apply progressive
146
+ disclosure by splitting:
147
+
148
+ | Layer | Mechanism | Budget | Content |
149
+ |-------|-----------|--------|---------|
150
+ | **Always-on** | `~/.claude/rules/` or hook | <10K chars | Core identity, gotchas, critical procedures |
151
+ | **On-demand** | Skills (SKILL.md) | <5K tokens each | Specific workflows activated by task |
152
+ | **Deep reference** | `references/` in skills | Unlimited | Full specs, schemas, examples |
153
+
154
+ **The always-on layer should answer: "What does this agent need to know about
155
+ every single task?"** Everything else activates on demand.
156
+
157
+ ## References
158
+
159
+ - Read `references/agentskills-spec.md` for the complete agentskills.io specification including frontmatter fields, description optimization methodology, evaluation framework, and script design requirements