code-architecture-wrong-abstraction

Identify when to abstract or duplicate code using the Rule of Three.

Updated Nov 8, 2022
One-click install
npx skills add https://github.com/abhilash-nandkumar/dot_config --skill code-architecture-wrong-abstraction-abhilash-nandkumar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-architecture-wrong-abstraction
Source: https://github.com/abhilash-nandkumar/dot_config/tree/main/opencode/skills/code-architecture-wrong-abstraction
Command: npx skills add https://github.com/abhilash-nandkumar/dot_config --skill code-architecture-wrong-abstraction-abhilash-nandkumar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers avoid wasted effort by guiding when to extract shared utilities and when to duplicate code, preventing premature abstraction that erodes clarity.

Core Features & Use Cases

  • A clear rule-of-three framework to decide when abstraction is beneficial.
  • Guidance to avoid wrong abstractions and the pitfalls of premature generalization.
  • Refactoring advice with practical patterns and concrete examples to illustrate outcomes.

Quick Start

Ask the AI to review a small code sample and decide whether to extract a shared utility or keep code duplication for clarity.

Frequently Asked Questions about code-architecture-wrong-abstraction

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

FAQPage Schema
When should I abstract code versus allowing code duplication for clarity?

Use the rule of three to decide when to abstract code: wait until a pattern appears three times before extracting shared utilities. This prevents premature generalization and keeps code clear.

How do I avoid wrong abstractions when refactoring shared utilities?

Avoid wrong abstractions by prioritizing clarity over premature generalization. Use concrete guardrails to evaluate whether extracting a shared utility actually simplifies the codebase before refactoring.

Does premature abstraction cause code architecture issues in multi-file projects?

Yes, premature abstraction erodes clarity in multi-file software projects. Extracting shared utilities too early creates rigid structures that are harder to modify than the original duplicated code.

What is the best way to evaluate library design and refactoring tasks for DRY principles?

Evaluate refactoring tasks by checking if the abstraction satisfies rule-of-three criteria. Extract shared utilities only when real-world patterns justify the generalization, ensuring DRY principles are applied correctly.

Why does code architecture fail when applying DRY principles too aggressively?

Aggressive DRY application fails because premature generalization couples unrelated modules through wrong abstractions. Keeping code duplication is often clearer than forcing a shared utility prematurely.