← ClaudeAtlas

levels-of-abstractionlisted

Use when discussing levels of abstraction, composed method, SLAP, stepdown rule, or mixed abstraction levels within a function.
juanibiapina/skills · ★ 4 · AI & Automation · score 63
Install: claude install-skill juanibiapina/skills
# Levels of Abstraction Every function should operate at a single level of abstraction. When a function calls high-level helpers *and* does low-level work inline, the reader has to constantly shift mental gears. The fix is always the same: give the low-level block a name. ## Terms **Composed Method** _(Kent Beck, Smalltalk Best Practice Patterns, 1997)_ A public method that reads as an outline of steps. Each step is a call to a private method with a clear name. The public method states *what*; the private methods handle *how*. **Single Level of Abstraction — SLA / SLAP** _(named by Neal Ford, The Productive Programmer, 2008; restated by Robert C. Martin, Clean Code, 2008)_ All statements in a function belong to the same level of abstraction. If one statement is at a lower level, extract it. **Stepdown Rule** _(Robert C. Martin, Clean Code)_ Functions in a file read top-down: each function is followed by the functions one level of abstraction below it, like a newspaper article narrowing from headline to detail. **Mental Grouping** The cognitive work a reader does to assemble missing abstractions — scanning a block of code and figuring out "this chunk does X." A missing method forces the reader to do the extraction in their head. ## Smells - **Helpers plus inline logic** — a function calls named methods for some steps, then has a raw block of code for another. The raw block is the missing method. - **Comment, blank line, code block** — the comment is the name of the met