functional-separating-pure-core-from-shelllisted
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 | | |
| | +-------------------------------+ | |
| +-------------------------------------+ |
+-------------------------------------------+
``