Openclaw-skills code-simplify
Review code changes for reuse opportunities, quality issues, and efficiency problems, then fix issues found. Triggers on phrases like "simplify", "review my changes", "check code quality", "audit this code", "clean up changes", "review the diff". Use after making code changes to catch duplicated logic, hacky patterns, performance issues, and unnecessary complexity before committing.
git clone https://github.com/EasyJoy-Technologies/openclaw-skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/EasyJoy-Technologies/openclaw-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/code-simplify" ~/.claude/skills/easyjoy-technologies-openclaw-skills-code-simplify && rm -rf "$T"
T=$(mktemp -d) && git clone --depth=1 https://github.com/EasyJoy-Technologies/openclaw-skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/code-simplify" ~/.openclaw/skills/easyjoy-technologies-openclaw-skills-code-simplify && rm -rf "$T"
skills/code-simplify/SKILL.mdCode Simplify — Three-Way Parallel Code Review
Review all changed files for reuse, quality, and efficiency. Fix any issues found.
Phase 1: Identify Changes
Run
git diff in the project directory (or git diff HEAD if there are staged changes) to see what changed.
If there are no git changes, review the most recently modified files that the user mentioned or that were edited earlier in this conversation.
If a specific file or directory was provided as argument, focus the review there.
Phase 2: Launch Three Review Agents in Parallel
Use
sessions_spawn to launch all three agents concurrently. Pass each agent the full diff so it has the complete context.
Agent 1: Code Reuse Review
Prompt the agent with the diff and these instructions:
For each change:
- Search for existing utilities and helpers that could replace newly written code. Look for similar patterns elsewhere in the codebase — common locations are utility directories, shared modules, and files adjacent to the changed ones.
- Flag any new function that duplicates existing functionality. Suggest the existing function to use instead.
- Flag any inline logic that could use an existing utility — hand-rolled string manipulation, manual path handling, custom environment checks, ad-hoc type guards, and similar patterns.
Agent 2: Code Quality Review
Review the same changes for hacky patterns:
- Redundant state: state that duplicates existing state, cached values that could be derived
- Parameter sprawl: adding new parameters instead of generalizing or restructuring
- Copy-paste with slight variation: near-duplicate code blocks that should be unified
- Leaky abstractions: exposing internal details that should be encapsulated
- Stringly-typed code: raw strings where constants, enums, or typed values already exist
- Unnecessary comments: comments explaining WHAT (well-named identifiers already do that) — keep only non-obvious WHY
Agent 3: Efficiency Review
Review the same changes for efficiency:
- Unnecessary work: redundant computations, repeated file reads, duplicate API calls, N+1 patterns
- Missed concurrency: independent operations run sequentially when they could run in parallel
- Hot-path bloat: blocking work added to startup or per-request hot paths
- Recurring no-op updates: updates that fire unconditionally — add change-detection guards
- Unnecessary existence checks: pre-checking file/resource existence before operating (TOCTOU anti-pattern)
- Memory: unbounded data structures, missing cleanup, event listener leaks
- Overly broad operations: reading entire files when only a portion is needed
Phase 3: Aggregate and Fix
Wait for all three agents to complete. Aggregate their findings into a single report:
- Group findings by severity: 🔴 Critical / 🟡 Improvement / 🟢 Suggestion
- For each finding: file, line range, issue, recommended fix
- If the user confirms, apply fixes directly
- If a finding is a false positive, note it and move on
Output Format
## Code Review Summary ### 🔴 Critical (N issues) - [file:line] Issue description → Fix ### 🟡 Improvements (N issues) - [file:line] Issue description → Fix ### 🟢 Suggestions (N issues) - [file:line] Issue description → Fix ### ✅ No issues found in: [areas]