mirror of
https://github.com/harivansh-afk/claude-continual-learning.git
synced 2026-04-15 07:04:45 +00:00
3 KiB
3 KiB
| description | allowed-tools | argument-hint | |
|---|---|---|---|
| Simplify overly complex code while preserving full functionality | Read, Edit, Bash(git diff:*), Bash(git status:*), Grep, Glob |
|
Simplify Implementation
You are reviewing code you just wrote to simplify it. Claude has a tendency to over-engineer. Your job is to ruthlessly simplify while preserving full functionality.
Context
Current git status: !git status --short
Changes to Review
Based on the argument provided ($ARGUMENTS), review the appropriate diff:
- staged (or no argument): Review staged changes only
- unstaged: Review unstaged changes only
- both: Review all changes (staged and unstaged)
Staged changes: !git diff --cached
Unstaged changes: !git diff
Simplification Principles
Remove Over-Engineering
- Delete unnecessary abstractions: If a function is called once, inline it
- Remove premature generalization: Delete parameters, options, or config that aren't used
- Flatten unnecessary nesting: Reduce indirection levels
- Kill dead code paths: Remove conditionals that can't trigger
- Simplify error handling: Don't catch errors you can't meaningfully handle
- Remove defensive coding against impossible states: Trust internal code
Prefer Direct Solutions
- Three lines > one abstraction: Repeated simple code beats a premature helper
- Explicit > clever: Readable beats compact
- Flat > nested: Early returns, guard clauses
- Concrete > generic: Solve the actual problem, not hypothetical ones
- Standard library > custom implementation: Use built-ins when available
Preserve
- All functionality: The feature must work exactly as before
- Public interfaces: Don't change signatures that external code depends on
- Test coverage: Existing tests must still pass
- Actual error handling: Keep meaningful error cases
Your Task
- Analyze the diff: Identify over-engineered patterns
- List simplifications: For each issue, explain what's complex and how to simplify
- Apply changes: Edit the files to simplify
- Verify: Ensure functionality is preserved
Output Format
For each simplification:
FILE: path/to/file.ts
ISSUE: [What's over-engineered]
BEFORE: [Brief description or code snippet]
AFTER: [Brief description or code snippet]
WHY: [Why this is simpler without losing functionality]
Then apply the edits.
Red Flags to Watch For
- Functions with > 3 parameters (probably doing too much)
- Deeply nested callbacks or conditionals (flatten them)
- Abstract base classes with one implementation (delete the abstraction)
- Config objects for things that could be hardcoded
- Wrapper functions that just call another function
- Comments explaining what code does (code should be self-explanatory)
- Type definitions that duplicate structure (use inference)
- Utility functions used once (inline them)
- Try/catch that just re-throws or logs (let it bubble)
- Feature flags for features that are always on