What problem does it solve?
This Skill enforces a set of pragmatic coding standards to ensure code is concise, direct, maintainable, and avoids unnecessary complexity or verbosity.
Core Features & Use Cases
- Enforces SOLID principles: Promotes Single Responsibility, DRY, KISS, YAGNI.
- Standardizes Naming: Ensures clear and intent-revealing names for variables, functions, and constants.
- Optimizes Function Design: Guides towards small functions with few arguments and no side effects.
- Promotes Clean Structure: Encourages guard clauses, flat nesting, and composition.
- AI-Specific Guidelines: Provides clear instructions for AI agents on how to handle user requests, bugs, and unclear requirements.
- Pre-edit Checks: Mandates thinking about dependencies and impact before modifying files.
- Post-task Verification: Requires self-checking for goal completion, code correctness, and absence of errors.
- Script Execution: Defines specific validation scripts to be run by agents for linting, type coverage, and internationalization checks.
- Use Case: An AI agent tasked with refactoring a legacy codebase would use this Skill to ensure all changes adhere to these best practices, leading to a cleaner, more robust final product.
Quick Start
Apply the clean-code skill to refactor the provided Python script, ensuring it adheres to all naming conventions and function size limits.