Skills directory
Architecture5-point gate · Any stack

Business logic is a pure core

Rules live in pure functions; I/O stays at the edges; state machines are explicit.

Use this when

Business rules inside route handlers

Boolean flags standing in for states

Float math touching money

The quality gate

  • Business rules live in pure modules with zero imports of network/DB/framework
  • State is an explicit machine: states and transitions enumerated, illegal states unrepresentable
  • Money is integer minor units + currency; time is UTC with zones only at display
  • Domain edge cases are enumerated in types/tests, not tribal knowledge
  • The core runs and is testable with no server, no browser, no mocks

Prove it: Run the core's tests with networking disabled — all must pass.

Install or copy

Save the download as pure-core-logic/SKILL.md in your agent's supported skills directory, or copy the complete package below. Load it only when its description matches the work.

Portable SKILL.md
---
name: pure-core-logic
description: "Applies “Business logic is a pure core” as a repeatable product-quality gate. Use during architecture work when rules live in pure functions; i/o stays at the edges; state machines are explicit."
---

# Business logic is a pure core

Apply this skill during **Architecture** work. It supports Any stack.

Rules live in pure functions; I/O stays at the edges; state machines are explicit.

## Instructions

Isolate business rules into a pure core: functions and modules that import no network, database, or framework code — I/O lives at the edges and calls in. Model state as an explicit machine: enumerate the states and legal transitions, and make illegal states unrepresentable in the types rather than guarded by scattered ifs. Represent money as integer minor units with a currency, never floats; keep time in UTC and apply timezones only at the display edge. Enumerate domain edge cases (zero, negative, expired, concurrent, duplicate) in types and tests. The proof of a pure core: it runs in a plain test runner with no mocks. If testing a rule requires a server, the rule is in the wrong place.

## Detect the problem

- Business rules inside route handlers
- Boolean flags standing in for states
- Float math touching money

## Hold the gate

Do not declare this phase complete until every item passes:

- [ ] Business rules live in pure modules with zero imports of network/DB/framework
- [ ] State is an explicit machine: states and transitions enumerated, illegal states unrepresentable
- [ ] Money is integer minor units + currency; time is UTC with zones only at display
- [ ] Domain edge cases are enumerated in types/tests, not tribal knowledge
- [ ] The core runs and is testable with no server, no browser, no mocks

## Verify the result

Run the core's tests with networking disabled — all must pass.

More architecture skills

Want this quality gate applied to a real product decision?

Start a First Loop