dont-repeat-yourself

Detect duplicated logic and extract shared utilities with clear interfaces.

13|2|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/yanko-belov/code-craft --skill dont-repeat-yourself
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dont-repeat-yourself
Source: https://github.com/yanko-belov/code-craft/tree/main/skills/dry
Command: npx skills add https://github.com/yanko-belov/code-craft --skill dont-repeat-yourself

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing similar code in multiple places leads to duplication, higher risk of drift, and harder maintenance.

Core Features & Use Cases

  • Detect duplication: identify repeated logic across files and modules.
  • Centralize shared logic: extract common code into reusable utilities and interfaces.
  • Use Case: refactor multiple form validations or data transformation blocks into a single reusable function.

Quick Start

Use the dont-repeat-yourself skill to refactor duplicated validation logic in your forms project by extracting a shared validator function and updating call sites.

Frequently Asked Questions about dont-repeat-yourself

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

FAQPage Schema
How do I eliminate code duplication when identical logic appears across multiple modules?

To eliminate code duplication, you extract repeated logic blocks into reusable functions and shared utilities. This centralizes common code into single sources of truth, ensuring easier maintenance and preventing drift across files and modules.

What is the best way to refactor duplicated form validation logic?

The best way to refactor duplicated form validations is to extract the shared logic into a single reusable validator function. You then update all call sites to reference this centralized utility, ensuring consistent validation behavior across your project.

When should I centralize shared logic during feature growth?

You should centralize shared logic during feature growth when identical code blocks start appearing across files, forms, or modules. Extracting these into reusable utilities prevents drift, lowers maintenance risk, and keeps your codebase clean as it scales.

How do I extract shared utilities without breaking existing call sites?

You extract shared utilities by identifying repeated logic, moving it into a centralized function with a clear interface, and writing tests for the new utility. You then systematically update all existing call sites to use this single source of truth.

Why does duplicated code across files lead to higher maintenance risk?

Duplicated code leads to higher maintenance risk because updates must be applied in multiple places, increasing the chance of drift. Centralizing common logic into reusable functions eliminates this repetition and ensures changes only need to be made once.