save-before-compactlisted
Install: claude install-skill damson/hard-won-skills
# Save before compact
## Procedure
Run a task per step, in order. Any step can short-circuit per its stated skip
conditions.
### Step 1 — Pre-flight
- Count substantive turns (ignore < 10-word acknowledgements: `thanks`, `ok`,
`yes`, `nice`). If `< 15`, say so and skip straight to the resume brief (Step 8)
— nothing worth persisting, but the pick-up note still gets written.
- Detect context: is there a `CLAUDE.md` / `AGENTS.md` nearby? a skill-structure
test suite or a config eval command, if the repo ships either (check its
README / justfile / package scripts — do not assume names)? Record what's
available — later steps branch on it.
- Defer (one line, then stop) if a high-stakes op is in flight — scan the last
~5 turns for a deploy / merge / rebase / migration / incident command whose
completion was never confirmed (confirmed = its success output is in the
transcript, or the user said it landed) — or if this is another operator's transcript.
### Step 2 — Reflect & route
List candidate facts under these categories: commands discovered, code-style
patterns followed, testing approaches that worked, environment/config quirks,
gotchas, decisions made. Then apply the **keep-test** — keep a fact only if (a) it
would prevent a mistake a capable future session would realistically make (not
restate the default behaviour, or what a neighbouring directive/test already
implies) and (b) it is not already stated in an existing config/CLAUDE.md file.
When unsure, drop