Orchestrates statechart and spock to discover, verify, and enforce higher-level abstractions that eliminate entire classes of bugs. Use when multiple bugs share state/lifecycle coupling, writers contend on resources, or callers manually enforce protocol invariants.
Ships in abstraction-discovery. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Verification is wasted if it only validates a fragile design guard by guard. Use statechart to expose where state, writer, and guard complexity live, use spock to verify that a deeper abstraction preserves intended behavior across finite and unbounded regimes, and enforce that abstraction in types, ownership, and module boundaries while deleting the machinery it replaces.
Ask before patching: What abstraction makes this entire class of bugs impossible to express, rather than adding another conditional guard?
Invoke this workflow only when code shows structural symptom signals — typically at least one of:
>= 2 related bugs) across retries, cancellation, concurrency, or recovery paths.>= 2) mutating the same counter, lifecycle flags, lock, or cleanup path.Early exit gate: If Stage 1 diagnosis shows the issue is isolated and a 5-line local fix is simpler and safer than introducing a new abstraction, stop, recommend the local fix, and do not force a redesign.
By default, operate in Propose & Verify first mode: complete Stages 1–3, present the verified candidate design, before/after comparison, and Displacement Ledger, and stop for explicit user approval before editing production code (Stage 4). Proceed straight through Stage 4 only when the user explicitly requests end-to-end implementation.
| Reference | Read when you need |
|---|---|
| references/abstraction-catalog.md | 12 recurring problem → candidate abstraction patterns paired with failure hazards (async Drop, centralization deadlocks, typestate friction) and the Rust Enforcement Appendix |
| references/evaluation-and-handoff.md | Before/after comparison scorecard, Displacement Ledger template, 3-Tier Guarantee Ledger template, reusable agent prompt, and hand-off checklist |
| references/examples/permit_pool/README.md | Complete runnable before/after worked example (BeforePool.tla → abstract_pool.spock → scoped_permit_pool.spock) |
(The skill's own 4-stage workflow is dogfooded and verified in the repo at notes/abstraction-discovery/ via Workflow.tla and workflow.spock.)
statechart)Delegate baseline modeling to the statechart skill in a scratch directory outside the repo:
Assume_* operators so statechart runs sensitivity checks and exposes hidden assumptions.Never blindly lock in bugs of the existing code (Statechart bug paths often expose a flawed implicit contract). Consult references/abstraction-catalog.md, then:
Abstract) — e.g. an abstract .spock module (spec main) defining only the state and guarantees callers actually need (typically <= 5 core states/relations), intentionally omitting internal bookkeeping and buggy recovery states.Impl) that collapse independent flags, centralize ownership, eliminate invalid states, or turn distributed accounting into localized Linear/RAII/Typestate/Reconciliation interfaces.statechart + spock)Verify candidates before touching production code:
statechart): model the candidate alongside the baseline under the same rules; verify fewer independent states/writers and clearer ownership without simply hiding states in view.py.spock):
refines = [abstract::main via State::as_abstract]) to confirm the candidate implements the intended caller contract rather than drifting or preserving bugs.spock prove on an unbounded model where relational encoding allows (prefer Set<(A, B)> / EPR formulas so spock prove stays fast and avoids partial-map / abstract-sort unknowns), or spock check --symbolic --depth N for large thresholds and arithmetic.spock check --symbolic and spock prove use mathematical unbounded Int, never machine 64-bit wrapping/saturation; model overflow bounds, wrapping, or saturation explicitly before claiming integer arithmetic is verified.spock prove fails, distinguish all 4 CTI triage outcomes before deciding whether to revise the design or strengthen inductive: (1) reachable safety bug, (2) reachable false inductive helper, (3) unreachable within N steps (unresolved beyond depth N, NOT proven impossible), and (4) genuinely unreachable CTI.spock prove and --symbolic skip deadlock and liveness (Temporal) rules. Explicitly verify on finite models (with statechart or spock check without symmetry) that centralization introduces no deadlock, lock-ordering cycle, starvation, or stuck cancellation-drain state.const NAIVE_DROP = true; expect = invariant(...)) to verify the safety and refinement checks actually fail (expect caught by spock test).Carry out implementation incrementally once approved (avoid big-bang rewrites):
Clone/linear handles, sealed enums, or typestate APIs so invalid states and caller ordering bugs fail to compile or fail centrally. Account for async teardown vs Drop, contention, and API ergonomics (see references/abstraction-catalog.md).git diff.trybuild, compile_fail doctests), runtime conformance tests (spock_trace with --require-all-actions --require-all-fields or everystate conform -trace), and fault/cancellation tests. Deliver the 3-Tier Guarantee Ledger from references/evaluation-and-handoff.md separating structurally enforced, runtime-checked / traced, and model-only / assumed claims.implementation-simplification.statechart..spock specs or checking runtime traces: hand off to spock.code-walkthrough.references/abstraction-catalog.md (opens in a new tab)references/evaluation-and-handoff.md (opens in a new tab)references/examples/permit_pool/BeforePool.cfg (opens in a new tab)references/examples/permit_pool/BeforePool.tla (opens in a new tab)references/examples/permit_pool/README.md (opens in a new tab)references/examples/permit_pool/abstract_pool.spock (opens in a new tab)references/examples/permit_pool/scoped_permit_pool.spock (opens in a new tab)references/examples/permit_pool/view.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
abstraction-discovery, verification, bug-prevention, statechart, spock
/abstraction-discovery:abstraction-discoveryfrom abstraction-discovery
npx claudepluginhub dashed/claude-marketplace --plugin abstraction-discoveryOther plugins' skills for the same job