# Definition of Done
<!--
ref: @any-corp/engineering/definition-of-done
type: protocol
tags: [engineering, dod, ship, complete, done]
triggers: [code merged but not tested, feature in production without documentation, missing regression tests, incomplete observability setup]
trigger_prompt: When a team needs to verify that all necessary steps have been completed before declaring a feature or fix as fully finished.
version: 1
updated_at: 2026-04-30T17:25:41.774Z
-->

A feature isn't done when the code merges. It's done when these are all true.

## The checklist

### Code
- [ ] Code is reviewed and merged to `main`.
- [ ] CI is green on the merge commit.
- [ ] No `TODO` or `FIXME` left in shipped code without a linked issue.
- [ ] No commented-out code shipped.
- [ ] No console.log / print statements left.

### Tests
- [ ] Happy path is tested.
- [ ] Identified failure modes are tested.
- [ ] If a bug was being fixed, there's a regression test that fails before and passes after.
- [ ] Local test run passes.

### Migrations
- [ ] Forward + backward migration both verified locally.
- [ ] Migration is backward-compatible with the previous version of the code (zero-downtime).
- [ ] Backfill (if any) is idempotent and resumable.

### Docs
- [ ] Public-facing docs (customer + internal) reflect the new behavior.
- [ ] The handbook entry it touches (if any) is updated.
- [ ] If it's a new endpoint / feature flag / runtime config: discoverable by future maintainers.

### Observability
- [ ] Logging at the right levels (`@any-corp/engineering/coding-standards`).
- [ ] Metrics for the things we care about (rate, latency, error rate, business metric if applicable).
- [ ] An alert on the failure mode that would page someone at 2am.

### Rollout
- [ ] Behind a flag if user-visible.
- [ ] Rollout plan written: who turns it on, in what order, when.
- [ ] Rollback plan written: how to turn it off if it breaks.
- [ ] Customer comms (if applicable) drafted and reviewed.

### Cleanup
- [ ] Any temporary code (instrumentation, test data, scaffolding) is either kept-with-purpose or removed.
- [ ] Old code that's been replaced is deleted, not left commented or "just in case."
- [ ] Old feature flags that are now permanent are removed (`@any-corp/engineering/coding-standards`).

## "Done done"

Some teams use "done" for "merged" and "done done" for "released and stable." We use **done** for the whole list. If a feature is in production but isn't tested, observed, and documented, it isn't done — and the next person to touch it will have to do the work.

## Common skips and what they cost

| Skip | What it costs |
|---|---|
| Skipped test | Bug ships, you find it from a customer or worse |
| Skipped backward-compat in migration | Production downtime during deploy |
| Skipped logs | The 2am incident takes 4× longer |
| Skipped alert | The 2am incident becomes the next-morning customer email |
| Skipped doc | Three people will ask the author the same question; the fourth will guess wrong |
| Skipped flag | Bad rollout means full rollback instead of quiet flag-off |
| Skipped cleanup | The codebase gets ~5% worse per quarter; nobody notices for a year |

## Done for non-feature work

The list bends for different shapes:

| Work type | "Done" looks like |
|---|---|
| Bug fix | Code merged + regression test + observability didn't get worse |
| Refactor | Code merged + tests pass + same behavior + perf same-or-better |
| Migration | All deployed, all backfilled, both old and new paths verified, old path removed (or with a removal date) |
| Investigation / spike | Written conclusion: what we learned, what we recommend, where the artifacts live |
| Incident response | Postmortem written + action items filed (`@any-corp/engineering/postmortem`) |

## Who certifies done

Author + reviewer. The PR description's "Test plan" + "Risks" is the implicit certification.

For features behind flags, the **feature owner** also confirms — once the flag is at 100%, with metrics looking right for at least a week.

## What we don't do

- We don't move tickets to "done" the moment the PR merges. Done means done.
- We don't skip the checklist for "small" changes. Most production incidents come from "small" changes.
- We don't conflate "shipped" with "good." A feature can be done and still be the wrong feature; that's a different conversation.

---

*Related: `@any-corp/engineering/code-review` · `@any-corp/engineering/git-and-pr` · `@knowledge/frameworks/the-interpretability-tax` · `@knowledge/frameworks/constraints-in-code-not-in-prompt` · `@content/youtube/aie/2026-07-11-stop-ai-agent-hallucinations-5-techniques-production-pattern`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*