Loading...
Loading...
Clean Code practices for TypeScript/JavaScript. Identify code smells, apply refactoring patterns, and write maintainable code. Use when reviewing code quality, refactoring messy code, or ensuring code follows best practices. Triggers on requests like "clean up this code", "refactor for readability", "identify code smells", or "make this more maintainable".
npx skill4agent add toilahuongg/shopify-agents-kit clean-code| Smell | Example | Fix |
|---|---|---|
| Single-letter names | | |
| Abbreviations | | |
| Generic names | | Name by what it represents |
| Misleading names | | |
| Encoding types | | |
| Smell | Indicator | Refactoring |
|---|---|---|
| Too many parameters | >3 params | Extract to options object |
| Flag arguments | | Split into separate functions |
| Side effects hidden | Function does more than name suggests | Rename or split |
| God function | >20 lines or multiple responsibilities | Extract smaller functions |
| Deep nesting | >3 levels of indentation | Early returns, extract functions |
| Smell | Indicator | Refactoring |
|---|---|---|
| Long file | >300 lines | Split by responsibility |
| Feature envy | Function uses another object's data extensively | Move to that object |
| Data clumps | Same group of params passed together | Extract to type/class |
| Primitive obsession | Using primitives for domain concepts | Create value objects |
| Switch on type | | Polymorphism or lookup |
createUservalidateInputfetchOrdersisValidhasPermissioncanEdithandleClickhandleSubmittoJSONfromDTOparseDateisEnabledisNotDisabledusersorderItemsretryCounterrorCountMAX_RETRIESAPI_BASE_URLStatus.Activeany