Loading...
Loading...
Use when writing, fixing, editing, reviewing, or refactoring any Python code. Enforces Robert Martin's complete Clean Code catalog—naming, functions, comments, DRY, and boundary conditions.
npx skill4agent add ertugrul-dmr/clean-code-skills python-clean-codepip install -e ".[dev]"pytestfrom x import *| Category | Rule | One-Liner |
|---|---|---|
| Comments | C1 | No metadata (use Git) |
| C3 | No redundant comments | |
| C5 | No commented-out code | |
| Functions | F1 | Max 3 arguments |
| F3 | No flag arguments | |
| F4 | Delete dead functions | |
| General | G5 | DRY—no duplication |
| G9 | Delete dead code | |
| G16 | No obscured intent | |
| G23 | Polymorphism over if/else | |
| G25 | Named constants, not magic numbers | |
| G30 | Functions do one thing | |
| G36 | Law of Demeter (one dot) | |
| Names | N1 | Descriptive names |
| N5 | Name length matches scope | |
| Tests | T5 | Test boundary conditions |
| T9 | Tests must be fast |
| ❌ Don't | ✅ Do |
|---|---|
| Comment every line | Delete obvious comments |
| Helper for one-liner | Inline the code |
| Explicit imports |
Magic number | |
| |
| Deep nesting | Guard clauses, early returns |
| |
| 100+ line function | Split by responsibility |
SECONDS_PER_DAY