Loading...
Loading...
Analyze code quality based on "Clean Code" principles. Identify naming, function size, duplication, over-engineering, and magic number issues with severity ratings and refactoring suggestions. Use when the user requests code quality checks, refactoring advice, Clean Code analysis, code smell detection, or mentions terms like code review, code quality, refactoring check.
npx skill4agent add heyvhuang/ship-faster review-clean-codeReview Progress:
- [ ] 1. Scan codebase: identify files to review
- [ ] 2. Check each dimension (naming, functions, DRY, YAGNI, magic numbers, clarity, conventions)
- [ ] 3. Rate severity (High/Medium/Low) for each issue
- [ ] 4. Generate report sorted by severitydata1tempresultinfoobjgetfetchretrieve// ❌
const d = new Date();
const data1 = fetchUser();
// ✅
const currentDate = new Date();
const userProfile = fetchUser();// ❌ 7 parameters
function processOrder(user, items, address, payment, discount, coupon, notes)
// ✅ Use parameter object
interface OrderParams { user: User; items: Item[]; shipping: Address; payment: Payment }
function processOrder(params: OrderParams)if (config.legacyMode)// ❌ YAGNI violation: unused compatibility code
if (config.legacyMode) {
// 100 lines of compatibility code
}// ❌
if (retryCount > 3) // What is 3?
setTimeout(fn, 86400000) // How long is this?
// ✅
const MAX_RETRY_COUNT = 3;
const ONE_DAY_MS = 24 * 60 * 60 * 1000;// ❌ Nested ternary
const status = a ? (b ? 'x' : 'y') : (c ? 'z' : 'w');
// ✅ Use switch or if/else
function getStatus(a, b, c) {
if (a) return b ? 'x' : 'y';
return c ? 'z' : 'w';
}// ❌ Inconsistent style
import { api } from './api'
import axios from 'axios' // External lib should come first
const handle_click = () => { ... } // Mixed naming style
// ✅ Unified style
import axios from 'axios'
import { api } from './api'
function handleClick(): void { ... }[!TIP] Project conventions should refer to,CLAUDE.md, or project-defined coding standards.AGENTS.md
| Level | Criteria |
|---|---|
| High | Affects maintainability/readability, should fix immediately |
| Medium | Room for improvement, recommended fix |
| Low | Code smell, optional optimization |
### [Issue Type]: [Brief Description]
- **Principle**: [Clean Code principle]
- **Location**: `file:line`
- **Severity**: High/Medium/Low
- **Issue**: [Specific description]
- **Suggestion**: [Fix direction]clean-code-review.mdclean-code-review.json/review-clean-code --scope=components--dimension=naming