com um clique
refactoring
Identify code smells and apply refactoring patterns safely
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Identify code smells and apply refactoring patterns safely
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Review pull requests for code quality, security, and correctness
Review pull requests for code quality, security, and correctness
End-to-end shipping workflow — tests, PR creation, review request. Unified pr-create + pr-complete.
Periodic cross-agent learning consolidation — review what worked, what didn't, propagate insights
Break down complex problems through structured analytical frameworks
Persist and recall context across sessions — critical for continuity
| name | refactoring |
| version | 1.0.0 |
| description | Identify code smells and apply refactoring patterns safely |
| uses | ["development/testing","development/code-review"] |
| requires | {"tools":[],"env":[]} |
| security | {"risk_level":"write","capabilities":["file:read","file:write"],"requires_approval":false} |
Identify code smells and apply refactoring patterns safely — improving code structure without changing behavior. Refactoring is behavior-preserving transformation.
This is an agent-handled skill (handler: type: agent). When refactor is invoked, you (the agent) apply the methodology below using your reasoning capabilities. There is no backing code — you follow these instructions directly. The tool schema in tool.yaml defines the external contract; this document guides how you fulfill it.
Common code smells and their indicators:
| Smell | Indicator | Refactoring |
|---|---|---|
| Long function | >30 lines, multiple responsibilities | Extract Method |
| Large class | >300 lines, too many fields/methods | Extract Class |
| Duplicate code | Same logic in multiple places | Extract Method/Class |
| Long parameter list | >4 parameters | Introduce Parameter Object |
| Feature envy | Method uses another object's data more than its own | Move Method |
| Data clumps | Same group of fields/params appears together | Extract Class |
| Primitive obsession | Using primitives instead of small objects | Replace Primitive with Object |
| Switch statements | Long switch/if-else chains on type | Replace with Polymorphism |
| Speculative generality | Abstract classes/interfaces with one implementation | Collapse Hierarchy |
| Dead code | Unreachable or unused code | Remove Dead Code |
Before refactoring:
If test coverage is insufficient, write tests first before refactoring.
For each refactoring step:
Critical rule: Refactor in small, verifiable steps. Each step should:
Never do a "big bang" refactoring that changes everything at once.
After each transformation:
After completing the refactoring:
## Refactoring: [Target]
### Smells Identified
| # | Smell | Location | Severity |
|---|-------|----------|----------|
| 1 | [smell] | [file:line] | [high/medium/low] |
### Refactoring Plan
| Step | Pattern | Before | After |
|------|---------|--------|-------|
| 1 | [pattern] | [current state] | [target state] |
### Execution
| Step | Status | Tests |
|------|--------|-------|
| 1 | [done/skipped] | [pass/fail] |
### Result
- Readability: [improved/unchanged]
- Maintainability: [improved/unchanged]
- Complexity: [reduced/unchanged]
- Tests: [all passing]
- Lines changed: [count]
Refactoring is complete when: