← ClaudeAtlas

functional-separating-pure-core-from-shelllisted

Use when business logic cannot be tested without I/O, when one call deep inside forces every caller to become async, or when deciding where a database or HTTP call belongs.
yutna/functional-design-skills · ★ 0 · AI & Automation · score 75
Install: claude install-skill yutna/functional-design-skills
# Separating Pure Core From Shell ## Overview A functional application has two parts. The **core** is pure: it computes decisions from values, always returning the same output for the same input, touching nothing outside itself. The **shell** is impure: it reads, writes, waits, and talks to the world, and contains no business rules. Every property that makes functional code worth writing comes from this split. A pure core is testable without infrastructure, safe to run concurrently, easy to reason about, and cheap to reuse. The shell stays small, boring, and mostly generated by the shape of the core. ## When to use - Structuring a new service, application, or module - A test needs a database to check a business rule - Deciding where a service call goes inside a workflow - Domain code imports a framework, driver, or transport library - A rule and an effect are tangled in one function Not for: choosing how to supply a specific dependency, which is [functional-parameterizing-dependencies](../functional-parameterizing-dependencies/SKILL.md). ## The layers ```text +-------------------------------------------+ | shell: transport, storage, clock, queues | | +-------------------------------------+ | | | workflows: pipelines of pure steps | | | | +-------------------------------+ | | | | | domain: types and rules | | | | | +-------------------------------+ | | | +-------------------------------------+ | +-------------------------------------------+ ``