Covers designing a team definition of done: quality criteria (tests, review, analysers, security, observability, docs, deployed to production), automating checks in CI and branch policies, keeping it short, tailoring by work type, and evolving it with retros and metrics.
A definition of done is the team's shared quality bar for every piece of work, separate from a story's acceptance criteria. I keep it short (6–10 items) and verifiable, and I make done mean deployed and observable in production, not merged.
dotnet format.The trade-off: every item costs time on every story, so each one must earn its place by preventing real defects or incidents.
"I'd start by being clear on what a definition of done is: the quality bar every increment meets, regardless of the story. Acceptance criteria say what this story does; the DoD says how well everything is done. The design principle is that a good DoD makes the right thing the easy thing. So I keep it short, around six to ten items, every item checkable, and I push as much as possible into automation, so it doesn't add meetings or checklists to every story.
Concretely, the automated part lives in the pipeline and branch policies: the build passes with analysers at warnings-as-errors, unit and integration tests pass, coverage on new code meets a threshold in SonarQube,
dotnet formatreports no changes, there are no vulnerable packages, and the PR has an approving review. The human part is short: acceptance criteria demonstrated to the product owner, a review that looked at design and security, an ADR or runbook update when the change warrants it, and observability: new behaviour has logs, metrics and an alert where it matters. And done means in production, behind a feature flag if needed, with a rollback path. For example, at [company] we [changed done from 'merged' to 'deployed and verified in production'], and [escaped defects fell by about a third over two quarters] because problems surfaced while the developer still had context.To stop it becoming box-ticking, I tailor it by work type: a spike's done is a written finding, not tests; an infra change needs a plan in Bicep or Terraform reviewed. I review it in retros every quarter using DORA metrics and escaped defects, and remove items that don't prevent anything. The mistake I see is a 25-item checklist nobody reads, or a DoD that stops at 'code reviewed', which leaves testing and operations as someone else's problem."
| # | Item | How it's verified |
|---|---|---|
| 1 | Builds with no warnings (analysers as errors) | CI build |
| 2 | Unit and integration tests pass; new code coverage ≥ 80% | CI + SonarQube quality gate |
| 3 | No formatting drift, no vulnerable packages | dotnet format --verify-no-changes, dotnet list package --vulnerable |
| 4 | Reviewed and approved (design, security, tests) | Branch policy: 1 approval, 2 for payments code |
| 5 | Acceptance criteria demonstrated | PO sign-off on the work item |
| 6 | Observable: logs, metrics, alert where it matters | Review checklist item; dashboard link in PR |
| 7 | Docs updated: API spec, runbook, ADR if architectural | Review checklist item |
| 8 | Deployed to production (flag off is OK) with a rollback path | Pipeline release record |
| Check | Automated | Human |
|---|---|---|
| Compiles, tests, coverage | ✔ | |
| Style and analysers | ✔ | |
| Vulnerable or disallowed packages, secrets | ✔ | |
| Design fit, naming, correctness of approach | ✔ | |
| Security and privacy reasoning | Partly (SAST) | ✔ |
| Meets the user need | ✔ |
| Work type | Done also means | Not required |
|---|---|---|
| Feature | Flag strategy, metrics for adoption | |
| Bug fix | A regression test that failed before the fix | |
| Spike | A written finding or ADR | Production-quality code, tests |
| Infrastructure | IaC change reviewed, what-if / plan output attached |
Unit coverage |
A team's DoD ended at 'merged to main'; releases were fortnightly and about one in five caused a hotfix. Moving to a DoD that ended at 'deployed and verified in production', with automated gates for tests, coverage on new code and analysers, cut change-failure rate from roughly 20% to under 10% over two quarters, while deployment frequency went from fortnightly to several times a week.
Checks whether the candidate can design a quality system for a team that balances rigour and flow, using automation and evidence.
Green flags
Red flags
The Scrum Guide defines the Definition of Done as a formal description of the state of the increment when it meets the quality measures required for the product. If a backlog item doesn't meet it, it can't be released or even presented at the sprint review. Acceptance criteria are item-specific; the DoD applies to all items.
Acceptance criteria -> "Customer can request a partial refund"
Definition of done -> tested, reviewed, observable, deployed
Work that is merged but not deployed is inventory: it carries risk and gives no feedback. Ending done at production, often behind a feature flag, shortens feedback loops and surfaces integration problems while the author still has context. This aligns with continuous delivery and DORA metrics (deployment frequency, lead time, change-failure rate, time to restore).
PR opened
|
v
CI: build (warnings as errors) -> tests -> coverage on new code
-> dotnet format -> vulnerable packages -> secret scan
|
v
Branch policy: >= 1 approval, linked work item, all checks green
|
v
Merge -> deploy to test -> smoke tests -> deploy to prod (flag off)
|
v
Verify: dashboard + alert, flag on for cohort, rollback ready
Every automated gate removes a checklist item humans would otherwise forget or skip.
A new DoD applied to old code fails every build. Apply it to new and changed code: SonarQube's new-code period for coverage and issues, analyser warnings baselined and ratcheted down, regression tests required for bug fixes. The legacy area improves as it is touched, which is also where the interest on debt is highest.
Review the DoD in a retro each quarter. Use evidence: escaped defects (what slipped through, and which DoD item would have caught it), change-failure rate, lead time. Add an item when a class of defect repeats; remove one when it never catches anything.
Every item multiplies across every story. A 10-minute manual check on 40 stories a sprint is nearly seven hours. Automate it or justify it.
dotnet list package --vulnerable failing the build).The automated part of the definition of done as a GitHub Actions workflow, so every PR is checked the same way.
# .github/workflows/pr.yml
name: pr-checks
on: pull_request
jobs:
done-gates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- run: dotnet restore
- run: dotnet format --verify-no-changes --no-restore # DoD 3: no style drift
- run: dotnet build --no-restore -c Release -warnaserror # DoD 1: analysers as errors
- run: dotnet test --no-build -c Release --collect:"XPlat Code Coverage" # DoD 2
- name: Fail on vulnerable packages # DoD 3
run: |
dotnet list package --vulnerable --include-transitive | tee vuln.txt
! grep -q -i "has the following vulnerable packages" vuln.txt
The 'observable' item in code: a new feature ships with its metric and a structured log, so done can be verified in production.
namespace Orders.Application.Refunds;
using System.Diagnostics.Metrics;
using Microsoft.Extensions.Logging;
public sealed partial class RefundService(IMeterFactory meters, ILogger<RefundService> logger)
{
private readonly Counter<long> _refunds =
meters.Create("Orders.Refunds").CreateCounter<long>("orders.refunds.requested", unit: "{refund}");
public Task<RefundResult> RequestAsync(RefundRequest request, CancellationToken ct)
{
_refunds.Add(1, new KeyValuePair<string, object?>("reason", request.Reason));
LogRefundRequested(request.OrderId, request.Amount); // no customer PII in logs
// ... business logic
return Task.FromResult(new RefundResult(Guid.NewGuid(), RefundStatus.Pending));
}
[LoggerMessage(Level = LogLevel.Information, Message = "Refund requested for order {OrderId}, amount {Amount}")]
private partial void LogRefundRequested(Guid orderId, decimal amount);
}
public sealed record RefundRequest(Guid OrderId, decimal Amount, string Reason);
public sealed record RefundResult(Guid RefundId, RefundStatus Status);
public enum RefundStatus { Pending, Approved, Rejected }
The DoD is an architectural decision about where quality is enforced. Senior engineers push enforcement left and into automation, so quality is the default path, and keep human attention for judgement: design, security reasoning and whether the user need is met. They also treat the DoD as a living agreement that the team owns, not a policy handed down.
| Option | When it fits | Cost | When not to |
|---|---|---|---|
| CI gate | Objective, tool-checkable item | Pipeline minutes, setup once | Judgement calls |
| Branch policy | Approvals, linked work items | Merge friction | Solo hotfix with an agreed break-glass process |
| Review checklist item | Needs human judgement | Reviewer time | Tool could check it |
| Per-work-type extension | Spikes, infra, bugs | Some complexity | It weakens the core items |
Measure whether it works: change-failure rate, escaped defects per sprint, lead time for changes. If quality improves but lead time doubles, the DoD needs more automation, not more items.
I wouldn't try to fix 5,000 warnings. I'd measure, stop new ones, then pay down by value.
CS8602, CA2000, CA2100), auto-fix the style ones, and switch off the noise in .editorconfig, recorded in an ADR.dotnet format PRs with no behaviour change; risky fixes (nullability, disposal) area by area with tests, boy-scout style.Trade-off: the ratchet is slower than a clean-up sprint, but it never blocks delivery and the count can only go one way.
SonarQube runs in CI: the dotnet-sonarscanner wraps your build (begin → dotnet build → dotnet test → end), collects Roslyn analyser results plus imported coverage, and the server stores issues over time.
A quality gate is a set of pass/fail conditions. The default Sonar way gate looks only at new code: no new issues, every new security hotspot reviewed, at least 80% coverage on new lines, at most 3% duplication. The new code period (previous version, N days or a reference branch) is what makes legacy code adoptable: you don't fix the past, you stop making it worse.
The Community Build only analyses the main branch; pull request decoration needs Developer Edition or above, or SonarQube Cloud.
Trade-off: gates focus attention, but once a number becomes a target people game it (assert-free tests, bulk Won't fix), so keep few conditions and review how issues are resolved.
A good pull request is one a reviewer can understand, verify and approve in one sitting.
The trade-off: splitting work into small PRs costs the author a little planning time, but it saves reviewers far more and gets the change merged sooner.
How to tell it (STAR)
**S:** At [company], our DoD ended at 'merged', we released fortnightly, and about one release in five needed a hotfix. **T:** I wanted to raise quality without making delivery slower. **A:** I pulled release history and categorised escaped defects, then ran a retro where the team rewrote the DoD: eight items, ending at deployed and verified in production. We automated tests, coverage on new code, analysers and package scanning as CI gates, used branch policies for review, and shipped incomplete work behind flags. **R:** Over [two quarters] change-failure rate fell from about [20%] to [under 10%], and we went from fortnightly to [several deployments a week].
Last updated 23 Nov 2026.