← ClaudeAtlas

refactorlisted

Restructure existing code without changing its behavior (extract, inline, rename, move, split large functions or modules, reduce complexity, remove duplication and dead code). Pins behavior with tests first, maps the contract and its consumers, and moves in small verified steps. Use when the user asks to refactor, restructure, split, extract, rename, or untangle code, in English or Vietnamese ("refactor", "tái cấu trúc", "tách hàm", "đổi tên", "dọn code", "giảm complexity"). Not for reviewing a finished diff (see verifier) or for rewrites meant to change behavior.
viettdann/arclight-kit · ★ 0 · Code & Development · score 62
Install: claude install-skill viettdann/arclight-kit
# Refactor Change structure, never behavior. Behavior is everything a caller, user, or other system can observe: return values, thrown errors and their messages, output and wire formats, side effects and their order, sync versus async, null handling, log lines something parses, and every name another codebase depends on. ## 1. Scope - State the goal in one line (what becomes easier to change) and the files in scope. Infer both from the request; ask only when the target is unclear. - Keep feature work and bug fixes out. A bug found mid-refactor goes in the report, not in the diff; mixing the two makes the "behavior unchanged" claim unverifiable. - If the scope spans several packages or more than 5 files, show the step-2 contract map and the move sequence, and wait for approval before editing. After that, run steps 2 to 5 through without stopping to report progress or offer to continue; stop early only for a frozen surface the goal needs changed (step 2), a red step you can't make smaller, or the final report. For larger efforts, plan through `brainstorming` and run through `executor`; this skill's rules still apply to each step. ## 2. Map the contract surface Before editing, list every surface in scope that something outside the scope depends on, then find its consumers across the whole repo with LSP find-references or grep (tests, scripts, other packages, the frontend): - Exported functions, classes, and types: names, signatures, defaults, thrown error types - HTTP rout