dry-principle

Detect duplicated logic, constants, and configuration across modules.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/ngmthaq/my-copilot --skill dry-principle-ngmthaq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dry-principle
Source: https://github.com/ngmthaq/my-copilot/tree/main/skills/dry-principle
Command: npx skills add https://github.com/ngmthaq/my-copilot --skill dry-principle-ngmthaq

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

DRY (Don't Repeat Yourself) is violated when knowledge or logic is duplicated across a codebase, leading to drift, higher maintenance costs, and more bugs. This Skill teaches how to identify duplications and consolidate them into a single source of truth.

Core Features & Use Cases

  • Detect duplicated logic, constants, data shapes, and configuration across modules.
  • Promote refactoring patterns by extracting shared abstractions (functions, constants, modules) and updating call sites to rely on one definition.
  • Provide practical guidelines for common violations and enforcement strategies to maintain consistency over time.

Quick Start

Identify a duplicated block in your codebase and extract it into a shared function or constant.

Frequently Asked Questions about dry-principle

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

FAQPage Schema
How do I eliminate code duplication across constants, logic, and configuration?

You can eliminate code duplication by extracting duplicated logic, constants, and configuration into shared abstractions, ensuring a single source of truth that reduces drift and maintenance costs.

What is the DRY principle and when do I need to apply it?

The DRY principle enforces a single source of truth by consolidating duplicated knowledge across a codebase. Apply it when duplicated constants, data schemas, or tests cause drift, higher maintenance costs, and bugs.

What's the best way to refactor duplicated blocks into a shared abstraction?

The best way to refactor duplicated blocks is to identify repeated logic or data shapes, extract them into shared functions or constants, and update all call sites to rely on that single definition for consistency.

Does enforcing DRY help with maintaining data schemas and tests?

Enforcing DRY helps maintain data schemas and tests by consolidating duplicated definitions into a single source of truth, which reduces drift and errors across modules while validating consistency before merging changes.

When should I not extract shared abstractions to fix code duplication?

Avoid extracting shared abstractions when duplicated code is coincidental rather than representing the same knowledge, as forcing a shared definition creates unnecessary coupling and increases maintenance complexity.