Skip to content
Lesson 35

Architecture decision records

The code shows what you built; it never says why. Learn the one-page record that keeps the reason, the options you rejected and when to think again, and why you never rewrite it.

The lesson in text

Click a paragraph to hear it.

01Why is this here?

Monday, 10:30. Theo joined StayHub two weeks ago. He opens a pull request: delete the outbox table. To him, it looks like complexity nobody uses.

Omar replies within a minute. That table is why we stopped losing bookings. In the spring, nine bookings vanished, and two hotels resold rooms that were already taken. Theo answers: how was I supposed to know? I searched the docs.

There was nothing to find. This quarter, the team made six big architecture decisions, and none of them was written down. Three engineers spent two hours in the chat, digging through old threads to explain one table.

In this lesson, you'll learn the cheapest fix in software architecture: a one-page note called an architecture decision record, or ADR. What goes in it, when to write one, and how it stops your team, and your AI coder, from undoing good decisions.

02The ship's logbook

Think of a ship's logbook. Every day, the captain writes down what happened, and why. Changed course to the south, because a storm is coming from the west.

When the weather changes, she doesn't rub out yesterday's entry. She writes a new one: back on the old course, the storm has passed. The old entry stays exactly as it was.

So a new captain can open the book and follow every turn, and the reason for each one. Nobody has to guess why the ship went south in March.

That's what an ADR is: one entry in your project's logbook. The code shows what you built. The record keeps why, what you rejected, and what would change your mind.

The ship's logbook, and your repository
On the shipIn your project
The logbookdocs/adr/: one numbered, dated file per decision
One entry: "south, because of the storm"One ADR: the decision and its reason
Never rub out yesterday's entryNever edit an accepted ADR's decision
A new entry: "back on course, storm passed"A new ADR that supersedes the old one
The next captain follows every turnThe next engineer, or agent, reads why
The code shows what you built. The record keeps why, what you rejected, and what would change your mind.

03What goes in one

An ADR is short: one page, sometimes two. It lives in the code repository, next to the code, in a folder like docs/adr. Each one gets a number and a date.

It starts with the context: the situation, with numbers. For the outbox: checkout took 2.8 seconds, about fifty bookings failed a day, and nine booking events were lost. Numbers freeze what you believed, so a reader next year can check whether it's still true.

Then the decision drivers: the few things that matter most. Here: never lose a booking event, add nothing new to run, and keep checkout fast.

Then the options: at least two, and real ones. Publish the event right after saving the booking. An outbox table with a small relay. Or a managed Kafka cluster. Each with honest pros and cons, the way a sensible colleague would argue for it.

Then the decision, and its consequences, good and bad. The outbox means no lost events. But every reader of those events must handle duplicates. The bad part matters most: it's what stops the next person from deleting it.

One ADR, section by section: ADR-0004
# 0004 · Booking events go through an outboxnumber and title
Status: Accepted · dateProposed → Accepted → (later) Superseded
## Contextcheckout p95 2.8 s, ~50 failed bookings a day, 9 events lost
## Decision driversnever lose a booking event; nothing new to run; fast checkout
## Optionspublish right after saving · outbox + relay · managed Kafka
## Decisionoutbox table in PostgreSQL, relay to our workers
## Consequences+ no lost events, p95 ~0.5 s · − every reader must handle duplicates
## Revisit ifa separate service reads booking events, or we pass 6 readers
One page. The bad consequences matter most: they're what stops the next person from deleting the outbox as unused complexity.

Last, a revisit trigger: when should we think again? Not "if needs change". Something you can check: if a separate service starts reading booking events, or if we pass six readers.

04Never rewrite the log

Every ADR has a status. It starts as proposed, and the team reviews it like code, in a pull request. People challenge the numbers and add options before anything is built.

Once the team agrees, it becomes accepted, with a date. From then on, nobody edits the decision. Not even when it's clearly out of date.

When a revisit trigger fires, you write a new ADR that says: this replaces number four. The old one changes in one place only: its status becomes superseded, with a link to the new one. Exactly like the logbook.

The life of an ADR
  1. 1
    Proposed
    Reviewed like code, in a pull request: challenge the numbers, add options
  2. 2
    Accepted
    Dated. From now on, the decision is never edited
  3. 3
    Superseded
    A revisit trigger fired: a new ADR replaces it; only the old status line changes, with a link
The value is the trail: what we believed, with which numbers, on which date. Rewriting an old record hides why things changed.

Why so strict? Because the value is the trail. What did we believe, with which numbers, on which date? Rewrite it, and you hide why things changed.

05When to write one

Not every choice needs one. Picking a library to format dates doesn't. Hundreds of tiny records bury the important ones.

Write one when a decision is expensive to undo, when it crosses teams, or when someone will question it later. The outbox, the payment port, the photo function: all three. A choice that looks strange but is deliberate is the best candidate of all.

Does this deserve an ADR?
DecisionADR?Why
Booking events through an outboxYesLooks like unused complexity; removing it loses bookings
PaymentPort with Stripe and Adyen adaptersYesCrosses teams; shapes every payment change
Photo function capped at 50 instancesYesThe number looks arbitrary; it protects the database
Which library formats datesNoCheap to change; nobody will ask why
Write one when a decision is expensive to undo, crosses teams, or will be questioned. A choice that looks strange but is deliberate is the best candidate. Each takes 30 to 60 minutes.

