duplication-vs-abstraction

Official

Decide when to abstract or duplicate code.

Authorrecyclarr
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill provides a framework to help developers make informed decisions about whether to refactor duplicated code into a shared abstraction or to keep them separate, preventing premature or incorrect abstractions.

Core Features & Use Cases

  • Decision Framework: Offers a structured checklist to guide the abstraction decision.
  • DRY Principle Clarification: Emphasizes that DRY applies to knowledge, not just syntax.
  • Rule of Three Guidance: Recommends abstracting only after encountering three or more instances.
  • Cost-Benefit Analysis: Helps evaluate the true cost of an abstraction versus the cost of duplication.
  • Code-Generated Types Handling: Provides strategies for dealing with similar types generated by different tools.
  • Anti-Corruption Layer Considerations: Addresses abstraction in the context of Domain-Driven Design.
  • Use Case: When you have three similar API client adapters, this skill helps you determine if they should be unified under a single interface or kept separate.

Quick Start

Use the duplication-vs-abstraction skill to decide if the three similar code snippets should be refactored into a single abstraction.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: duplication-vs-abstraction
Download link: https://github.com/recyclarr/recyclarr/archive/main.zip#duplication-vs-abstraction

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.