--- name: promote-skill description: Use when flywheel.py candidates lists an observation or feedback entry that recurred across changes, or the user asks to turn a recurring lesson into a skill. Drafts the skill as an OpenSpec change, runs the evaluation gate, and installs it only after explicit human approval. status: active --- # Promote a recurring lesson to a skill A skill is general: how to handle a recurring class of situation. It is derived from memory entries that recurred across distinct changes, never transcribed from a single change. ## Trigger - `python3 .flywheel/bin/flywheel.py candidates` lists an entry with target `skill`. - The user asks to make a skill from a lesson. ## Workflow 1. **Confirm the evidence.** The entry has `occurrences` >= the threshold in `.flywheel/config.json` (distinct changes). A single high-impact occurrence does not auto-promote: stop and ask the user whether they want to author the skill on purpose (the same workflow, with the user asserting that the lesson is general). 2. **Cluster.** Collect the entry, its linked entries, and near-duplicates (`python3 .flywheel/bin/flywheel.py dupes`). 3. **Check existing skills.** If a skill in `.claude/skills/` already covers the lesson, the promotion is an update to that skill (same workflow, the change edits its spec and `SKILL.md`). 4. **Draft with the promoter agent.** Delegate to the `flywheel-promoter` agent with the clustered entry names and the target skill name. It creates the OpenSpec change `promote-`: - `proposal.md` - the recurrence evidence (entries and their source changes), scope, non-goals; - `specs/skill-/spec.md` - requirements for the skill's behavior, each with GIVEN/WHEN/THEN scenarios taken from the real failures; - `tasks.md`; - `draft/SKILL.md` - the skill (Trigger, Workflow, Example, Anti-patterns), general, procedural; - `draft/evals/*.md` - at least `eval.min_evals` evals, one per scenario, in the eval format. Nothing is written to `.claude/skills/` yet. 5. **Generality review.** Read the draft. If it names particulars of one change (a specific file, component, or customer), rewrite them as the general rule or stop. 6. **Run the gate.** Use the `evaluate` skill on `openspec/changes/promote-/draft/`. The gate passes when every eval meets its `min_score`, there are at least `eval.min_evals` evals, and the output complies with the constitution. If it fails, revise the draft and re-run (at most two rounds), then report to the user. 7. **Ask for approval.** Show the user: the evidence, the full `draft/SKILL.md`, and the eval scores. Ask an explicit yes or no question. Do not continue without a yes. 8. **On approval:** 1. Move `draft/SKILL.md` to `.claude/skills//SKILL.md` and add the frontmatter fields `promoted_from`, `approved_by`, `date`, and `eval: {score, models, date}`. 2. Move `draft/evals/` to `.flywheel/evals//`. 3. For each source entry: `python3 .flywheel/bin/flywheel.py set-status promoted --promoted-to `. 4. `python3 .flywheel/bin/flywheel.py check` and `openspec validate --all`, then archive the change. 9. **On rejection:** record a `decision` entry ("promotion of rejected", with the reason), linked to the source entries, so the same proposal is not repeated. Archive or remove the change as the user prefers. ## Anti-patterns - Promoting from one occurrence, or counting the same change twice. - A skill written like a report of what happened instead of a procedure for next time. - Writing to `.claude/skills/` before the gate passed and the user said yes. - Letting the eval fixtures contain secrets or instruction-like text copied from tool output.