← ClaudeAtlas

functional-separating-layerslisted

Use when adjacent layers repeat the same abstraction, when a function only forwards, when callers repeat the same lines after it, or when a utility carries a feature's policy.
yutna/functional-design-skills · ★ 0 · AI & Automation · score 75
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 [functional-splitting-and-joining-code](../functional-splitting-and-joining-code/SKILL.md). ## Core rules 1. Default. **Each layer changes the abstraction.** If the layer above and the layer below use the same nouns, delete one of them. 2. Default. **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. Default. **Pull complexity downward.** Given a choice between a slightly harder implementation and a slightly harder interface, make the implement