DoR, DoD, and Quality Gates
Practical Definition of Ready, Definition of Done, and measurable quality gates from PR to production—using Mengty Learns' real CI, labs, and Lighthouse/axe gates.
TL;DR
Definition of Ready (DoR) stops half-baked tickets from entering In Progress. Definition of Done (DoD) stops half-tested code from being called "finished." Enforce repeatable checks as automated quality gates at PR, merge, release, and deploy—like this repo's ci.yml, labs.yml, and quality.yml.
1. Definition of Ready (DoR)
Before a developer or AI agent picks up a task:
- Clear outcome: Problem and non-goals fit in 3–5 lines.
- Acceptance criteria: At least 2 testable Given/When/Then checks (or a concrete spec).
- Dependencies unblocked: Required secrets, APIs, or upstream PRs are available.
- Right-sized: Fits in 1–2 days (if larger, split first).
- (For docs on this site) Official source URL identified (
CONTENT-PLAN.md§1).
2. Definition of Done (DoD)
Before a task moves to Done:
- Code + unit/component tests written and passing.
- Self-reviewed diff; no dead code, debug logs, or hardcoded secrets.
- Local/CI verification green (
pnpm lint && pnpm typecheck && pnpm test && pnpm build). - UI/diagram changes visually checked at
360pxand1280pxin light & dark themes. - Docs/ADRs/cards updated if behavior or architecture changed.
3. Measurable quality gates (worked example: Mengty Learns)
| Stage | Gate | Concrete target in this repo | Where enforced |
|---|---|---|---|
| Pre-commit / PR | Lint, types, unit tests, static build | 0 ESLint errors, 0 TS errors, all vitest suites pass, next build succeeds | Local (AGENTS.md §6) + .github/workflows/ci.yml |
| PR (changed code) | Changed-line coverage & scope | New helpers/parsers have unit tests; PR touches only scoped files | PR review + vitest run |
| PR (labs) | Infrastructure & container linting | hadolint + docker build, tofu fmt/validate + tflint, kubeconform -strict, actionlint | .github/workflows/labs.yml |
Merge to main | Review approval + clean git | ≥ 1 review approval (Lead/Owner), conventional commit, 0 secret leaks | Branch protection / Lead review |
| Release / Quality | Accessibility & performance | 0 serious/critical @axe-core/playwright violations; Lighthouse CI (lhci autorun) ≥ 95 | .github/workflows/quality.yml |
| Production deploy | Live verification | Preview/prod smoke check (200 on key routes, headers present, 0 console errors) | Post-deploy check / RUNBOOK.md |
Minimum viable version (1–3 person team + AI agents)
If you are starting a new repo today, set up just three gates:
- One CI command on every PR:
lint && typecheck && test && build. - Dependency/secret scan (GitHub Dependabot/Renovate + secret scanning).
- 30-second post-deploy smoke check on the live URL.
When it's overkill
- Blocking a 1-person prototype with 40-minute E2E suites before you even have users.
- Turning DoR into a rigid gatekeeper where nobody can fix a broken test without a "grooming meeting." DoR is a guideline, not a weapon.
Gotchas
- Flaky gates train people to ignore CI: If a Lighthouse or Playwright check fails randomly, fix the flakiness immediately or move it to non-blocking until stable—never leave a broken red gate.
- Unenforced DoD: A DoD written in a wiki that isn't checked in CI or PR templates is quickly forgotten under deadline pressure.
- Ignoring changed-line quality: Legacy files might have low test coverage, so gate new/changed lines rather than blocking every PR on historical debt.
Production checklist
-
ci.ymlrunslint,typecheck,test, andbuildon every PR. -
quality.ymlchecks accessibility (axe-core) and performance (lhci) on rendered output. - Workflows declare minimal
permissions: contents: read. - Every team member and AI agent knows the exact DoD command before committing.
Check yourself
Check Yourself
1. Why should a team's Definition of Done (DoD) be backed by automated CI gates wherever possible?
2. Which workflow in Mengty Learns runs Lighthouse CI and @axe-core/playwright against the built out/ directory?
Sources
Related Notes
Architecture Decision Records (ADRs)
Write lightweight Nygard ADRs, understand the proposed/accepted/superseded lifecycle, and review a worked ADR for Next.js static export vs OpenNext on Cloudflare Workers.
Practical Code Review (Including AI-Generated Code)
What to review (correctness, security, tests, readability), PR sizing, Conventional Comments, turnaround targets, self-review, and verifying AI-generated PRs.