A metric becomes dangerous when its numerator is clear but its denominator is not. A precise-looking dashboard can quietly change what the team counts from one release to the next.
Why this Skill is needed
The Quality Metrics Design Skill creates evidence-bounded metric definitions before a team turns them into targets or gates. It connects a quality question to a calculation rule, data source, freshness expectation, and interpretation limit.
What the Skill does
The metric contract should let another engineer recalculate a measure from the named sources.
Use this Skill to design measures such as escaped-defect rate, test feedback time, flaky-test rate, or requirement rework rate. It makes a metric reviewable and resistant to accidental or intentional gaming while recognizing that no single number represents quality.
A good metric definition states the event, numerator, denominator, time window, source of truth, freshness, segmentation, exclusions, interpretation limits, and supported decisions.
Use it when a team is proposing a new quality KPI, merging signals from several systems, or finding that two dashboards calculate the same label differently.
What it does not do
The Quality Metrics Design Skill can organize material, evidence, and next actions for metric definitions. It does not replace:
- Confirmation of rules, scope, and risk by the accountable domain owner.
- A real environment, account, dataset, log, or run record; static analysis does not become runtime evidence by itself.
- Authorization for release, compliance, production actions, or residual-risk acceptance.
- A Human decision when supplied sources conflict.
What it checks
Review each link in the metric: how an event is identified, how the numerator relates to the denominator, when the data is complete, and which decision the result supports. Start with a matrix based on the source Skill’s output contract:
| Focus | Question before analysis | Handoff output |
|---|---|---|
| Metric definition | Calculation and inclusion rules | Versioned definition with examples |
| Lineage and freshness | Where each event comes from and when it is trustworthy | Source, delay, and gap |
| Interpretation boundary | What the metric can and cannot explain | No unsupported causality |
| Anti-gaming review | How behavior or labels could improve the number without improving quality | Risk and counter-check |
| Output contract | Whether a table, CSV, JSON, or ticket format is requested | Preserve finding fields; confirm the schema, enums, required fields, and evidence sources before machine use |
If a row has only a conventional expectation and no source or validation method, keep it open instead of turning it into a pass.
Audit inputs before you start
Before analysis, classify the material into six evidence states and check its completeness, source credibility, freshness, and comparability. Missing event definitions or sources limit the conclusion.
| State | Meaning | How this Skill should handle it |
|---|---|---|
| known | Directly supported by the supplied material | Keep the source, version, and time with the judgment |
| missing | Needed for this pass but not supplied | Name the smallest evidence action and limit the conclusion |
| conflicting | Sources disagree | Show both sources and route the conflict to an owner |
| stale | Present but outside the relevant version or time window | Mark freshness; old evidence is not current proof |
| out_of_scope | Related but excluded from this pass | Keep the boundary explicit |
| assumptions | Temporarily adopted to continue analysis | State how and when the assumption will be checked |
Keep the input version, scope, environment, evidence locations, and accountable owner together. Without a run record, deliver analysis, design, or a validation plan—not an execution pass.
From problem to structured Finding
Connect the source, scope, evidence state, analysis, owner, action, close condition, and validation before writing the conclusion. The case below keeps this Skill’s identifier and domain context.
Keep the decision layers separate
Keep facts, inferences, recommendations, and Human decisions separate in the metric review:
| Layer | How to write it | Application here |
|---|---|---|
| Fact | What the supplied material directly shows | Cite the source, version, input, or run record for the focus |
| Evidence-backed Inference | What several facts support together | Show the inference chain and retain uncertainty |
| Recommendation | The smallest next action | Name the evidence, review, execution, or regression path |
| Human Decision | What an accountable person must decide | Leave scope, risk acceptance, resources, and release meaning to the owner |
A complete case
This case follows Input, Analysis, Finding, Decision, and Validation. When material is incomplete, keep missing, conflicting, or assumptions visible instead of turning them into a pass.
Input
The source Skill includes a sanitized synthetic fixture for checking event deduplication and first-attempt calculations. These records are a worked example, not a production run.
| Material | What to provide | What to do when it is missing |
|---|---|---|
| Decision question | Recalculate the new-defect count and first-attempt pass rate | Do not infer a target or release gate |
| Metric dictionary v1 | New defects use distinct defect_id; first-attempt pass rate uses the first attempt for each distinct test_id | Keep an undefined unit or rule open |
| Event sample | D1 is created, closed, reopened, and imported twice; D2 is created. T1 fails, then passes on retry; T2 passes on its first attempt; T3 is planned but not run | Preserve entity, state-event, first-attempt, retry, and unexecuted-test distinctions |
| Missing boundary | The fixture labels new defects as “this month” but gives no timezone or exact window boundaries | Use it to demonstrate the calculation, not cross-window comparison |
Use a request like this:
Use the quality-metrics-design Skill.
Task: Recalculate new defects and first-attempt pass rate from the supplied metric dictionary and event sample.
Inputs: [versioned event definitions, defect IDs, test IDs, first attempts, retries, execution status]
Scope: [service, release or time window, environment]
Constraints: [missing timezone, late data, duplicate imports, privacy limits]
Success criteria: [a second engineer can reproduce the calculation]
Exclude: [setting an unapproved target or release gate]
Show the numerator, denominator, calculation, exclusions, evidence state, and interpretation limits. Separate facts, assumptions, recommendations, and Human decisions; do not treat a retry as a first attempt or a planned test as executed.
Analysis
Check the statistical unit and calculation before interpreting the result. The fixture says “this month” but gives no timezone or exact window boundaries, so it supports a worked calculation only; it cannot support cross-window comparison.
Finding
Worked example: Deduplicate defects and keep retries out of first-pass results
For new defects, count distinct IDs in the supplied sample: D1 and D2 make 2 new defects. D1’s close and reopen events, plus its duplicate imports, do not create new defect entities.
For first-attempt pass rate, T1 and T2 are the two tests with recorded first attempts. T2 passed, while T1 failed before a passing retry. The calculation is 1 / 2 = 50%. T1’s retry cannot replace its first result. T3 was planned but never run, so its pass status is unknown, not passed.
| Candidate claim | Review result |
|---|---|
| K-1 reports four new defects | WRONG; the sample contains two distinct defect IDs |
| K-2 replaces T1’s failed first attempt with its passing retry and reports 100% first-pass | WRONG; the first-attempt rate is 1/2 |
| K-3 recalculates both metrics from distinct IDs and first attempts | CALCULABLE; the sample results are 2 defects and 1/2 first-attempt pass |
| K-4 calls unexecuted T3 a pass | UNKNOWN; there is no execution evidence |
The calculations demonstrate how the dictionary controls counting. They do not show that a production event pipeline is complete, that the metrics predict quality, or that a target is fair.
For an escaped-defect measure, “production defects divided by test cases” does not express user exposure unless the relationship between those populations is defined. A release or affected-transaction denominator may be considered, but the metric owner must confirm the population and defect-to-release linkage before using it.
Example finding: hand off a calculation that another engineer can reproduce
| Field | Example wording |
|---|---|
| Finding | QMD-01: dictionary v1 counts distinct defects and each test’s first attempt; the sample supports 2 defects and a 1/2 first-attempt pass rate |
| Source and trigger | Sanitized fixture events D1, D2, T1, T2, and T3; trigger is a report that counts state events as defects, retries as first attempts, or planned work as passed |
| Expected concern | Duplicate imports can inflate defect counts; replacing a failed first attempt with a retry can inflate first-pass results |
| Evidence state | known for the supplied sample calculation; exact production window, timezone, and pipeline completeness are not provided |
| Impact and priority | Miscounted values could mislead comparisons; priority remains NOT_SCORED because the fixture has no business-impact rubric |
| Owner and open decision | The metric owner confirms the production window, timezone, source lineage, and intended decision |
| Action and close condition | Record the unit, filters, deduplication, missing-data rule, and inclusion examples; another engineer can reproduce the sample result |
| Validation | Recalculate against versioned, redacted records and preserve the query and result; keep production use pending until the missing scope and lineage are checked |
| Stop condition | Do not use the metric as a target or gate while the production window, timezone, or source lineage is unresolved; route the decision to the accountable owner |
This finding follows the source Skill’s QMD fields: source, trigger, expected concern, evidence, impact, owner, close condition, and validation.
Decision
The accountable owner confirms the decision question and risk trade-off; the Skill does not make that choice.
Validation
Before closing a production finding, run the stated validation and retain the raw artifact. The worked fixture calculation is not evidence that a production pipeline has been validated.
How a Finding enters the next stage
Handoff output
| Output field | Why it exists | Example status |
|---|---|---|
| Metric contract | Calculation and inclusion rules | Versioned definition with examples |
| Lineage and freshness | Where each event comes from and when it is trustworthy | Source, delay, and gap |
| Interpretation boundary | What the metric can and cannot explain | No unsupported causality |
| Anti-gaming review | How behavior or labels could improve the number without improving quality | Risk and counter-check |
Every conclusion should point to a source, evidence state, and next action. If evidence is missing, use pending, blocked, unassessed, or NOT_SCORED instead of filling the gap with confidence.
Next-stage route
Route each gap to the owner who can resolve it:
| Gap | Next owner | Question to resolve |
|---|---|---|
| Event, numerator, or denominator is undefined | Metric and business owners | Confirm the population, window, and inclusion/exclusion rules |
| Source, late data, or linkage key is unclear | Data platform or system owner | Specify lineage, freshness, and reconciliation |
| Metric may become a gate or team target | Quality governance and business owners | Review interpretation limits, counter-metrics, and the authorized decision |
Include the evidence state and smallest validation action in the handoff. A later conclusion cannot exceed the available evidence.
How to prepare better input
Provide the decision question, event dictionary, source systems, release and time-window rules, sample records, and one include and one exclude example. Without these, the denominator remains underspecified.
A useful handoff includes input versions, scope, time window, evidence index, assumptions, Human decision boundary, and the smallest validation action.
Working with other Skills
- Quality Dashboard Design: https://inaodeng.com/en/qaskills/quality-dashboard-design/ — turns metric contracts into reviewable views.
- Quality Productivity Metrics: https://inaodeng.com/en/qaskills/quality-productivity-metrics/ — separates delivery-flow signals from quality conclusions.
- Quality Gate Design: https://inaodeng.com/en/qaskills/quality-gate-design/ — defines how evidence can support a gate.
Common traps
- Using test count, ticket count, or story points as user exposure without stating the relationship.
- Mixing event time, ingestion time, and release time so late data silently rewrites history.
- Publishing a target before checking whether labels or reporting behavior can game it.
Best practices
- Start with the decision the metric needs to support. Define its statistical unit, numerator, denominator, window and timezone, filters, deduplication, missing-data rule, version, source, and lineage.
- Recalculate sample records, including at least one included and one excluded case. Check denominator coverage, delays, and exclusions; missing records stay unknown rather than becoming zero. Treat a malformed record as a measurement issue until product-quality evidence supports a defect conclusion.
- Compare only matching windows and definitions. Set action thresholds only from an approved source, keep interpretation limits and an anti-gaming counter-check beside the metric, and do not read correlation as cause.
- Stop gate or target use when lineage or denominator coverage is unresolved, and hand off any production or risk decision to its accountable owner.
First use: start with one metric
- Choose one service, one decision, and one metric.
- Attach its event dictionary, source, version, sample records, and the applicable window and timezone.
- Ask the Skill to audit the definition and recalculate the sample. Review facts, inferences, recommendations, and Human decisions separately before setting a target or gate.
Keep the quality loop visible
In daily testing, an AI-generated case remains a candidate until it is reviewed, deduplicated, accepted, and run against a named build. Link its requirement, result, defect, and release evidence where available. Use escapes, retries, late data, and missing links to choose the next investigation; the metric informs that work but does not make the release decision.
Install and invoke
Add this Skill to the current project:
npx skills add https://github.com/naodeng/awesome-qa-skills/tree/main/skills/en --skill quality-metrics-design
Then invoke it by name with the project material:
Use the quality-metrics-design Skill.
Include objective, scope, versions, evidence paths, constraints, and decision boundary.
Audit inputs first, preserve evidence states, and finish with owner, close condition, and validation method.
FAQ
Should every quality metric have a target?
No. Establish definition, lineage, freshness, and interpretation first. A target is a separate Human decision and may be unsafe while the baseline is unstable.
What if sources disagree?
Preserve both calculations, identify the event or scope difference, and mark the metric pending until an owner approves a canonical source or reconciliation.
How should AI-generated test cases appear in a quality metric?
Count them as candidates until they meet the metric’s review, acceptance, and execution rules. Generated-case volume alone does not show coverage, reliable execution, or product quality.
References
Source Skill and execution contract
The complete execution contract lives in the Quality Metrics Design prompt: https://github.com/naodeng/awesome-qa-skills/tree/main/skills/en/testing-types/quality-metrics-design/prompts/quality-metrics-design.md. The worked calculations come from its sanitized synthetic fixture: https://github.com/naodeng/awesome-qa-skills/blob/main/skills/en/testing-types/quality-metrics-design/references/domain-decision-example.md.
The source Skill directory is available at: https://github.com/naodeng/awesome-qa-skills/tree/main/skills/en/testing-types/quality-metrics-design.
Further reading
- Quality Metrics Design details: https://inaodeng.com/en/qaskills/quality-metrics-design/
- Awesome QA Skills on GitHub: https://github.com/naodeng/awesome-qa-skills
More Resources
- Personal website: https://inaodeng.com/en/
- AI-generated test detection project: https://github.com/AI-Native-QA-Lab/ai-test-auditor
- DeepSeek QA Workbench: https://github.com/naodeng/dsh-qa
- More AI testing skills: https://inaodeng.com/en/qaskills/
- More testing wiki: https://inaodeng.com/en/wiki/
- More AI Wiki: https://inaodeng.com/en/AIWiki/