| name | ai-smell-fix |
| description | Remove AI-generated code smells. Make code look human-written. |
/ai-smell-fix [path]
Hunt and remove AI-generated code patterns. Make code look like a skilled human wrote it.
No arguments? Describe this skill and stop. Do not execute.
First: Activate Workflow
mkdir -p .claude && echo '{"skill":"ai-smell-fix","started":"'$(date -Iseconds)'"}' > .claude/active-workflow.json
The AI Smell Checklist
Over-Abstraction
- Factories/wrappers used exactly once โ inline them
createUserService() that just returns new UserService() โ delete factory
- Abstract base class with one implementation โ flatten to concrete
Defensive Paranoia
- Null checks where null is impossible โ remove
if (x !== undefined && x !== null && x) โ just if (x)
- Try/catch around infallible code โ remove
- Validating internal function arguments โ trust your own code
Comment Spam
// increment counter above counter++ โ delete
// loop through users above for (user of users) โ delete
// return the result above return result โ delete
- Comments that repeat the code โ delete all
Speculative Features
- Config options nobody uses โ remove
- Parameters with only one value ever passed โ inline
options?: { verbose?: boolean } never set to true โ remove
- Feature flags for features that shipped months ago โ remove
Enterprise Patterns in Simple Code
- Repository pattern for one entity โ inline queries
- Event bus with one publisher and one subscriber โ direct call
- Strategy pattern with one strategy โ just use the function
- Builder pattern for object with 3 fields โ use object literal
Generic Wrapper Abuse
Result<T, E> when you just throw โ throw
Response<T> that's always { data: T } โ just return T
Maybe<T> when null works fine โ use null
- Custom error types that add nothing โ use Error
Verbose Naming
userDataObjectInstance โ user
isCurrentlyProcessingRequest โ processing
getAllUsersFromDatabase โ getUsers
- Names longer than 25 chars โ shorten
Excessive Structure
- Single-method classes โ convert to function
utils/helpers/formatters/stringFormatters.ts โ flatten
- Re-exporting everything through index files โ import directly
Architectural Bloat
- More than 1 file per clear concern โ consolidate (e.g., crypto.ts + keystore-io.ts doing load/save/encrypt = 1 concern)
- Helper file with <5 functions all called from one place โ inline into caller
- Type defined in separate file but used by only 1 module โ colocate with module
- Data flows through >2 functions before doing work (A calls B calls C calls D) โ flatten call chain
- Same value threaded through >3 function signatures โ restructure so it's available naturally
Process
- Scan - Read all files in target
- Identify - Find AI smell patterns
- Fix - Remove/simplify each one
- Verify - Run tests to ensure behavior preserved
REQUIRED Output Format
## AI Smell Removal: [target]
SMELLS_FOUND:
- [file:line] [smell type]: [description]
SMELLS_FIXED:
- [file:line] [smell type] โ [what was done]
LINES_REMOVED: N
ABSTRACTIONS_INLINED: N
COMMENTS_DELETED: N
TESTS_PASS: yes
AI_SMELL_REVIEW_COMPLETE
Final: Pitfalls
Known pitfalls are maintained in canon/pitfalls/SKILL.md. If you discover a new recurring pattern, note it in the report output โ it can be added to the pitfalls canon in a future release.
Validation (Phase FAILS if violated)
- Smells found but not fixed
- Tests failing after changes
- No AI_SMELL_REVIEW_COMPLETE marker
๐ MANDATORY STOP
After fixing smells:
- DO NOT proceed to next phase
- DO NOT continue with "let me also..."
Your turn ends here. Output AI_SMELL_REVIEW_COMPLETE and STOP.