Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

dry-code-review

БесплатноЗапускает вложенные скриптыНе проверен

Perform a comprehensive DRY (Don't Repeat Yourself) code review on a codebase. Identifies duplicated code, repeated logic, redundant patterns, and…

espennilsenот espennilsen★ 122 звезды на GitHub

Об этом скилле

DRY Code Review Skill

Perform a structured, thorough code review focused on the DRY (Don't Repeat Yourself) principle. The review is planned and tracked via a markdown file in plans/.

Overview

The DRY principle states: "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system." This skill systematically finds violations and recommends fixes.

Workflow

Phase 1: Setup & Discovery

  1. Create the tracking plan in plans/dry-review-<project-name>.md using the template below
  2. Inventory the codebase: List all source files, their languages, sizes, and roles
  3. Identify scope: Confirm with the user which directories/files to include or exclude (e.g., skip node_modules, vendor, generated files, test fixtures)

Phase 2: Automated Scanning

Run the scanning script to find likely duplication:

bash /path/to/dry-code-review/scripts/find_duplicates.sh <target_directory> [extensions]

The script detects:

  • Identical or near-identical code blocks (3+ lines repeated)
  • Repeated string literals and magic numbers
  • Similar function signatures across files
  • Repeated boilerplate and configuration patterns

Import/dependency lines are intentionally excluded from the duplicate-lines scan so they don't dominate the output.

Phase 3: Manual Analysis

After automated scanning, perform deeper analysis by reading the codebase. Look for these DRY violation categories:

Category 1: Literal Duplication

  • Copy-pasted code blocks (exact or near-exact)
  • Repeated string literals / magic numbers
  • Duplicate configuration values

Category 2: Structural Duplication

  • Functions/methods that do the same thing with minor variations
  • Repeated conditional logic (same if/else chains)
  • Similar class structures that could share a base class or mixin
  • Repeated error handling patterns

Category 3: Logical Duplication

  • Same business logic expressed differently in multiple places
  • Repeated validation rules
  • Duplicate data transformation pipelines
  • Same algorithm implemented in multiple places

Category 4: Cross-Cutting Duplication

  • Repeated boilerplate across files (logging, auth checks, error wrappers)
  • Similar API endpoint handlers
  • Repeated test setup/teardown code
  • Duplicate build/deploy configuration

Phase 4: Findings & Recommendations

For each finding, document:

  1. ID: Sequential identifier (DRY-001, DRY-002, ...)
  2. Category: Which of the 4 categories above
  3. Severity: 🔴 High (5+ repetitions or core logic) / 🟡 Medium (2-4 repetitions) / 🟢 Low (minor or cosmetic)
  4. Locations: File paths and line numbers of all occurrences
  5. Description: What is duplicated and why it matters
  6. Recommendation: Specific refactoring approach
  7. Effort: S / M / L estimate

Common Refactoring Recommendations

  • Extract Function/Method: Pull repeated logic into a shared function
  • Extract Constant/Config: Replace magic numbers and repeated literals
  • Create Base Class/Mixin: Share behavior across similar classes
  • Use Higher-Order Functions: Wrap repeated patterns (decorators, middleware)
  • Create Shared Utility Module: Centralize cross-cutting concerns
  • Use Templates/Generics: Parameterize structural duplication
  • Apply Strategy Pattern: Replace repeated conditional branches
  • Consolidate Configuration: Single source of truth for settings

Phase 5: Summary & Prioritization

Update the plan file with:

  • Total findings count by category and severity
  • A prioritized action list (quick wins first, then high-impact refactors)
  • Estimated effort for full remediation
  • Risk notes (what could break if refactored carelessly)

Plan File Template

The plan file MUST be created at plans/dry-review-<project-name>.md using this structure:

# DRY Code Review: <Project Name>

## Review Metadata
- **Date**: YYYY-MM-DD
- **Reviewer**: Claude (AI-assisted)
- **Scope**: <directories/files reviewed>
- **Languages**: <languages found>
- **Total Files Scanned**: <count>
- **Total Lines of Code**: <count>

## Status
- [ ] Phase 1: Setup & Discovery
- [ ] Phase 2: Automated Scanning
- [ ] Phase 3: Manual Analysis
- [ ] Phase 4: Findings & Recommendations
- [ ] Phase 5: Summary & Prioritization

## Scope Definition
### Included
- <list of included paths>

### Excluded
- <list of excluded paths and reasons>

## Findings

### Summary
| Category               | 🔴 High | 🟡 Medium | 🟢 Low | Total |
|------------------------|---------|----------|--------|-------|
| Literal Duplication    |         |          |        |       |
| Structural Duplication |         |          |        |       |
| Logical Duplication    |         |          |        |       |
| Cross-Cutting          |         |          |        |       |
| **Total**              |         |          |        |       |

### Detailed Findings

#### DRY-001: <Title>
- **Category**: <category>
- **Severity**:
Полный SKILL.md на GitHub

Установить dry-code-review в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

scripts/find_duplicates.sh

FAQ

Что делает скилл dry-code-review?

Perform a comprehensive DRY (Don't Repeat Yourself) code review on a codebase. Identifies duplicated code, repeated logic, redundant patterns, and opportunities for abstraction. Use this skill whenever the user asks to review code for duplication, reduce repetition, apply DRY principles, refactor for reusability, find copy-pasted code, deduplicate logic, or audit code quality with a focus on redundancy. Also trigger when users say things like "clean up my code", "find repeated patterns", "too much boilerplate", "reduce code duplication", or "refactor for maintainability". Works on any language or framework.

Как установить скилл dry-code-review?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл dry-code-review запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить dry-code-review с