Skip to main content
skill CX Codex

w-refactor — Claude Code skill: refactoring and setup

The w-refactor Claude Code skill restructures selected code while preserving its behavior. It starts by recording a baseline with tests, type checks, or a manual scenario.

MIT 647 installs ★ 1 updated 2026-10-02

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add blockmatic-icebox/basilic-skills --skill w-refactor -a claude-code
Open on GitHub

What w-refactor does

The skill works on selected files or a named code concern. First, it identifies what callers rely on and which checks can show that behavior remains intact. Then it suggests a small, focused diff: remove duplication, clarify names, or reduce nesting while reusing packages already in the repository.

Algorithm or data-structure changes require evidence from the repository’s profiler, tests, or traces. After editing, the skill runs the checks chosen at the start and calls for restoring behavior if they fail. It does not run the full pre-push suite. Commit, push, and pull request creation are outside its scope.

If behavior or commands change, documentation can be updated with /w-docs.

What it helps with

  • remove duplication from selected files
  • reduce deeply nested code
  • rename code elements without changing behavior
  • check a refactor with selected tests

Example prompts for the agent

  • Run w-refactor on these files and preserve their behavior.
  • Use w-refactor to simplify the structure of this code section.

How to install w-refactor

1Skills CLI (Vercel)

npx skills add blockmatic-icebox/basilic-skills --skill w-refactor -a claude-code

2Manually: put the files in place

~/.claude/skills/w-refactor/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/w-refactor/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about w-refactor

How do I install w-refactor in Claude Code?

Run npx skills add blockmatic-icebox/basilic-skills --skill w-refactor -a claude-code. The skill file is at ~/.claude/skills/w-refactor/SKILL.md.

What does w-refactor do?

It helps restructure selected files or a named area of code, recording checks for behavior before edits. It does not authorize commits, pushes, or pull request creation.

What evidence does w-refactor require for algorithm changes?

Changes to algorithms or data structures need support from the repository’s profiler, tests, or traces.

Source text

SKILL.md · MIT
---
name: w-refactor
description: Refactor selected code while preserving behavior, then verify.
disable-model-invocation: true
---

Use the selected files or a named concern. Capture current behavior with tests, types, or a manual scenario before editing. Refactor does not authorize commit, push, or PR.

1. Record a baseline: what callers depend on, which checks prove it, and what must not change.
2. Improve structure in the smallest useful diff: extract duplication, clarify names, reduce nesting. Reuse existing packages. Do not add comments that restate the code.
3. Change algorithms or data structures only with measured evidence from the repository's profiler, tests, or traces.
4. Run the affected checks from the baseline. Restore behavior if they fail. Never the full pre-push suite.
5. Docs: `/w-docs` if behavior or commands changed.

© blockmatic-icebox · MIT · blockmatic-icebox/basilic-skills

Similar skills

All skills for Code review and refactoring →

From the same set45

The whole set →
w-review-plan The w-review-plan Claude Code skill checks a plan’s goals, assumptions, tasks, risks, and references. It compares the plan with project code and docs. CX Codex +1 649installs w-errors w-errors — a Claude Code skill that adds error handling in line with a repository’s conventions. Invoke it explicitly while changing code. CX Codex +1 647installs w-perf The w-perf Claude Code skill measures project performance and locates bottlenecks. It runs on requests to investigate slow code or improve performance. CX Codex +1 647installs w-a11y The w-a11y Claude Code skill checks UI accessibility against a repository’s docs and tests. It reports findings by default and changes code only when asked to fix issues. CX Codex +1 647installs w-form The w-form Claude Code skill guides form work in a Next.js app through the mutation path the project already uses. Invoke it to build a form. CX Codex +1 647installs w-v0 The w-v0 Claude Code skill drafts a v0.dev prompt from the current file, selection, and project stack. It opens the generated link only after OPEN. CX Codex +1 647installs w-shadcn The w-shadcn Claude Code skill adds shadcn primitives to a shared UI package or extends existing ones. It handles component-level work; screen redesigns go through /w-ui. CX Codex +1 647installs w-ui w-ui — a Claude Code skill for building or reshaping user-facing interfaces around a project’s existing tokens and accessible interactions. It checks rendered screens on desktop and mobile. CX Codex +1 647installs

Project sponsors

Companies that keep this analytics open