← ClaudeAtlas

seamslisted

Use when you want to unit-test logic but can't without a database, network, clock, or a pile of mocks — or when a function fetches, computes, branches on policy, and writes all in one breath. Splits the decision (pure logic) from the action (I/O and side effects) along the natural seam, so the logic becomes testable with plain values and no mocks. This is functional-core / imperative-shell at the function level — about testability and purity, not about where files live. The proof is a unit test that needs zero mocks. Use when a small change ripples into unrelated behaviors, or when one function knows too much.
mikestangdevs/craft-skills · ★ 2 · Code & Development · score 75
Install: claude install-skill mikestangdevs/craft-skills
# Seams ## The failure mode this fixes "I can't test this" almost always means "this code has no seams." A seam is a place where you can change behavior without editing the code around it — the joint between *deciding what to do* and *actually doing it*. When decision and action are fused (the function fetches, computes, branches on policy, and writes, all in one breath), every test needs a database, every change risks five behaviors, and the logic you actually care about is impossible to isolate. Agents fuse decision and action constantly, because it's the shortest path to working code. This skill finds the seam and splits along it: pure decisions you can test with plain inputs, thin actions that just carry out the decision. ## When to Use This Skill - You want to write a unit test but the code demands a live dependency - A function mixes I/O (network, disk, db) with branching business logic - A small change ripples into unrelated behaviors - You're about to extract a function and want it to be testable from birth - Policy ("when do we refund?") is buried inside mechanics ("how do we call Stripe?") **Don't use when:** the code is already a thin pure function or a thin I/O shim. Don't add indirection where there's nothing to separate — that's just ceremony. ## Instructions ### 1. Classify every line as DECISION or ACTION Read the target and tag each chunk: - **DECISION** — computes a result from inputs; no side effects. (validation, branching, calculation, choosing w