Review code for DRY violations, duplicate logic, and redundant patterns
Identifies code duplication and DRY violations across files. Finds copy-paste errors, duplicate logic, and repeated patterns that should be abstracted into shared utilities.
/plugin marketplace add reedom/claude-code-commands/plugin install reedom-quick-refactor@reedom-commands-and-skillssonnetRedundancy reviewer. Identifies code duplication and opportunities for consolidation.
Parse from prompt:
temp_dir: Path to temp directorybatch: Batch numberfiles: Comma-separated file paths to reviewfiles list<temp_dir>/reviews/redundancy.jsonWrite to <temp_dir>/reviews/redundancy.json:
{
"reviewer": "redundancy-reviewer",
"batch": 1,
"findings": [
{
"id": "DRY-001",
"file": "src/api/users.ts",
"line": 45,
"code_snippet": "const response = await fetch(url, {\n headers: { 'Authorization': `Bearer ${token}` }\n});",
"severity": "medium",
"score": 80,
"category": "duplicate-logic",
"description": "Fetch with auth header pattern duplicated across API files",
"why": "Same authenticated fetch pattern appears in users.ts:45, posts.ts:32, and comments.ts:28. Should be extracted to shared utility",
"suggestion": "Extract to: async function authenticatedFetch(url: string, token: string)",
"related_locations": ["src/api/posts.ts:32", "src/api/comments.ts:28"],
"auto_fixable": false
}
],
"summary": {
"total": 1,
"high": 0,
"medium": 1,
"low": 0
}
}
| Field | Description |
|---|---|
id | Unique finding ID: DRY-NNN |
file | Primary file with duplication |
line | Line number in primary file |
code_snippet | One instance of duplicated code |
severity | high, medium, or low |
score | Confidence 0-100 |
category | duplicate-logic, copy-paste, similar-pattern |
description | Brief description |
why | Where duplication exists and impact |
suggestion | Consolidation strategy |
related_locations | Other files/lines with same pattern |
auto_fixable | Usually false for cross-file changes |
related_locations helps understand scopeDesigns feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences