trw-dry-check

Detect duplicated code blocks across files and suggest extraction signatures.

Updated Mar 25, 2026
One-click install
npx skills add https://github.com/wallter/trw-mcp --skill trw-dry-check
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: trw-dry-check
Source: https://github.com/wallter/trw-mcp/tree/main/src/trw_mcp/data/codex/skills/trw-dry-check
Command: npx skills add https://github.com/wallter/trw-mcp --skill trw-dry-check

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Projects often accumulate duplicated code blocks, creating maintenance headaches and drift. This Skill scans code across files to surface DRY violations and proposes targeted extractions to improve long-term readability and reuse.

Core Features & Use Cases

  • Cross-file duplicate detection: identifies exact and near-duplicate code blocks across a codebase.
  • Refactoring guidance: suggests ownership for shared code and a candidate function signature for the extracted helper.
  • Reporting & metrics: summarizes total blocks found, affected files, and recommended extractions to guide code reviews.
  • Use Case: when consolidating common utilities into a shared module, use this Skill to surface candidates for extraction and a plan to implement them.

Quick Start

Run /trw-dry-check [file-patterns...] to scan the repository for duplicated code patterns and generate a refactoring plan.

Frequently Asked Questions about trw-dry-check

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect duplicate code blocks across files for refactoring?

To detect duplicate code blocks across files, you can scan the repository to surface DRY violations and receive targeted extraction proposals. This process requires block-level comparison of 5+ consecutive lines with whitespace normalization to identify exact and near-duplicates.

What is the minimum consecutive line count required for duplicate code detection?

The minimum requirement for duplicate code detection is 5+ consecutive lines. The analysis applies block-level comparison with whitespace normalization to accurately identify duplicated code blocks and suggest clean extractions.

Can I use static analysis to find refactoring candidates during code reviews?

Yes, you can use static analysis to find refactoring candidates during code reviews or CI checks. It summarizes total duplicated blocks found, affected files, and recommended extractions to guide code reviews and improve maintainability.

How do I generate a refactoring plan for consolidating common utilities?

To generate a refactoring plan for consolidating common utilities, scan the codebase to surface candidates for extraction. The analysis provides a concise owner-and-signature suggestion for the extracted helper to guide implementation.

Does duplicate code detection work for projects of varying sizes and languages?

Yes, duplicate code detection works for projects of varying sizes and languages. It applies cross-file duplicate detection to identify exact and near-duplicate code blocks across the codebase regardless of the project scale.