clean-code
Enforce SOLID, DRY, KISS principles during implementation. Auto-activated when writing or modifying code.
When & Why to Use This Skill
The Clean Code skill is an automated quality assurance tool designed to enforce industry-standard software engineering principles such as SOLID, DRY, KISS, and YAGNI. By integrating directly into the development workflow, it ensures that every line of code produced or modified is maintainable, scalable, and readable, significantly reducing technical debt and long-term maintenance costs.
Use Cases
- Refactoring Legacy Code: Automatically identifying redundant logic and applying the DRY (Don't Repeat Yourself) principle to consolidate code into reusable utilities.
- Architectural Alignment: Ensuring new feature implementations adhere to SOLID principles, preventing tightly coupled components and promoting modular design.
- Complexity Reduction: Applying KISS and YAGNI principles during the coding process to eliminate over-engineering and keep functions focused and simple.
- Pre-commit Quality Checks: Using the comprehensive code quality checklist to verify naming conventions, function length, and error handling before code is submitted for human review.
| name | clean-code |
|---|---|
| description | Enforce SOLID, DRY, KISS principles during implementation. |
Clean Code Skill
Purpose
Ensure all code follows clean code principles.
Core Principles
SOLID
Reference: principles/solid.md
DRY (Don't Repeat Yourself)
Reference: principles/dry.md
- Extract common logic to functions
- Use constants for magic values
- Create shared utilities
KISS (Keep It Simple, Stupid)
Reference: principles/kiss.md
- Favor readability over cleverness
- One thing per function
- Obvious over implicit
YAGNI (You Aren't Gonna Need It)
Reference: principles/yagni.md
- Implement only what's needed now
- No speculative generalization
- Add complexity when required
Code Quality Checklist
Use before committing: checklists/pre-commit.md
Naming
- Variables describe content
- Functions describe action
- Classes describe entity
- No abbreviations (except common ones)
Functions
- Single responsibility
- < 20 lines preferred
- < 5 parameters
- No side effects where possible
Comments
- Explain why, not what
- Update when code changes
- Remove commented-out code
Error Handling
- Specific error types
- Meaningful messages
- Proper logging
- Recovery or fail gracefully
Auto-Checks
When implementing, verify:
npm run lint
npm run typecheck