/web:refactoringfrom web
Plans and executes safe refactoring of working code with a reversible baseline, preserving test results and external APIs. For TDD GREEN phase cleanup, not new features.
Ships in web. 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.
Refactoring is the third step of TDD: after GREEN, assess whether refactoring adds value. A refactor improves the structure of working code; it never changes observable behaviour.
principle-capture-the-baseline)A baseline is a state you can return to, so a broken slice costs one restore instead of a debugging session. A commit is one way to record it, not a requirement; refactoring uncommitted code is safe when the baseline is recorded another way.
Stay inside the user's authorised boundary:
principle-preserve-unrelated-work).principle-update-the-base-deliberately).Workflow:
principle-sequence-verifiable-units). When the slice moves or renames
files, also check each tool the project uses that finds code by path, for
example workspace globs, tsconfig paths, test and lint globs, build
contexts and route discovery. A stale path in these tools is part of the
move: update it in the same slice. Confirm that the same tests, lint inputs
and build inputs are still found: a glob that stops matching drops them, and
the suite stays green.A green suite proves only the behaviours it asserts, not that code is safe to move. Characterize before you move code, and only what matters:
principle-test-behavior-not-implementation).
Common entries that do cross the boundary: public signatures, error type,
error object identity, ordering, cleanup timing, retry count and delay, and
fan-out to multiple waiters.A failing characterization test means you do not yet understand the current behaviour: stop and investigate before refactoring.
Characterization tests are not speculative work; they record existing behaviour callers already depend on.
When a required behaviour cannot be characterized, stop before the refactor and report which behaviour you could not pin. Leave uncharacterized code alone, whether or not it looks trivial.
| Priority | Action | Examples |
|---|---|---|
| Critical | Fix now | Mutations, knowledge duplication, >3 levels nesting |
| High | This session | Magic numbers, unclear names, >30 line functions |
| Nice | Later | Minor naming, single-use helpers |
| Skip | Don't change | Already clean code |
Abstract when:
Keep separate when:
Before extracting, state the evidence: the rule, policy, or specification the
copies share, and whether they have changed together in the past. Duplicates
that cite the same rule and have always changed together are one piece of
knowledge with one owner (principle-derive-from-one-owner). Duplicates that
only look alike are not; leave them separate.
// After GREEN:
const processOrder = (order: Order): ProcessedOrder => {
const itemsTotal = order.items.reduce((sum, item) => sum + item.price, 0);
const shipping = itemsTotal > 50 ? 0 : 5.99;
return { ...order, total: itemsTotal + shipping, shippingCost: shipping };
};
// ASSESSMENT:
// ⚠️ High: Magic numbers 50, 5.99 → extract constants
// ✅ Skip: Structure is clear enough
// DECISION: Extract constants only
Every new production behaviour must have a failing test that demanded it; if no test drives it, do not write it. The rule governs new production behaviour only, not a structural refactor of working code and not a characterization test.
❌ Speculative code examples:
What to do: Delete speculative code. Add behaviour tests instead.
Untested is not the same as speculative. Code that runs in production and that a caller depends on is live behaviour, whatever its coverage. Characterize it and keep it. Delete it only as a separate agreed behaviour change with its own test, never inside a refactor.
Don't refactor when:
When a request changes observable behaviour, say so and deliver it test-first as a feature. Do not label or plan it as a refactor, and do not give it a refactoring priority; the Priority Classification table applies to refactorings only.
refactor: extract scenario validation logic
refactor: simplify error handling flow
refactor: rename ambiguous parameter names
Format: refactor: <what was changed>. Never mix refactoring commits with
feature commits. When you cannot commit, keep the refactor a separate
reviewable step from any behaviour change.
principle-never-weaken-a-check)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub mintuz/skills --plugin web10 skills in this plugin
/browser-testingWHEN authoring or repairing real-browser journeys or automated screenshot comparisons with the project's selected runner; NOT DOM-only tests, interactive visual judgement or verification-recipe maintenance; provides native-runner fixtures, assertions and visual-comparison guidance./chatgpt-app-sdkWHEN building ChatGPT apps using the OpenAI Apps SDK and MCP; NOT for OpenAI API chat completions, agent frameworks, or MCP servers with no ChatGPT widget; create conversational, composable experiences with proper UX, UI, state management, and server patterns./cssUSE WHEN writing, fixing or reviewing plain CSS or Sass for a web page, even a one-line change, including a rule that loses to another, a third-party stylesheet you cannot edit, units, spacing between components, shorthands, skip links, hidden and focus styles, or deleting styles that look unused; NOT WHEN the project uses Tailwind (tailwind.config.js, utility classes, CVA variants, Tailwind theme tokens); produces CSS that wins the cascade without ID selectors or reactive !important, scales with the reader's text size, keeps spacing in the parent and deletes styles only on evidence./frontend-testingUSE WHEN testing non-React UI (vanilla JavaScript or TypeScript DOM code, a web component, or a Vue, Svelte or Angular component) with DOM Testing Library in Vitest or Jest with jsdom: writing, fixing or reviewing a test, or a request to add an end-to-end journey or a layout check to that suite; NOT WHEN the code or project uses React or React Testing Library (use web:react-testing), for XState actors (web:xstate), or for Playwright, Cypress or screenshot-comparison work in a real browser; covers queries, accessible names, userEvent, async results, network stubs and assertions that pass for the wrong reason, and declines what jsdom cannot prove while offering the part that fits./reactUSE WHEN changing the logic, data, props, state, Effects or rendered text of a React component, hook or page, even a one-line change; NOT WHEN the request is styling only (class names, Tailwind, CSS, dark mode, spacing, shadows) or tests only, or when it models submit, in-flight, loading, retry or failure states, even for a named React form (xstate covers that, including its React wiring); applies React 19 composition, state, Effect, structure, API and performance rules with only the project's installed libraries./react-testingUSE WHEN writing, fixing or reviewing a React Testing Library test for a component, hook or context provider, even one small test, or when asked for an end-to-end journey inside a Vitest or React Testing Library suite; NOT WHEN changing the component itself (react), testing XState actors or @xstate/react (xstate), or writing a Playwright or Cypress test; covers renderHook, providers, async results, forms and false-pass anti-patterns, and declines end-to-end journeys with the testable slices.Other plugins' skills for the same job