code-architecture-wrong-abstraction

Evaluates code patterns to recommend whether to abstract or duplicate.

Updated Apr 17, 2026
One-click install
npx skills add https://github.com/Chris-Maskey/opencode-config --skill code-architecture-wrong-abstraction-chris-maskey
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-architecture-wrong-abstraction
Source: https://github.com/Chris-Maskey/opencode-config/tree/main/skills/code-architecture-wrong-abstraction
Command: npx skills add https://github.com/Chris-Maskey/opencode-config --skill code-architecture-wrong-abstraction-chris-maskey

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents premature or incorrect abstractions that create coupling, indirection, and maintenance pain by helping developers decide when to duplicate code versus extract shared utilities.

Core Features & Use Cases

  • Rule of Three: Encourages waiting for three stable occurrences before extracting a shared abstraction.
  • Decision Guidance: Helps evaluate stability of requirements, behavioral differences, and whether an abstraction simplifies or complicates the codebase.
  • Remediation Patterns: Recommends inlining, pruning optional parameters, and re-extracting clean abstractions after patterns emerge.
  • Use Cases: Refactoring UI components, consolidating utility functions, evaluating facades in a design system, and resolving bloated helper functions.

Quick Start

Ask the skill to evaluate a function or component and recommend whether to abstract or keep duplication based on pattern stability and the number of occurrences.

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 duplicate code instead of extracting a shared abstraction?

You should duplicate code when pattern frequency is low and requirements are unstable. Applying the Rule of Three helps decide whether to duplicate code by waiting for three stable occurrences before extracting a shared abstraction.

How do I know if my code abstraction is wrong?

A wrong code abstraction typically creates coupling, indirection, and maintenance pain. You can identify it by evaluating behavioral differences across modules and checking whether the abstraction simplifies or complicates the codebase.

How do I refactor a bloated helper function with optional parameters?

To refactor a bloated helper function, you should inline the abstraction, prune optional parameters, and re-extract clean abstractions only after stable patterns emerge across the codebase.

Does the Rule of Three apply to UI component refactoring?

Yes, the Rule of Three applies to UI component refactoring. It helps evaluate pattern stability and occurrence frequency to recommend inlining, selective extraction, or retaining a facade for your components.

What is the best way to evaluate a facade pattern in a design system?

The best way to evaluate a facade pattern is by assessing requirement stability and behavioral differences. This determines whether to retain the facade, inline the code, or re-extract a cleaner abstraction.

Why does premature abstraction cause maintenance pain?

Premature abstraction causes maintenance pain because it introduces unnecessary coupling and indirection before stable requirements and behavioral patterns have emerged across the duplicated code.