pocs/agent-plugins/claude-pragma/skills/refactor/SKILL.md
Alignment refactor — restore naming, boundaries, and structure to match the concept capsule. Use after a slice lands, or when naming, module boundaries, or structure have drifted from the capsule. Prevents conceptual drift.
npx skillsauth add hashintel/labs refactorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Restore naming, module boundaries, and structure so the code matches the concept capsule. Refactor immediately after green, while context is fresh.
What feels off, or the scope to check: $ARGUMENTS
Before starting, locate:
/pragma:capsule first.Compare every public name (types, functions, modules, test suites) against the capsule glossary:
If the glossary says "Worker," the code says "Worker" — not "processor," not "handler."
For each module, complete: "This module hides the decision about ___." (Parnas)
Check functional core / imperative shell boundary: pure domain logic has zero I/O imports; I/O adapters have zero domain logic; shell calls core, never the reverse.
If it doesn't serve a current test or behavior, it goes.
For each capsule invariant: type system (best) → constructor/validator (good) → tests (minimum) → none (fix this).
Before closing refactor work, classify what changed and route durable updates:
/pragma:capsule update/pragma:roadmap update/pragma:milestone update/pragma:assumptions update/pragma:contractUse explicit none for lanes with no change.
Run full verification harness. All checks must pass — remain green throughout. Commit separately from behavior work: Refactor: align naming/boundaries to capsule after [slice]
/pragma:card.none | /pragma:capsule update — [reason]none | /pragma:roadmap update — [reason]none | /pragma:milestone update — [reason]none | /pragma:assumptions update — [reason]none | /pragma:contract — [reason]State: stabilizing, Next: first non-'none' authority delta command (otherwise /pragma:assumptions update), Loop: /pragma:consult (default unless user explicitly continues directly)documentation
Read and write a Petri net (SDCPN) document by Automerge URL. Use when creating, editing, or querying Petri nets — adding or removing places, transitions, arcs, color types, differential equations, and parameters.
development
Time-boxed throwaway investigation to answer one hard question. Use when facing technical uncertainty before a slice — the output is knowledge, not production code. Retires risk by producing a spike verdict with clear recommendations.
development
Implement one tracer-bullet slice following the inside-out methodology. Use when you have a tracer-bullet card ready to build. Implements functional core first, then imperative shell, then end-to-end wiring, then alignment refactor.
tools
Build a walking skeleton — the thinnest runnable system that proves build, test, and runtime work end-to-end. Use when starting a new project, before any feature work. Front-loads tooling and infrastructure so every subsequent slice is cheaper.