/code-practices:simplifyfrom code-practices
Remove over-engineering and unnecessary abstractions. Use after implementing features or when code feels bloated.
Ships in code-practices. Installing the plugin adds it to Claude Code.
Use after implementing a feature, or when code feels bloated or over-engineered.
LLMs tend to over-engineer. The best code is code that doesn't exist. Every line is a liability. Simpler code is easier to understand, test, debug, and maintain.
Before and after. Set a target. If you have 500 lines, ask: "Can this be 200?"
Over-abstracted factories:
// Before: Factory that only creates one thing
class UserServiceFactory {
create(): UserService { return new UserService(); }
}
// After: Just use the class directly
const userService = new UserService();
Unnecessary interfaces:
// Before: Interface with single implementation
interface IUserRepository { ... }
class UserRepository implements IUserRepository { ... }
// After: Just the class (add interface when you need it)
class UserRepository { ... }
Config objects for fixed values:
// Before
const config = { maxRetries: 3, timeout: 5000 };
function fetch(url: string, config: Config) { ... }
// After (if values never change)
function fetch(url: string) {
const maxRetries = 3;
const timeout = 5000;
...
}
Premature error handling:
// Before: Handling impossible errors
try {
const x = 1 + 1;
} catch (e) {
// This can never throw
}
// After: Trust code that can't fail
const x = 1 + 1;
After simplification, report:
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub rahulsub/code-practices-plugin --plugin code-practices13 commands in this plugin
/cleanupSystematic code cleanup after completing features. Use after refactoring or periodically to remove dead code, console statements, TODOs, and tech debt./code-reviewReview code like a skeptical senior engineer. Use when reviewing PRs, after generating significant code, or before merging changes./context-managementManage Claude Code sessions effectively. Use during long sessions, multi-step tasks, or when responses start degrading. Covers /clear, checklists, and subagents.Other plugins' commands for the same job