Skip to content
Testing & QualityChapter 48 / 57Beginner5 min read

Definition of Done

A definition of done checklist that says when work is really finished, covering typecheck, tests, migrations, env, docs, screenshots and review.

On this page

1. What is this practice?

A Definition of Done (DoD) is a short list that is the same for the whole team. Every pull request is checked against it. This way "done" means the same thing to everyone.

2. Why does it matter?

Without a written list, every developer has their own "done". For one person, done means the feature shows up on screen. For another, it means merged with tests. The difference shows up later as bugs, broken deploys and "who did this?".

It worked on my machineWith a definition of done
Typecheck only seen by the editorTypecheck, lint and format green in CI
Success path tested by handTests for success, validation and auth failure
New env variable kept in memoryName and a note in .env.example
Migration ran onceMigration is fine even when run twice
The reviewer runs the screen themselvesScreenshot or recording in the PR
Approved it myselfSomeone else approved it

3. When to follow it

LevelHow importantWhy
Learning projectA short list: typecheck, lint, one test, READMEThe habit of "finished" is built here
Production codeThe full list, as checkboxes in the PR templateEvery missing item can become a production bug
Senior levelAutomate the list in CIWhat a machine can check should not take human time

4. Bad vs good code

Bad: PR description

bash
added the export feature. done, pls review

The reviewer does not know what was tested, what env is needed, or whether there is a migration.

Good: PR description

bash
add csv export for invoices

why: accountants export invoices by hand every month

how tested:
  npm run typecheck, lint and tests pass
  endpoint tests: success, invalid date range (422), invoice of another org (404)
  migration applied twice locally, second run is a no-op
  screenshot of the export button attached

new env: EXPORT_BUCKET (exports fail with 503 without it)
docs: docs/knowledge/exports.md updated

What is the difference?

ThingBadGood
TestsUnknownWhich cases, clearly written
EnvHiddenThe name and what breaks without it
MigrationMaybeIdempotent, ran twice
ReviewThe reviewer has to digEverything in front of them

5. How to apply it

Keep this checklist as checkboxes in the PR template:

#ItemWhy
1Typecheck, lint and format pass locally and in CIBasic bugs and style arguments end
2Success, validation and auth failure tests for every new or changed endpointContract and security are proven
3A unit test for every changed pure function with branchingEdge cases of the logic
4The migration ran twice on a database where it was already appliedNo crash on re-run
5Generated database types regenerated and committedCode and schema match
6New env variable in .env.example, with a noteThe next deploy does not break
7Docs updated if behaviour changedDocs do not lie
8A screenshot or short recording for UI changesThe reviewer sees what was built
9Approval from someone other than the authorA second pair of eyes
The road to done
Code written
Typecheck, lint and tests locally
Check migration, types, env and docs
Fill in the PR template checklist
CI green
Approval from someone else
Done

6. Exceptions and common mistakes

When the rule does not apply: an item that does not apply is skipped, but in writing: "no migration", "no UI change". A spike or prototype that will not be merged does not need the full list. But if that code later goes to main, the list applies from that point.

Mistake: Ticking a checkbox without running it

Why? A checklist only helps when it is true, a false tick gives no safety.

Better: Leave the item you did not check empty and write the reason.

Mistake: Tests only for the happy path

Why? Most bugs and security holes live in failure paths.

Better: Write validation and auth failure tests for every endpoint too.

Mistake: Making docs a separate ticket

Why? That ticket never gets done and the docs go stale.

Better: Update the docs in the same PR that changes the behaviour.

7. What to learn before and after

Final quick revision

CheckYes?
Typecheck, lint, format green
Endpoint tests for all three paths
Migration idempotent
Types regenerated
.env.example updated
Docs updated
Screenshot attached
Someone else's approval