Remove AI-generated slop and simplify code for clarity and maintainability
Remove AI-generated slop and simplify code for clarity before committing. Use after `/audit` to clean up unnecessary comments, defensive code, and over-engineered patterns in your changes.
/plugin marketplace add thkt/claude-config/plugin install complete-workflow-system@thkt-development-workflowsopusClean up and simplify code by:
Run this before committing to ensure clean, maintainable code.
/audit → Find issues
↓
/polish → Simplify & remove slop ← Here
↓
/commit → Clean state
// Bad: AI adds obvious comments
// Get the user name from the user object
const name = user.name;
// Good: Self-explanatory code needs no comment
const name = user.name;
// Bad: Over-defensive in trusted context
function processUser(user: User) {
if (!user) throw new Error("User is required");
if (!user.name) throw new Error("Name is required");
if (typeof user.name !== "string") throw new Error("Name must be string");
// ... when caller already validates
}
// Good: Trust internal callers
function processUser(user: User) {
return { ...user, processed: true };
}
Refer to: @../skills/reviewing-readability/references/ai-antipatterns.md
// Bad: Nested ternary
const status = isActive ? (isPremium ? "vip" : "active") : "inactive";
// Good: Explicit switch/if-else
function getStatus(isActive: boolean, isPremium: boolean): string {
if (!isActive) return "inactive";
return isPremium ? "vip" : "active";
}
Get branch diff
git diff main...HEAD
Analyze changes for AI patterns
Apply fixes
Report summary
## Polish Summary
Removed:
- 3 unnecessary comments
- 1 redundant try-catch
- 2 single-use helpers inlined
Files: src/api.ts, src/utils.ts
When simplifying, prioritize:
Keep summary brief (1-3 sentences):
✨ Polished: Removed 5 unnecessary comments and inlined 2 single-use helpers in src/api.ts
After polish is complete, update the IDR (Implementation Decision Record) with simplification results.
Before updating IDR, check if it's required:
idr_required field (Section 11)idr_required: false → Skip IDR updateidr_required: true or no spec → Update IDRFor detailed logic: @../references/commands/shared/idr-generation.md
Search for existing IDR:
~/.claude/workspace/planning/**/idr.md (SOW-related)~/.claude/workspace/idr/**/idr.md (standalone)Append /polish section to IDR:
## /polish - [YYYY-MM-DD HH:MM]
### Removals
| Item | Type | Reason |
| -------------- | ------------------- | -------- |
| [removed item] | Comment/Code/Helper | [reason] |
### Simplifications
- [simplified content and rationale]
After polish:
/commit/validate/audit again