Each one takes thirty minutes to an hour. The outbox record alone would have saved two hours of digging, in a single morning.

By the end of that week, StayHub's log had seven entries. Number one: we record decisions. Then the modular monolith, the module boundaries, the outbox, the payment port, the photo function, and ports only where the rules are rich. Seven pages for a whole quarter of architecture.

StayHub's decision log after one quarter
0001Record architecture decisions
0002A modular monolith with a worker mode
0003Module boundaries, checked in CI
0004Booking events go through an outbox
0005A PaymentPort with Stripe and Adyen adapters
0006Photo resizing on functions, capped at 50
0007Ports only where the rules are rich
Seven pages for a whole quarter of architecture, each linked from the code it explains.

06The arbitrary number

Here's what happens without them. Remember the photo function, and its cap of fifty instances at once? A few weeks later, an engineer found that setting while trying to make thumbnails faster.

Fifty looked like an arbitrary number, and nothing in the repository explained it. So the cap was removed, with a sensible note: no reason to limit this. The reviewer didn't know the reason either, and approved.

The next Sunday evening, about 350 instances started. Each one wanted a database connection. The shared spaces ran out again, and bookings failed for six minutes.

The arbitrary number
  1. 1
    The cap of 50 looks arbitrary
    Nothing in the repository explains it
  2. 2
    It's removed: "no reason to limit this"
    The reviewer doesn't know the reason either
  3. 3
    Sunday evening: ~350 instances
    Each one wants a database connection
  4. 4
    Connections run out: bookings fail for 6 minutes
    The same failure the cap was there to prevent
  5. 5
    Fix: ADR-0006 + a comment next to the setting
    # see docs/adr/0006
Nobody was careless. The reason lived in people's heads and an old chat thread.

Nobody was careless. The reason lived in a few people's heads, and in an old chat thread. That's the real risk: not bad decisions, but good ones undone by people who couldn't see why.

The fix took half an hour: ADR number six, photo resizing on functions, with the cap and its reason. And one comment right next to the setting: see docs/adr, number six.

07Your AI coder reads them too

This matters even more with AI coders. Ask Claude Code to clean up unused code, and it may propose exactly what Theo did: nothing in the booking path reads the outbox, so let's remove it.

The reason exists, in ADR number four. But nothing told the agent to look. So add one line to your project's CLAUDE.md: before changing anything an ADR covers, read docs/adr.

Claude Code can also draft the records for you, from your notes. Give it the facts, and ask it to mark anything it isn't sure of as a to-do. Then check that it didn't invent a single number.

ADRs and Claude Code
One line in CLAUDE.md
Before changing anything an ADR covers, read docs/adr/.so the agent finds the reason
When Claude Code drafts an ADR, checkRed flag
Every number comes from your notesA figure you never gave it ("cut latency by 43%")
At least two real optionsOne good option and two silly ones
Honest consequencesOnly benefits
A revisit trigger you can check"If needs change"
A new ADR when a decision changesAn accepted ADR rewritten to match new code
Records protect decisions only if people and agents can find them. The agent drafts; you decide, and you check every number.

08Your job as lead

The decision itself stays yours. The agent is good at writing the page, but it can't know what your team believed, or which risk you're willing to take. You choose the option, and you own its downsides.

When you review an ADR, check four things. Real options, not one good one and two silly ones. Honest consequences, including what gets harder. A revisit trigger you can check. And a link from the code to the record.

And when a decision changes, ask for a new ADR that supersedes the old one. Never an edit.

Let's recap. The code shows what. The ADR keeps why: the context with numbers, the drivers, real options, the decision and its costs, and when to think again. Never rewrite the log; add a new entry. That's the end of this module. Next, we design whole systems, step by step.

Check yourself

0/10 answered
  1. 1What is an architecture decision record (ADR)?

  2. 2Theo's pull request deletes the outbox as "unused complexity", and three engineers spend two hours in chat explaining it. What would have prevented this?

  3. 3An accepted ADR is now clearly out of date. What do you do?

  4. 4Which of these deserves an ADR?

  5. 5Which is a good revisit trigger for the outbox ADR?

  6. 6Claude Code drafts an ADR from your notes, and it says the outbox "cut latency by 43%". You never gave it that number. What do you do?

  7. 7You ask Claude Code to clean up unused code. Its plan: "remove the outbox table, nothing in the booking path reads it". ADR-0004 exists, but CLAUDE.md doesn't mention ADRs. What do you do?

  8. 8Why does an ADR list the bad consequences of the chosen option?

  9. 9Bookings failed for 6 minutes after someone removed the photo function's cap of 50. What was the real cause?

  10. 10Why should an ADR's context contain numbers, like "checkout took 2.8 seconds"?

Free account

Save your progress — create a free account

Free. No card. Your finished lessons follow you to any device, and you can ask questions in the community.

Create my free account
Founding members

Every lesson is free while we build. Lock in €9/month for later.

The first 100 members keep the founding price for as long as they stay. Reserving is free: no card, nothing is charged.

See the founding offer

Questions from the community

All questions →