separating-layerslisted
Install: claude install-skill yutna/functional-design-skills
# Separating Layers
## Overview
In a well-structured system each layer speaks a different language. The
layer above talks about bookings and customers; the layer below talks about
rows and bytes; a layer between talks about neither at once. When two
adjacent layers have the same abstraction, the boundary between them is
not earning anything, and the code is longer for no gain.
The companion rule is direction: when complexity has to live somewhere,
it belongs in the lower layer, absorbed once, rather than in every caller
above.
## When to use
- A function's body is a single call to another function
- A wrapper module exists whose exports mirror what it wraps
- Two layers use the same types and the same vocabulary
- A module returns something every caller must post-process identically
- Deciding where to put a messy detail
Not for: deciding whether two things belong in the same module, which is
[splitting-and-joining-code](../splitting-and-joining-code/SKILL.md).
## Core rules
1. **Each layer changes the abstraction.** If the layer above and the
layer below use the same nouns, delete one of them.
2. **Delete pass-through functions.** A function that takes the same
arguments and calls one function with them adds interface and hides
nothing. Let the caller call directly.
3. **Pull complexity downward.** Given a choice between a slightly harder
implementation and a slightly harder interface, make the
implementation harder. One implementer pays once; every ca