/enso-method:refactor-passfrom The Enso Method
Post-commit step that judges whether implemented work warrants refactoring and performs structure-only changes with tests staying green, committed as its own refactor(scope) commit. Strongly decline-biased; most outcomes are a one-line 'no refactor warranted'.
Ships in The Enso Method. 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.
None: SKILL.md is the whole skill.
The last judgment step of the standard implementation chain: implement (implement-from-requirements or implement-from-discovery) → deliverable-review → test-hardening → feature commit → refactor-pass → push, when the default covers it.
The chain steps ask "does the work do what was asked, and do the tests prove it?" This pass asks a different question: now that it works, is proven, and is safely committed, did building it leave the code structurally worse — and is fixing that worth doing right now? Then, if the answer is yes, it does the fixing. One invocation covers both the judgment and the work: there is no separate "assessment" deliverable to carry into another session.
Two commit rules frame everything here. The pass runs only on a committed feature baseline — the implement skills run it right after the feature commit and never before, because refactoring can make a mess, and a committed baseline makes any mess trivially revertible without touching the feature diff. And the pass commits its own work separately — when it changes anything, it makes its own refactor(scope): ... commit, never folded into the feature commit, so the two diffs are read apart. It commits by the implement chain's default and gives way to the user's instructions the same way (pre-commit-validation, "Who Commits"): a user who said not to commit gets the staged change and its message instead.
The default answer is no. This is not hedging — it is the expert position the skill is built on. Refactoring is justified economically (Fowler): by making real, observed friction go away in code that will be worked on again — never by aesthetics, and never by imagined future needs ("speculative generality" is itself a code smell in Fowler's catalog). Most implementation sessions end with code that is good enough, and for those the entire output of this pass is one line. Do not manufacture a refactor to justify the invocation.
Why this moment: "right after the feature, with green hardened tests" is the refactor step of red-green-refactor writ large — Kent Beck calls it tidying after. The tests test-hardening just certified are the safety net that makes structure-only change safe.
Do NOT use this skill for:
implement-from-discovery), not something to fix under the refactoring flagThe implementing session holds evidence no fresh chat can reconstruct: whether the structure fought the change, where a mental model had to be built that the code doesn't express, which edits sprawled across files. These experiential signals are the strongest refactor indicators, and they exist only in the session that lived them. When this skill runs in the chat that did the implementation, use them — cite them by name in the verdict.
Fully supported, with eyes open about what changes: the experiential signals are gone, so the assessment runs on structural evidence readable from the diff — duplication, scatter, dead scaffolding, stale names. That evidence is real and sufficient; the bar for acting on it does not move. What the mode strictly requires is anchors, asked for if missing rather than inferred:
git show <sha> --stat, git diff <base>..<head>). It must be committed: if the work is still sitting uncommitted in the tree, stop and say so — the session that built it, or the user, commits it first; the pass never refactors on top of an uncommitted feature.A workable fresh-chat invocation: "Run refactor-pass on commit <sha> — it implemented <path to phase doc or PRD>."
Two cautions that grow with distance from the implementation: (a) confirm the suite is green before touching anything — the safety-net assumption must be established, not presumed; (b) if unrelated work has landed on top of the target commit, the refactor must respect the code as it is now, and a crowded file history is a reason to be more conservative, not less.
Refactor only when at least one of these signals is clearly present in the code this work touched. Each is checkable — cite the specific evidence (file, function, the duplicated fragments, the scattered edit sites) in the verdict, not a vibe.
And one gate that is not a signal but a precondition for acting on any of them:
These come from the same sources as the signals and are absolute:
getattr, config-driven imports, queue/task names), CLI flags, config keys, metric names a dashboard reads. Grep for string occurrences of a name before renaming it; if the name crosses such a boundary, it is not a tidy — leave it.test-hardening just certified these tests; they are the proof that behavior didn't change. No assertion changes, no test deletions, no new tests. The only permitted test edits are mechanical consequences of the refactor itself — updated imports, renamed symbols, moved paths.refactor(scope): ...; when the user's instructions say not to commit, it stages them and presents the message instead.git merge-base --is-ancestor <sha> HEAD) — if it isn't (wrong branch, unfetched work), stop and say so rather than refactoring code that doesn't contain the feature. Then check git status for other sessions' uncommitted or staged files on this shared checkout: proceed only if the refactor's scope doesn't touch them, and never sweep them into staging.test-hardening. Standalone, run it before touching anything. If the suite is red, diagnose before routing: an environmental failure (missing credentials, wrong profile or interpreter) gets fixed as environment setup; genuinely weak or failing tests mean stop and recommend test-hardening first. Refactoring without a trustworthy net is the classic anti-pattern this ordering exists to prevent.git show <sha> --stat / git diff <base>..<head> of the shipped changeset).Walk the signal list against the in-scope code. This is a main-agent judgment, not a sub-agent fan-out — in same-chat mode the session's own experience is the evidence, and the deliberate decline bias means a conservative single reader is the right instrument. Read the touched code fresh from disk (not from memory of writing it), because leftover scaffolding and stale names hide from the eyes that wrote them.
State the verdict citing specific signals with specific evidence — or their absence.
test-hardening ran, named in the wrap-up.git add .) and validate per pre-commit-validation. Inside an implement chain, skip its Step 1 pull: the branch was brought current for the feature commit, and a remote that moved since shows up as a rejected push (in the shared checkout, reported with both commits left local). Announce the refactor(scope): ... message with the repo name, and commit. Inside an implement chain, the chain pushes next; run standalone, push yourself when pre-commit-validation's default push or the user's authorization covers it ("Who Commits") — a feature branch by default, never forced; without authorization, a push that would land on an integration branch is held for the user's word. Its own-commits check stops the push when the anchor commit is someone else's unpushed work; say so and leave the refactor commit local. When the user's instructions say not to commit or not to push (pre-commit-validation, "Who Commits"), stop where they say: at the staged change with its message presented, or after the commit.A warranted refactor that exceeds the small-tidy bound is deferred, not attempted. Name it in the wrap-up in a line or two (the signals, the files) as an action item for the user, and stop the pass (inside an implement chain, the chain still pushes). If the user says go, this chat writes it up as a change directory (prd-writing-standards, storage convention): a short PRD whose acceptance criteria are "behavior unchanged, suite green", and the brief as its technical design — a session never creates one unasked. The brief carries: the signals observed with their evidence, the files in scope, and the explicit do-not list (no behavior change, no speculative generality, tests frozen). Critically, the brief must decompose the refactor into a sequence of individually gate-sized tidies, each independently shippable with the suite green after it — this is Beck's actual prescription (many small tidyings, never one big restructuring), and it's what lets a fresh session execute the brief step by step with refactor-pass standalone without tripping the same gate that deferred it. A refactor that cannot be decomposed that way is not a tidy at all — it's a redesign, and it exits this skill entirely (surface it to the user as such). Do not start a big refactor "just to see how far we get" — a half-applied restructuring is worse than none.
When the pass declines, its one-line verdict is the whole wrap-up. Otherwise one paragraph, mirroring the chain's no-loose-ends discipline: what was tidied, confirmation the full suite is green with the command and how long it took named, and the refactor(scope): commit with the repo named and whether it was pushed or held (or the staged change and its message, when the user said not to commit). Note explicitly that the refactor pass was performed, so the user doesn't re-run it. No FYIs, no inventory of dismissed observations, no adjacent-code commentary.
refactor(scope): commit, sequenced after the feature committest-hardening certifiedThis skill is self-contained — the signals and guardrails above are the complete rules. It connects to the other skills like this:
| Skill | Relationship |
|---|---|
implement-from-requirements | Runs this skill at wrap-up, in the same chat, after the feature commit and before any push. |
implement-from-discovery | Same, for discovery-triggered work — the anchor is the criteria its Phase 4 wrote or confirmed, or the stated intent of the fix when it wrote none. |
test-hardening | The preceding step, and the precondition: it certifies the safety net this pass depends on. Standalone invocations with a weak or red suite get routed there first. |
deliverable-review | Two steps earlier in the chain. It verifies the deliverable matches intent; this pass never revisits that question. |
prd-writing-standards | Where an over-the-gate refactor lives if the user wants it done (Step 5): a change directory, created on the user's say-so, whose technical design is the brief a fresh standalone invocation executes. |
pre-commit-validation | Runs at the commit boundary for the refactor commit exactly as for any other — staging hygiene, secrets scan, diff sanity. |
implementation-lifecycle | The session discipline — the Materiality Gate and No Loose Ends discipline are the general form of this skill's decline bias and short wrap-up. |
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (ensodynamics/enso-method) — no native marketplace selected
npx claudepluginhub p/ensodynamics-enso-method27 skills in this plugin
/assumptions-document-feedbackProcess stakeholder feedback on assumptions documents — incorporate corrections, validations, partial answers and pushback (a doubt or question is researched and the assumption restated to meet it, never pasted in as the answer) while keeping the project moving forward. Checks every requested change against the whole initiative as it stood before the feedback, then sorts it into a fix or a new ask; once the PRD's build has started, fixes go into its phase plan and new asks, apart from minor ones, into one follow-on PRD, so a build in progress finishes on the scope it started with. Finishes every change in each PRD it reaches, including each PRD that consumes a changed contract, and gives each amended PRD one fresh check instead of rerunning its refinement. Use for every stakeholder answer to an assumption, however it arrives (a returned review, an email, meeting notes, a ruling given in chat), even one recorded in passing during a build./assumptions-document-writingStandards for writing assumptions documents — every entry sorted by what would settle it (a build choice goes to the technical design, a fact research could not reach is a labelled technical assumption, only what the business wants is a business assumption), specific implementable statements, plain English, confidence levels, and stakeholder validation format. Use to draft a register, add a new entry, re-sort the entries a register already holds, or make a change an agent came up with. A stakeholder's answer to an assumption entry, however it arrives (a returned review, an email, a ruling given in chat), goes through assumptions-document-feedback instead, which applies these format rules.Other plugins' skills for the same job