Agent skill
review-and-simplify
Review and simplify implementation
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/review-and-simplify
SKILL.md
Review and Simplify Implementation
Steps
-
Get diff against main:
bashgit diff main...HEAD --name-only | grep -E '\.(ts|tsx)$' | grep -v '\.test\.' -
For each changed file (excluding tests):
Read the file and identify:
- Dead code: Unused imports, variables, functions
- Over-abstraction: Unnecessary indirection, premature generalization
- Unclear naming: Variables/functions that don't describe their purpose
- Redundant logic: Duplicate code, unnecessary conditions
- Complex expressions: Code that could be simplified
-
For each simplification:
a. Make the change
b. Run tests to verify no breakage:
bashnpm test --workspaces --if-presentc. If tests fail, revert and skip that simplification
-
If any simplifications were made, commit:
bashgit commit -m "refactor: simplify implementation"
What to Simplify
DO:
- Remove unused imports
- Remove unused variables and functions
- Simplify complex conditionals
- Inline single-use abstractions
- Improve variable/function names for clarity
- Remove redundant type annotations
- Simplify nested callbacks/promises
DO NOT:
- Add new features
- Change observable behavior
- Add documentation or comments
- Refactor code that wasn't changed in this feature
- Add error handling that wasn't in the original
- "Improve" working code just because you can
Example Simplifications
// Before: Over-complicated
const isValid = data !== null && data !== undefined && data.length > 0;
// After: Simplified
const isValid = data?.length > 0;
// Before: Unused abstraction
function createHandler(fn: Function) {
return (req, res) => fn(req, res);
}
app.get("/api", createHandler(handleRequest));
// After: Direct usage
app.get("/api", handleRequest);
Notes
- This is a cleanup pass, not a refactoring exercise
- Keep changes minimal and focused
- Test after each change to catch regressions early
- If unsure whether a change is safe, skip it
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?