abstraction-check

Evaluate code abstractions for duplication and cognitive load.

3|Updated Nov 19, 2025
One-click install
npx skills add https://github.com/meaganewaller/.dotfiles --skill abstraction-check
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: abstraction-check
Source: https://github.com/meaganewaller/.dotfiles/tree/main/home/.claude/skills/common/abstraction-check
Command: npx skills add https://github.com/meaganewaller/.dotfiles --skill abstraction-check

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers decide whether to extract code into a new function, class, or module, preventing over-engineering and unnecessary complexity.

Core Features & Use Cases

  • Decision Framework: Provides a structured approach to evaluate abstraction candidates.
  • Rule of Three: Guides users to apply the common heuristic for code extraction.
  • Use Case: When you're unsure if a piece of duplicated code should be refactored into a shared utility, this Skill helps you make the right call.

Quick Start

Use the abstraction-check skill to evaluate if a new helper function is needed.

Frequently Asked Questions about abstraction-check

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

FAQPage Schema
How do I know when to extract duplicated code into a shared utility?

Evaluate duplicated code for extraction by applying the Rule of Three and analyzing speculative generality. Avoid premature abstraction by waiting until code is duplicated at least three times before refactoring it into a shared utility.

What is premature abstraction in software design?

Premature abstraction is creating helper functions, base classes, or shared modules before the actual need is established. It introduces unnecessary complexity and cognitive load, making the codebase harder to maintain and understand.

How do I decide between extracting code into a new function or inlining it?

Decide between extracting or inlining code by analyzing duplication, potential leaky abstractions, and cognitive load. Use software design principles like DRY and the Rule of Three to guide your refactoring decisions and prevent over-engineering.

When should I avoid creating a base class for shared code?

Avoid creating a base class when it introduces speculative generality or a leaky abstraction. If the shared module increases cognitive load without providing immediate, concrete reuse value across multiple instances, inlining the code is preferred.

Does the Rule of Three apply to all code refactoring decisions?

The Rule of Three applies to code refactoring by suggesting you extract code into an abstraction only after it has been duplicated three times. It helps balance the DRY principle against the risk of premature abstraction and unnecessary complexity.