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:

FocusQuestion before analysisHandoff output
Metric definitionCalculation and inclusion rulesVersioned definition with examples
Lineage and freshnessWhere each event comes from and when it is trustworthySource, delay, and gap
Interpretation boundaryWhat the metric can and cannot explainNo unsupported causality
Anti-gaming reviewHow behavior or labels could improve the number without improving qualityRisk and counter-check
Output contractWhether a table, CSV, JSON, or ticket format is requestedPreserve 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.

StateMeaningHow this Skill should handle it
knownDirectly supported by the supplied materialKeep the source, version, and time with the judgment
missingNeeded for this pass but not suppliedName the smallest evidence action and limit the conclusion
conflictingSources disagreeShow both sources and route the conflict to an owner
stalePresent but outside the relevant version or time windowMark freshness; old evidence is not current proof
out_of_scopeRelated but excluded from this passKeep the boundary explicit
assumptionsTemporarily adopted to continue analysisState 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:

LayerHow to write itApplication here
FactWhat the supplied material directly showsCite the source, version, input, or run record for the focus
Evidence-backed InferenceWhat several facts support togetherShow the inference chain and retain uncertainty
RecommendationThe smallest next actionName the evidence, review, execution, or regression path
Human DecisionWhat an accountable person must decideLeave 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.

MaterialWhat to provideWhat to do when it is missing
Decision questionRecalculate the new-defect count and first-attempt pass rateDo not infer a target or release gate
Metric dictionary v1New defects use distinct defect_id; first-attempt pass rate uses the first attempt for each distinct test_idKeep an undefined unit or rule open
Event sampleD1 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 runPreserve entity, state-event, first-attempt, retry, and unexecuted-test distinctions
Missing boundaryThe fixture labels new defects as “this month” but gives no timezone or exact window boundariesUse 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 claimReview result
K-1 reports four new defectsWRONG; the sample contains two distinct defect IDs
K-2 replaces T1’s failed first attempt with its passing retry and reports 100% first-passWRONG; the first-attempt rate is 1/2
K-3 recalculates both metrics from distinct IDs and first attemptsCALCULABLE; the sample results are 2 defects and 1/2 first-attempt pass
K-4 calls unexecuted T3 a passUNKNOWN; 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

FieldExample wording
FindingQMD-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 triggerSanitized 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 concernDuplicate imports can inflate defect counts; replacing a failed first attempt with a retry can inflate first-pass results
Evidence stateknown for the supplied sample calculation; exact production window, timezone, and pipeline completeness are not provided
Impact and priorityMiscounted values could mislead comparisons; priority remains NOT_SCORED because the fixture has no business-impact rubric
Owner and open decisionThe metric owner confirms the production window, timezone, source lineage, and intended decision
Action and close conditionRecord the unit, filters, deduplication, missing-data rule, and inclusion examples; another engineer can reproduce the sample result
ValidationRecalculate against versioned, redacted records and preserve the query and result; keep production use pending until the missing scope and lineage are checked
Stop conditionDo 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 fieldWhy it existsExample status
Metric contractCalculation and inclusion rulesVersioned definition with examples
Lineage and freshnessWhere each event comes from and when it is trustworthySource, delay, and gap
Interpretation boundaryWhat the metric can and cannot explainNo unsupported causality
Anti-gaming reviewHow behavior or labels could improve the number without improving qualityRisk 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:

GapNext ownerQuestion to resolve
Event, numerator, or denominator is undefinedMetric and business ownersConfirm the population, window, and inclusion/exclusion rules
Source, late data, or linkage key is unclearData platform or system ownerSpecify lineage, freshness, and reconciliation
Metric may become a gate or team targetQuality governance and business ownersReview 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

Common traps

  1. Using test count, ticket count, or story points as user exposure without stating the relationship.
  2. Mixing event time, ingestion time, and release time so late data silently rewrites history.
  3. 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

  1. Choose one service, one decision, and one metric.
  2. Attach its event dictionary, source, version, sample records, and the applicable window and timezone.
  3. 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

Quality metrics loop: define the question and metric, review and run accepted AI test cases, recalculate from evidence, then update tests or metric rules

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

More Resources

Share