A4.3 · Anatomy of a spec · dive 1
The six sections
A spec is six named sections in a fixed order — and reading them on a real one turns the order into a template for any rung.
Goal sets the destination, Rationale gives the five Ws, Scope draws the boundary, Deliverables list the artifacts, Invariants name what must always hold, and the Definition of Done closes it as a checklist. Pick a section on the right to read its question and a verbatim phrase, drawn from the spec settled at F6.1 · Bootstrap the Phoenix PortalThe first web rung: stand the F5 engine up as a Phoenix app, with one facade-backed route and a liveness route.View the spec ladder →.
Pick a section · read it on f6.1.md
The six, named
A spec is not free prose. The Portal's real rung spec f6.1.md carries six named
sections, each a heading, each answering a different question. Read in order, they are the whole anatomy: the
Goal states where the rung lands; the Rationale gives the reason in five Ws; the Scope draws an
In/Out boundary; the Deliverables list concrete artifacts;
the Invariants name what must always hold; and the Definition of Done closes the spec as a checklist.
The hero figure walks the six. Below, each is named with a verbatim phrase from the file — nothing is paraphrased, because a spec's exact words are its contract.
- Goal
- Where the rung lands, in prose, verbatim: “After F6.1, the Portal runs as a Phoenix app. A browser request travels through the endpoint's plug stack…”.
- Rationale
- The five Ws — Why “F5 produced a correct engine but no way for a human to reach it over HTTP”; and What, Who, When, Where (the A4.3.2 dive).
- Scope
- The boundary.
In: “the endpoint and its plug stack; the one supervision-tree change; a:browserpipeline…”.Out: “Ecto persistence (→ F6.3) … LiveView (→ F6.6)”. - Deliverables
- F6.1-D1…D7. D6: “a liveness route
get "/health", …returning200(a plain"ok")”. D4: the controller calling onlyPortal.courses_of/1. - Invariants
- F6.1-INV1 (master): “
PortalWebcalls only thePortalfacade and renders only the closed%Portal.Error{}set”. INV4: an expected failure renders as a status from the closed set, never a500. - Definition of Done
- A checkbox list, closing verbatim: “Every deliverable maps to a user story and every invariant is exercised by a check”.
Portal.courses_of/1 returns the courses a user is enrolled in —
the one facade call this rung's controller makes. The spec names the call; it shows none of its code.
The order is the template
The six sections sit in a fixed order, and the order is not decorative. Each section assumes the one above it: the Rationale explains the Goal; the Scope bounds what the Rationale promised; the Deliverables realize what is in Scope; the Invariants constrain the Deliverables; and the Definition of Done closes over all of them. Read top to bottom, a spec moves from where to why to how far to what to what must hold to how we know.
Step the order below. The figure names each position and the role it plays — the move this dive teaches is the sequence, distinct from the hero, which reads a single section's words. A spec written to this order is filling in six known questions, never a blank page.
Step the order · each section assumes the one above
Six sections, one fixed order — where, why, how far, what, what holds, how we know — and each section assumes the one above it.
The six sections on the Portal
On the Portal — the learning platform this course builds — the real artifact is
f6.1.md, the spec for the first rung of the web chapter: stand the headless engine up
as a Phoenix app. Its six headings are the anatomy, byte for byte. The Goal names the destination; the
Rationale gives the five Ws; the Scope's Out defers Ecto and LiveView to later rungs;
the Deliverables list seven artifacts including the /health liveness route; the
Invariants name the master rule; the Definition of Done closes on traceability.
The fragment below is the six headings in order — the document's skeleton, with each heading's question in a comment. It is markdown, not code: a spec's body is prose and lists, and the dives read those words. The skeleton is the part you reuse to write a spec of your own.
# f6.1.md — the six sections, in order (headings verbatim; questions in comment). ## Goal — where does this rung land? "After F6.1, the Portal runs as a Phoenix app." ## Rationale (5W) — why, what, who, when, where? "F5 produced a correct engine but no way for a human to reach it over HTTP." ## Scope — what is in, and what is deferred? "Out: ... Ecto persistence (→ F6.3) ... LiveView (→ F6.6)." ## Deliverables — which concrete artifacts ship? "F6.1-D6 — a liveness route get \"/health\", ... returning 200 (a plain \"ok\")." ## Invariants — what must always hold? "PortalWeb calls only the Portal facade and renders only %Portal.Error{}." ## Definition of Done — how do we know it is done? "Every deliverable maps to a user story and every invariant is exercised by a check."
A spec is six named sections in a fixed order — Goal, Rationale, Scope, Deliverables, Invariants, Definition of Done — each answering one question the one above it sets up.
f6.1.md carries all six headings, byte for byte. Read in order they are a
template — write a spec of your own by filling in the same six questions.
The six sections, read in order on a real spec, stop being a blank page and become a template for any rung.
Recap — six headings, one order
A spec carries six named sections: Goal, Rationale, Scope, Deliverables, Invariants, and Definition of Done.
They sit in a fixed order, each assuming the one above it — where, why, how far, what, what holds, how we
know. Read on the Portal's real f6.1.md, the order is a template you fill in to write
any rung. With the headings in hand, the next dive reads the section that carries the reason: the Rationale's
five Ws.
Next in A4.3: A4.3.2 · The five Ws — the Rationale answers why, what, who, when, and where, fixing a rung's intent before its definition.
References
The specification sources behind the anatomy, and where the six sections connect in the course.
Sources
- Adzic, G. — Specification by Example — a spec written as concrete, named sections that constrain behaviour.
- Humble & Farley — Continuous Delivery — each rung a thin slice with a clear, checkable definition of done.
- Cohn, M. — User Stories Applied — the stories a spec's deliverables are realized by.
Related in this course
- A4.3 · Anatomy of a spec — the module hub.
- A4.3.2 · The five Ws — the Rationale, unpacked.
- A4.3.3 · Constrain, not over-specify — the line every section holds.
- A4 · The spec layer — the chapter landing.
- A3.3 · Anatomy of a roadmap.md — the roadmap that points at this spec.
- A1.04 · Two layers: roadmap and specs — the roadmap/spec separation.
- Companion · Phoenix (F6) — the chapter whose
f6.1.mdis read here.