convention-single-abstraction

Enforce a single abstraction level within every function.

Updated Mar 19, 2026
One-click install
npx skills add https://github.com/sunLeee/optimization --skill convention-single-abstraction
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convention-single-abstraction
Source: https://github.com/sunLeee/optimization/tree/main/.claude/skills/reference/philosophy/design/single-abstraction
Command: npx skills add https://github.com/sunLeee/optimization --skill convention-single-abstraction

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Single Level of Abstraction (SLA) ensures code within a function operates at a single abstraction level to improve readability and maintainability.

Core Features & Use Cases

  • Enforces consistent abstraction levels across function bodies to reduce cognitive load.
  • Guides refactoring by extracting low-level details into dedicated helpers while preserving high-level intent.
  • Use Case: when implementing complex routines, prevent mixing high-level flow with low-level implementation details.

Quick Start

Refactor a function so it contains only one abstraction level by extracting low-level details into helpers.

Frequently Asked Questions about convention-single-abstraction

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

FAQPage Schema
What is single level of abstraction in software engineering?

Single Level of Abstraction (SLA) is a code design principle ensuring a function operates at one abstraction level. It improves readability and maintainability by preventing high-level control flow from mixing with low-level implementation details.

How do I refactor a function to maintain a single abstraction level?

Refactor a function to maintain a single abstraction level by extracting low-level implementation details into dedicated, well-named helper functions. This preserves high-level intent and keeps related responsibilities together within the main routine.

Why does mixing high-level flow and low-level details reduce code readability?

Mixing high-level flow with low-level details increases cognitive load, making software harder to read and maintain. Enforcing a single abstraction level within every function reduces this complexity and clarifies the code's intent.

When do I need to apply the single level of abstraction principle?

Apply the single level of abstraction principle when implementing complex routines. It prevents mixing high-level control flow with low-level implementation details, ensuring your modules remain readable and maintainable.

What is the best way to enforce consistent abstraction levels across modules?

The best way to enforce consistent abstraction levels across modules is to apply the SLA principle throughout your codebase. Extract low-level logic into helpers to keep function bodies operating at a single, cohesive abstraction level.