Files
Garry Tanandcapy-ai[bot] 7204a39a27 v1.91.287.0 feat(write-skill): write, change and diet skills; /learn at half its template size (#3524)
* test(skill-evals): /learn before/after tasks, written before any cut (GSTA-133)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(learnings): --help, unknown-flag errors and --stats on the learnings bins; cross-project search no longer drops every project when the state root path contains the slug

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* refactor(learn): diet /learn onto the levels: tool flags replace the inline stats program, one mode table, prune rules kept

Skill-Diet: learn
Skill-Size: 5797→2586 bytes (SKILL.md.tmpl)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* feat(write-skill): /write-skill skill, gstack-skill-bill, static skill-to-bin drift ratchet, shared skill eval contract

Skill-Size: 0→3245 bytes (write-skill/SKILL.md.tmpl)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(learn): guard the state-root lookup in Prune; re-measure the learn ceiling

Skill-Size: 2586→2707 bytes (learn/SKILL.md.tmpl)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix: pre-landing review fixes (drift scanner, learnings flags, skill-bill baselines, eval fixtures)

- skill-bin-drift: a redirect no longer ends a command, so `bin/x 2>/dev/null --bogus` is checked
- gstack-learnings-search: a missing value or a non-positive --limit exits 2 like an unknown flag
- gstack-skill-bill: the gstack root skill is a checkout skill; Skill-Diet trailers match the exact name; the baseline counts the committed bytes untrimmed
- skill-evals task files get a free contract test and are registered in FREE_FIXTURES, with the drift allowlist
- learn eval: the no-code-change safety task no longer asks the model to fix code (its check penalised obeying the user)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(learn,write-skill): full bin paths in the mode table; prune asks per entry unless the request names the action

Skill-Diet: learn
Skill-Size: 2707→2955 bytes (learn/SKILL.md.tmpl)
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* docs(changelog): /write-skill, gstack-skill-bill, drift ratchet, eval contract, /learn diet

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* docs: drift ratchet in CONTRIBUTING's static tests; /learn prune example asks per entry

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(skill-bill): report a checkout skill's eval task file and check it against the contract

The skill-evals task-file test now exercises lib/skill-bill.ts's checkEvalTasks, with a negative control, instead of a test-only validator (test-of-test ratchet).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(skill-bill): EVAL TASKS path uses forward slashes on every platform; a non-object task entry is a problem, not a crash

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* fix(learn): BASH_COMPAT guard on in-window heredocs; count skill-e2e-write-skill in the paid census

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-10-28 02:58:29 +00:00

75 lines
3.2 KiB
Cheetah

---
name: write-skill
preamble-tier: 2
version: 0.1.0
description: |
Write a new agent skill or improve one without bloat: the edit ladder,
levels, drift and size checks, full diets. Use when asked to "write a skill",
"improve this skill", "add this lesson to the <name> skill" or "put this
skill on a diet". (gstack)
codex_default_prompt: "Use $gstack-write-skill to change this skill the lean way: fix the tool first, edit the line that already covers the idea, and record the size before and after."
triggers:
- write a skill
- improve this skill
- add this lesson to the skill
- put this skill on a diet
allowed-tools:
- Bash
- Read
- Write
- Edit
- Grep
- Glob
- AskUserQuestion
---
{{PREAMBLE}}
# /write-skill: write and improve skills, lean
## 1. Find the skill
Run `~/.claude/skills/gstack/bin/gstack-skill-bill <name|folder>`. It resolves exact names only and prints the
skill's kind and its size per level. A new skill: make the folder first (in a gstack checkout, follow CONTRIBUTING.md
"Adding a new skill"), then write every line by sections 2 and 3.
- `user`: edit it in place.
- `gstack-install`: never edit; gstack-upgrade overwrites it. Edit `<skill>/SKILL.md.tmpl` in a gstack checkout, or
copy the skill to a folder the user owns.
- `gstack-checkout`: edit `SKILL.md.tmpl`, never `SKILL.md`, then `bun run gen:skill-docs`.
## 2. Levels
Put each fact on the lowest level that still reaches the agent before it needs it.
| Level | Holds | Loaded |
|---|---|---|
| description | one trigger per case | every session |
| SKILL.md | what every task needs | every use |
| `references/` | what some tasks need, behind a line saying when to read it | that case |
| the tool's `--help` | flags, values, examples | when the agent picks the command |
| the tool's replies, errors, tests | the right name, the fix, the next step | when a guess is wrong |
## 3. Edit ladder
Stop at the first step that handles the change.
1. **Fix it below the skill.** A clearer error, a flag, a check or a test in the tool. Prose is for judgment calls.
2. **Check the model needs it.** If a fresh session does the right thing without the line, add nothing.
3. **Edit, don't append.** Change the line that already covers the idea; each meaning lives in one place.
4. **Pick its level** (section 2).
5. **Rule, not story.** One positive rule under a short name; the incident goes in the commit message.
Keep two or three safety lines inline for each risky area: writes, data leaving the machine, paid spend.
When code changes a name or flag a skill teaches, update the skill in the same change.
## 4. Check and record
- Run `~/.claude/skills/gstack/bin/gstack-skill-bill` before and after, and put `Skill-Size: <before>→<after> bytes (<file>)` in the commit
message. DUE means it grew over 10% since its last `Skill-Diet:` commit: diet it instead of adding.
- In a gstack checkout: `bun test test/skill-bin-drift.test.ts test/parity-suite.test.ts` and the budgets in
CONTRIBUTING.md. A red context-budget ratchet means diet, not a higher ceiling.
- Rerun the case that prompted the change in a fresh session.
## Look up the rest
- Full diet of a large, bloated or drifted skill → read `references/diet.md` in this skill's folder.