dist/cursor/dev-flow/skills/refactoring-code/SKILL.md
Batch behavior-preserving refactors for multi-file, repeated-pattern, large-file, rename, move, extract, split, or restructure work. Use for "refactor across files", "batch rename", "update pattern everywhere", large files (500+ lines), or 5+ coordinated edits in one file. NOT for single targeted edits, behavior changes or bug fixes (use fixing-code), test-only refactors (use improving-tests), code review (use reviewing-code), or architecture redesign (use architecture-design/review).
npx skillsauth add alexei-led/claude-code-config refactoring-codeInstall 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.
Use this when many edits must preserve externally observable behavior. Stop if you cannot name the maintenance value and the behavior that must stay unchanged.
Detect capability from tools:
Do not use this for:
fixing-codeimproving-testsreviewing-codeLoad the matching reference for the language being refactored:
references/csharp.mdreferences/go.mdreferences/java-kotlin.mdreferences/python.mdreferences/rust.mdreferences/typescript.mdUnsupported language: use the general workflow in this file only.
Before editing:
No mapped site, no edit.
Good batches are small, reversible, and single-purpose:
Rules:
Engineer:
REFACTOR COMPLETE
=================
Preservation target: <behavior that must not change>
Safety gate: <tests/checks used>
Files changed: N
Status: CLEAN | NEEDS ATTENTION
Mapping:
- <tool/search> — <key affected sites or graph gap>
Changes:
- path:line — change
Verification:
- <command> — pass/fail
Reviewer:
## Proposed Changes
Preservation target: <behavior that must not change>
Safety gate: <tests/checks the applier should run>
Mapping:
- <tool/search> — <affected sites or graph gap>
### Change 1: <brief description>
File: `path/to/file`
Action: CREATE | MODIFY | DELETE
Code:
<changed regions with enough context to locate them>
Rationale: <why this preserves behavior while improving structure>
For multi-file renames, list every mapped occurrence or explicitly mark ambiguous/unmapped references.
tools
Use when planning, executing, checkpointing, finishing, or inspecting lightweight spec-driven work. Runs one task at a time using `.spec/` markdown files and the bundled `specctl` helper. NOT for broad product discovery beyond a short requirement interview. NOT for generic implementation planning that does not read or write `.spec/` files.
development
Simple web development with HTML, CSS, JS, and HTMX. Use when working with .html, .css, or .htmx files, web templates, stylesheets, or vanilla JS scripts. NOT for React/Vue/Angular (use writing-typescript) or Node.js backends.
tools
Idiomatic TypeScript development. Use when writing TypeScript code, Node.js services, React apps, or TypeScript design advice. Emphasizes strict typing, boundary validation, composition, fast feedback, behavior tests, and project-configured tooling. NOT for Go, Python, Rust, plain HTML/CSS/JS, or server-rendered templates (use writing-web).
tools
Idiomatic shell development for POSIX sh, Bash, Zsh, Fish, hooks, CI shell steps, and scriptable CLI glue. Use when writing or changing `.sh`, `.bash`, `.zsh`, `.fish`, `.bats`, shell functions, shell pipelines, CI `run:` shell bodies, or command-runner recipes. Emphasizes portability, quoting, safe filesystem/process handling, non-TUI CLI tools, ShellCheck, shfmt, Bats, and ShellSpec. NOT for Python, Rust, TypeScript, Go, web code, or GitHub Actions workflow/job/permissions semantics; use operating-infra.