.agents code-review
Perform thorough code reviews focusing on unused code, duplications, coding patterns, bugs, and optimizations. Use when user wants code reviewed or audited. Read-only - outputs findings without making changes.
install
source · Clone the upstream repo
git clone https://github.com/Weaverse/.agents
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/Weaverse/.agents "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/code-review" ~/.claude/skills/weaverse-agents-code-review && rm -rf "$T"
manifest:
skills/code-review/SKILL.mdsource content
Perform a comprehensive code review on $ARGUMENTS. This is a read-only review - do NOT modify any files. Only output findings.
Review Categories
1. Dead Code Detection
- Unused imports
- Unused variables, functions, components, hooks
- Unreachable code paths
- Commented-out code that should be removed
- Unused type definitions / interfaces
2. Code Duplication
- Duplicated logic that could be extracted to a shared utility
- Similar components that could be consolidated
- Repeated patterns that warrant a custom hook
- Copy-pasted code blocks across files
3. Coding Pattern Violations
Check against these rules:
- Collocation > Distribution: Related code should live together, not scattered
>let
: Preferconst
overlet
for variable declarationsconst- Named exports > Default exports: Use
notexport function Fooexport default - Function declarations > Function expressions: Use
notfunction foo()const foo = () => - No
: Flag any usage ofuseMemouseMemo - No
: Flag any usage ofuseCallbackuseCallback
for constants: Constants should beALL_CAPSSCREAMING_SNAKE_CASE
4. Bugs & Memory Leaks
- Missing cleanup in useEffect
- Event listeners not removed
- Subscriptions not unsubscribed
- Stale closures
- Race conditions in async code
- Missing error handling
- Null/undefined access risks
- Incorrect dependency arrays
5. Optimization Opportunities
- Unnecessary re-renders
- Heavy computations in render path
- Missing keys in lists
- Inefficient data structures
- N+1 query patterns
- Bundle size concerns (large imports)
Output Format
For each finding, output with numbered indexes wrapped in brackets for easy reference:
CATEGORY NAME [1] `file:line` - Short description Brief explanation if needed (4-space indent) [2] `file:line` - Short description Explanation with 4-space indent
Important formatting rules:
- Use ALL CAPS for category names
- Use sequential numbering wrapped in brackets
,[1]
, etc. across ALL categories[2] - Highlight file references with backticks:
filename:line - Indent explanations with 4 spaces for readability
- For Coding Pattern Violations: If multiple items with the same problem occur in the same file, list only ONCE (e.g., "5 usages of
" instead of listing each). No fix suggestions needed - these are easy fixes.const
Example:
DEAD CODE [1] `src/utils/helpers.ts:42` - Unused function `formatDate` Not imported anywhere in the codebase [2] `src/components/Modal.tsx:3` - Unused import `useEffect` CODING PATTERN VIOLATIONS [3] `src/hooks/useAuth.ts` - Using `const` instead of `let` (7 occurrences) [4] `src/components/Button.tsx:1` - Default export used [5] `src/api/client.ts` - Function expressions instead of declarations (3 occurrences)
End of Review
After listing all findings, ask the user:
Found [N] items. Which would you like me to address? - Enter number(s) to fix specific items (e.g., "1, 3, 5" or "1-5") - "all" to fix everything - "none" to skip - Or describe what you'd like to do
Instructions
- Thoroughly explore the target files/directory
- Cross-reference imports and usages across the codebase
- Check for pattern violations against the coding rules
- Look for subtle bugs and memory leak patterns
- Identify optimization opportunities
- Output ALL findings grouped by category
- Be specific: always include
referencesfilename:line - Be concise: short descriptions, no lengthy explanations
- DO NOT make any changes - this is review only