Refactor
Restructure and simplify code safely while preserving behavior.
Extract & dedupe Remove duplication without altering behavior. Refactor Verify your work Best practices
@<file> has repeated logic in <functions>. Extract a shared helper without changing behavior. Keep the public API identical, and run the tests to confirm nothing broke. Fan out a migration Plan a repetitive change across many files. Refactor Fan out Best practices
List every file that needs the <X → Y> migration, and for each one describe the exact change. I'll then run you over each file with a scoped, tightly-permissioned command — for now, just produce that per-file plan. Find deprecated usage first Map the blast radius before starting a migration. Refactor Plan first Common workflows
Find all usages of <deprecated API or pattern> across the codebase and list them with file paths. Then propose a refactor plan in small, testable steps — don't change anything yet. General solution, not test-gaming Prevent solutions that only satisfy the test cases. Refactor Solve the general case Prompting
Fix <function> so it works correctly for all valid inputs. Implement the real logic that generalizes — do not hard-code values or special-case the tests just to make them pass. No over-engineering Keep a refactor tight and scoped to what was asked. Refactor Small, scoped changes Prompting
Refactor <target>. Only make changes that are directly requested or clearly necessary — no new abstractions, no extra config, and no defensive code for cases that can't actually happen. Rename safely Rename a symbol everywhere without collateral edits. Refactor Small, scoped changes Prompting
Rename <old> to <new> across the codebase. Update all references and imports, and don't touch any unrelated code. Show me the list of files changed. Simplify function Make a gnarly function readable without changing what it does. Refactor Small, scoped changes Common workflows
Refactor <function> in @<file> for readability — early returns, clearer names, fewer nested branches. Behavior must stay identical; show me a before/after of the tricky parts. Split a large file Break up a sprawling file into focused modules. Refactor Plan first Common workflows
@<file> is too large. Propose a split into cohesive modules with concrete names and responsibilities. Wait for my OK, then move the code and fix all imports. Type-tighten Firm up weak types and surface hidden bugs. Refactor Verify your work Best practices
Replace any/loose types in @<file> with precise types inferred from how the values are actually used. Don't change runtime behavior, and flag anything that reveals a real bug. Understand git history first Learn the context behind code before you change it. Refactor Point to sources Best practices
Look through the git history of <file> and summarize how its API evolved and why, before we refactor it. Flag any change that looks like it was made to fix a specific bug. No prompts match your filters.