code-refactoring-dry

Extract duplicated logic into shared modules and update call sites.

15|2|Updated Aug 16, 2025
One-click install
npx skills add https://github.com/aspiers/ai-config --skill code-refactoring-dry
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-refactoring-dry
Source: https://github.com/aspiers/ai-config/tree/main/.claude/skills/code-refactoring-dry
Command: npx skills add https://github.com/aspiers/ai-config --skill code-refactoring-dry

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Duplicated logic across codebases is error-prone and costly to maintain; this skill promotes extracting shared logic into reusable components to reduce bugs and future work.

Core Features & Use Cases

  • Refactor shared logic into reusable modules to minimize duplication across projects.
  • Promote DRY principles to simplify maintenance and updates.
  • Use case: When you identify the same algorithm or pattern used in multiple files, refactor to a single implementation and update call sites.

Quick Start

Refactor the duplicated logic by extracting shared code into a new module and update all call sites.

Frequently Asked Questions about code-refactoring-dry

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

FAQPage Schema
How do I eliminate duplicated logic across multiple modules?

To eliminate duplicated logic across multiple modules, you extract the shared implementation into a single reusable component and update all existing call sites to reference it. This consolidation reduces maintenance costs and prevents bugs.

What is the best way to refactor code to follow the DRY principle?

Refactoring code to follow the DRY principle involves detecting identical logic in several locations, extracting a single shared implementation into a new module, and updating all call sites to use this consolidated component.

When do I need to extract shared logic into reusable modules?

You need to extract shared logic into reusable modules when you identify the same algorithm or pattern used in multiple files across multi-module projects. This refactoring simplifies future updates and minimizes code duplication.

How do I update call sites after extracting shared logic?

After extracting shared logic into a new module, you update all call sites by replacing the local duplicated implementations with references to the newly extracted shared component. You must then verify behavior with tests to ensure functionality remains intact.

Does code refactoring for DRY work for multi-file and multi-service projects?

Yes, DRY code refactoring applies to multi-file and multi-module projects where identical logic exists in several locations across modules or services. It detects duplication and consolidates it into a single shared implementation.