Read-only report of the five DORA delivery metrics (deployment frequency, change lead time, change fail rate, failed deployment recovery time, rework rate) as a team trend from default-branch history, with opt-in PR open-to-merged cycle time and candidate-handoff/v1 output, never per person. Use when: 'measure delivery', 'DORA metrics', 'PR cycle time', 'how fast do we ship'. Not for backlog counts: /work-items:track stats.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Measure Delivery?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/melodic-software-measure-delivery)
---
description: "Read-only report of the five DORA delivery metrics (deployment frequency, change lead time, change fail rate, failed deployment recovery time, rework rate) as a team trend from default-branch history, with opt-in PR open-to-merged cycle time and candidate-handoff/v1 output, never per person. Use when: 'measure delivery', 'DORA metrics', 'PR cycle time', 'how fast do we ship'. Not for backlog counts: /work-items:track stats."
argument-hint: "[--repo <dir>] [--since <d>] [--until <d>] [--pr-cycle-time] [--merge-risk] [--unattended] [--json]"
user-invocable: true
disable-model-invocation: false
metadata:
workflow-stage: anytime
summary: Report the five DORA delivery metrics as a team trend from default-branch history
---
# Measure delivery
## Variables
Arguments: `$ARGUMENTS`, the window, period, and mode flags below, passed through to the scripts.
- `--repo <dir>`: repository root (default: current repository root).
- `--since <YYYY-MM-DD>`: first UTC day of the window (default: the 84 days ending with `--until`).
- `--until <YYYY-MM-DD>`: last UTC day, inclusive (default: now).
- `--bucket week|month`: trend period (default `week`, ISO weeks starting Monday).
- `--branch <ref>`: the default branch (default: the ref `origin/HEAD` names).
- `--pr-cycle-time`: add the opt-in PR open-to-merged (and ready-to-merge) median/p90 cycle-time section below; not passed to `delivery-metrics.sh`.
- `--merge-risk`: add the merge-risk failures section below; not passed to `delivery-metrics.sh`.
- `--unattended`: strictly read-only with no prompts; missing prerequisites, missing forge access, or rate limits emit `gaps[]` entries.
- `--json`: emit a `candidate-handoff/v1` envelope to stdout (alias: `--handoff-json`).
## Purpose
Show how the team delivers over time: one row per period and a window total, for the five
delivery metrics DORA defines, plus optional PR open-to-merged cycle-time trends. This skill
reports one repository's trend against its own past, never a comparison between teams. It reads
history and writes nothing.
- **Pointer**: when a metric's definition is in question, fetch
<https://dora.dev/guides/dora-metrics/> live and read its "Throughput and instability"
section, which defines the five metrics.
## Metrics
Each row names a DORA metric and this skill's own measure of it; the metric's definition stays at
the pointer above.
| Metric | Measured here as |
|---|---|
| Deployment frequency | Deployments per period, and per week over the window |
| Change lead time | Median hours from the earliest author date among a deployment's commits to its landing (paired with `squash_same_timestamp_share` when squash landings collapse `at == ct`) |
| Change fail rate | Failed deployments / deployments |
| Failed deployment recovery time | Median hours from a failed deployment to the first deployment that reverts it |
| Deployment rework rate | Deployments that revert an earlier change / deployments |
## Deploy signal
What counts as a deployment is the team setting `delivery_deploy_signal` in the repository's
`<convention-home>/work-items.yaml` (schema: `${CLAUDE_PLUGIN_ROOT}/schemas/work-items.schema.json`),
where `<convention-home>` is resolved via `${CLAUDE_PLUGIN_ROOT}/lib/resolve-convention-home.sh`
(default `docs/conventions` when the repository binds no home). Its one value, and the default, is
`merge-to-default-branch`:
- Each commit on the default branch's first-parent history is one deployment, at its committer
date. A merge commit or a squash landing is one deployment; a rebase landing puts each of its
commits on that history, so each one counts as its own deployment.
- A deployment a later first-parent commit reverts is a failed deployment. A revert subject is
`Revert "<subject>"` or, in Conventional Commits form, `revert:` or `revert(<scope>):`. A
commit reverts a deployment by the first of these that names one:
1. a `This reverts commit <sha>` line in its message, naming the deployment or a commit it
merged, on any commit;
2. with a revert subject, a pull request reference: `Reverts #<n>` or
`Reverts <owner>/<repo>#<n>` in the body, or a `(#<n>` group in the subject other than its
own trailing `(#<n>)`, matched to the deployment whose subject ends in `(#<n>)`;
3. with a revert subject, a quoted subject (`Revert "<s>"`, or `"<s>"` inside a
`revert(<scope>):` subject), or the text after the `revert(<scope>):` prefix, matched to an earlier
deployment's subject with or without its trailing `(#<n>)`.
A revert subject that names no deployment by any of these is an unresolved revert: it counts as
a rework deployment and in `unresolved_reverts`, and marks nothing as failed. A merge counts the
messages of the commits it merges, so a revert that lands through a merge commit is seen by
forms 1 and 3. A `This reverts commit` line counts only when it names a commit already on the
default branch, so a squash body listing a revert of a commit that only existed on its branch is
not a revert. A revert landing after `--until` still marks a deployment in the window as failed,
and a target that landed before `--since` still resolves.
The default signal reads only git history, so no tracker or forge call is made and any host works.
Only `--pr-cycle-time` and `--merge-risk` read the forge.
## Workflow
1. Resolve the repository's convention home and deploy signal from the repository root:
```bash
HOME_DIR="$(bash "${CLAUDE_PLUGIN_ROOT}/lib/resolve-convention-home.sh" --root "<repo root>" 2>/dev/null || echo docs/conventions)"
bash "${CLAUDE_PLUGIN_ROOT}/skills/triage/scripts/parse-concern-value.sh" \
"$HOME_DIR/work-items.yaml" delivery_deploy_signal
```
Empty output means the key is unset: use the default, `merge-to-default-branch`. Report
whether the value came from the file or the default. A value other than
`merge-to-default-branch` stops the run: name the value and the one the schema allows.
2. Run the report. With no `--branch`, the script reads the ref `origin/HEAD` names, as of the
last fetch. Run `git fetch` first only when the user asks for the remote's latest history;
otherwise say the report covers history up to the last fetch.
```bash
bash "${CLAUDE_PLUGIN_ROOT}/skills/measure-delivery/scripts/delivery-metrics.sh" \
--repo "<repo root>" --deploy-signal "<signal>" <the flags from $ARGUMENTS>
```
Exit `2` is a bad flag or a branch that does not resolve: show the script's stderr line,
and when `origin/HEAD` is unset, ask for `--branch` (except under `--unattended --json`, where
the script exits `0` with a `gap` envelope). Exit `3` is a failed git read and exit `8` a
missing `git` or `jq`: report it and stop.
3. Render the JSON as one markdown table, a row per `trend` period then a `Window` row from
`totals`, a column per metric. Show a null value as `n/a` (nothing to measure, such as a
period with no deployments), and show rates as percentages. Mark the first or last period
as partial when the window starts or ends inside it. Add an `Unresolved reverts` column from
`unresolved_reverts`; when it is above 0, say that the change fail rate leaves those reverts'
targets out. When `lead_time_caveat` is non-null (half or more of deployments have identical
author and committer timestamps, `squash_same_timestamp_share >= 0.5`), report the share and
note that git lead time reads artificially low; suggest `--pr-cycle-time` for PR open-to-merged
cycle time.
4. Add two or three lines that read the trend: which metrics moved between the first and last
full periods with deployments, and in which direction. Describe the team's delivery only.
Done when the table and the trend lines are shown, with the window, branch and deploy signal
they cover.
## PR cycle time (`--pr-cycle-time`)
With `--pr-cycle-time` in `$ARGUMENTS`, also report weekly or monthly **median and p90 PR
open-to-merged hours** (`createdAt -> mergedAt`), plus **ready-to-merge median and p90 hours**
(`ReadyForReviewEvent -> mergedAt`) when timeline events are read within budget, paired with
revert PR counts and rates. Every forge read routes through `${CLAUDE_PLUGIN_ROOT}/lib/gh-run.mjs`
with a bounded call budget and adaptive date-slice splitting so high-volume periods never silently
truncate at the search result cap. Run after step 2 with the same window and bucket flags:
```bash
node "${CLAUDE_PLUGIN_ROOT}/skills/measure-delivery/scripts/pr-cycle-time.mjs" \
--repo "<repo root>" --format md <--since, --until, --bucket, optional --snapshot and --unattended from $ARGUMENTS>
```
Show its output as it prints it. A `PARTIAL` line means part of the window went unread or timeline
reads were skipped to stay within budget: state that caveat beside the table. Exit `3` is a rate
limit: report it and stop with no retry (under `--unattended`, it writes a gap notice or `gaps[]`
entry and exits `0`). It writes nothing to the forge and emits no per-person data.
## Merge-risk failures (`--merge-risk`)
With `--merge-risk` in `$ARGUMENTS`, also report whether merges rated `demote=true` by
`/review:merge-risk` (if enabled) fail more often than those rated `demote=false`. It runs only where
`<convention-home>/work-items.yaml` binds `tracker.provider: "github"` and the repository's merge
lane records the rating (the `merge-risk-line` marker comment in `<convention-home>/pr-pipeline.yaml`,
resolved automatically from the repository's convention home); elsewhere, say the section does not
apply. Run it after step 2, with the same window flags:
```bash
node "${CLAUDE_PLUGIN_ROOT}/skills/measure-delivery/scripts/merge-risk-failures.mjs" \
--repo "<repo root>" --format md <--since, --until and --branch from $ARGUMENTS>
```
Show its output as it prints it. It counts, per `demote` group, the rated merges and those later
met by a post-merge demotion record, a silent-revert canary record, or a revert on the default
branch (the forms in "Deploy signal"), plus a per-lane breakdown where the rating names the lane
run that opened the pull request. Date slices split adaptively when approaching the search cap so
busy windows never silently truncate. A record that names a range of merges counts in `*_in_range`
and in no rate. Where either group has too few failures, it prints "not enough failures to
compare" in place of a rate: report that line, never a rate of your own. A `PARTIAL:` line means
part of the window went unread: say so beside the table. Exit `3` is a rate limit: report it and
stop, with no retry. It writes nothing to the forge.
## Unattended and candidate handoff (`--unattended`, `--json`)
Both `delivery-metrics.sh` and `pr-cycle-time.mjs` accept `--repo <dir>`, `--json` (alias
`--handoff-json`), and `--unattended` for ranking consumers:
- **Strictly read-only, zero prompts:** `--unattended` never prompts, retries rate limits, or
writes repository state.
- **`candidate-handoff/v1` envelope:** `--json` prints one `candidate-handoff/v1` JSON object to
stdout (`schema_version`, `producer`, `repo`, `status`, `elapsed_ms`, `candidates[]`, `gaps[]`)
and exits `0` for `ok`, `partial`, and `gap` (usage errors exit `2` with no envelope).
- **Rung 2 candidates with counter-metrics:** degrading delivery or PR-cycle-time trends emit
deterministic Rung 2 candidates (`human_gated: true`, `locations: [{"path": "."}]`) paired with
change-fail/rework/revert counter-metrics in both `evidence` and `metrics`.
- **Fail-open gaps:** missing forge access, rate limits, call-budget exhaustion, shallow clones,
collapsed squash timestamps, or search-cap truncation at minimum granularity become `gaps[]`
entries rather than silent omissions.
## Next
`/work-items:track stats` for the open backlog behind the trend.
## Gotchas
- **Never name a person.** The scripts emit counts, medians, p90s, and ratios only. Do not add
authors, committers, reviewers, or a per-person breakdown, even when asked: DORA and PR cycle
time metrics describe a team's delivery, and per-person delivery numbers are a different report.
- **Squash and rebase landings can shorten git lead time.** Lead time starts at the earliest author
date git keeps for the change. Squash landings often set `author_date == committer_date`,
producing a median git lead time near `0`; check `squash_same_timestamp_share` and use
`--pr-cycle-time` for PR open-to-merged cycle time.
- **A rebase landing counts each of its commits as a deployment.** A team that rebase-merges
sees deployment frequency raised by its changes' commit counts, and a reverted change marks
only the commits its revert names as failed, so the change fail rate reads low.
- **A revert under another subject goes uncounted.** A hand-written undo with neither a
`This reverts commit` line nor a revert subject is invisible to the signal. A revert subject
that names its target only in prose (`#<n>: the cut this reverts`) is counted as unresolved.
- **Per-item stage times are out of scope.** Time an item spent in each tracker stage is a
separate report, not one of these metrics.