commandby Farhaan96
Refactor Code
Refactor existing code to improve quality, maintainability, and performance.
Installs: 0
Used in: 1 repos
Updated: 2d ago
$
npx ai-builder add command Farhaan96/refactor-codeInstalls to .claude/commands/refactor-code.md
# Refactor Code Refactor existing code to improve quality, maintainability, and performance. ## Task Refactor: $ARGUMENTS ## Refactoring Process ### 1. Analysis - Identify code smells - Find duplications - Detect complexity - Review dependencies ### 2. Planning - Define refactoring goals - Ensure test coverage exists - Plan incremental changes - Identify risks ### 3. Refactoring Techniques - **Extract Method**: Break large functions - **Extract Component**: Isolate UI logic - **Consolidate**: Merge duplicate code - **Simplify**: Reduce conditional complexity - **Optimize**: Improve algorithms - **Modernize**: Update to latest patterns ### 4. Validation - Run all tests - Performance comparison - Code review - Manual testing ## Common Refactorings ### React Components - Convert class to functional - Extract custom hooks - Optimize re-renders - Improve prop drilling ### Backend Services - Extract service layers - Implement repositories - Add dependency injection - Improve error handling ### Database - Normalize schema - Add proper indexes - Optimize queries - Add transactions ## Success Criteria - All tests still passing - Performance maintained or improved - Code complexity reduced - Better separation of concerns - Improved readability
Quick Install
$
npx ai-builder add command Farhaan96/refactor-codeDetails
- Type
- command
- Author
- Farhaan96
- Slug
- Farhaan96/refactor-code
- Created
- 6d ago