| name | clean-code-refactorer |
| description | Skill for identifying code smells and refactoring code using Clean Code, SOLID, and DRY principles. Use when requested to "clean up", "refactor", or "improve quality" of backend code. |
Clean Code Refactorer
Overview
This skill provides a systematic approach to improving code quality without changing external behavior. It enforces SOLID principles and project-specific FastAPI standards.
Refactoring Workflow
Follow this cycle for every refactoring task:
- Observe: Identify code smells (long functions, duplication, tight coupling).
- Orient: Read the Clean Code Rules to determine the best pattern to apply.
- Validate (Pre): Run existing tests to ensure the current state is stable.
- Act: Apply surgical changes (extract method, rename variable, etc.).
- Validate (Post): Execute the
scripts/check_quality.sh to verify linters and tests.
Standards & Principles
Refer to the following for detailed guidance:
Examples
- User: "This service function is too long, can you refactor it?"
- Agent: Reads the function, identifies logic that can be extracted to a helper, verifies tests pass, refactors, and runs quality checks.
Resources
scripts/check_quality.sh: Automates Ruff, Black, and Pytest validation.
references/clean-code-rules.md: Comprehensive guide for SOLID and Clean Code.