Loading...
Loading...
Audit and refactor code for clarity, maintainability, and correctness. Use when the user asks to refactor, clean up code, reduce complexity, fix code smells, or improve code quality.
npx skill4agent add tartinerlabs/skills refactorrules/| Section | Prefix | Rules |
|---|---|---|
| General Patterns | | dead-code, deep-nesting, long-functions, magic-values, boolean-params, duplication |
| TypeScript/JS Idioms | | type-assertions, optional-chaining, nullish-coalescing, barrel-reexports, enum-union, async-await |
| Design Principles | | single-responsibility, interface-segregation, god-objects, tight-coupling |
as&&?.||??index.ts.then()## Refactoring Audit Results
### General Patterns
- `src/services/order.ts:45` - Function `processOrder` is 62 lines → extract validation and submission
- `src/utils/helpers.ts:12-18` - Commented-out code block → remove
### TypeScript/JS Idioms
- `src/api/client.ts:23` - `as UserResponse` → add type guard
- `src/config.ts:8` - `port || 3000` → use `??` (port could be 0)
### Design Principles
- `src/services/user.ts` - 14 named exports → split into focused modules
### Summary
| Category | Violations | Files |
|----------------------|------------|-------|
| General Patterns | X | N |
| TypeScript/JS Idioms | Y | N |
| Design Principles | Z | N |
| **Total** | **X+Y+Z** | **N** |