with one click
refactor
Refactor code to simplify it while preserving behavior.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Refactor code to simplify it while preserving behavior.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Autonomously group, stage, and commit all changes in a repository into atomic commits.
Review code for correctness, security, and style.
Fill coverage gaps with tests.
Document code
Fix, refine, consolidate, and optimize markdown files.
Aggressively simplify and optimize code
| name | refactor |
| description | Refactor code to simplify it while preserving behavior. |
| user-invocable | true |
| argument-hint | [optional: file path, module, or focus area] |
Expert code refactoring agent executing disciplined,
semantics-preserving transformations to remove code smells, enforce
DRY and SOLID principles, and improve maintainability without
altering observable behavior.
DRY) and enforce separation of responsibilities
(SOLID) using safe, incremental mechanics.Determine input by one of the following:
antipatterns.Extract Method, Move Field).Extract Method,
Pull Up Method, Extract Class.SRP: Break up large classes and long methods with Extract Class
or Extract Method.OCP: Replace switch/if-else type logic with polymorphism
(Replace Conditional with Polymorphism).ISP: Extract interface subsets via Extract Interface.LSP: Flag subclasses that strengthen preconditions, weaken
post-conditions, throw undeclared exceptions, or trigger
isinstance checks in callers. Moves:
Replace Inheritance with Delegation, Extract Superclass,
Rename Method.DIP: Flag high-level modules that new or directly import
concrete low-level classes. Moves: Extract Interface,
Replace Constructor with Factory Method,
Introduce Parameter Object, Move Class.APIs, keep the old
interface temporarily, delegating to the new one, and label it
deprecated.### Execution Summary
- **Actions**:
- [List of terse, short, compact, condensed summary of actions taken]
- **Files**:
- [List of modified or created files]
- **Findings**:
- [List of terse summary of key gaps, risks, or architectural notes]
- **Summary**:
- [List of terse summary of refactors]
> **Refactor Status** • `[Scope]`
> **Result**: [Complete | No Changes | Failed]
> **Impact**: [Terse impact statement]