# Production Readiness Score (PRS)

> How the Python quelltest Production Readiness Score is computed from written tests and per-test confidence, with modifiers, tiers and the confidence factors.

Canonical page: https://quelltest.com/docs/reference/prs

The Production Readiness Score is a 0 to 100 number that says how much of a Python project's edge-case surface is covered by verified tests, weighted by how much each test can be trusted. It is not line coverage: only tests that passed the [five gates](https://quelltest.com/docs/reference/gates.md) earn points. Use it to track progress over time, as a README badge, or in CI with `quell score --json`.

## What is the formula?

```text
PRS = sum(confidence of WRITTEN tests) / (total edge cases x 100) x 100
```

Each WRITTEN test contributes its confidence (0 to 100). SCAFFOLDED and FLAGGED items contribute nothing but still count in the total. The result is clamped to 0 to 100.

Two modifiers apply when source files are provided:

| Modifier | Effect |
| --- | --- |
| Every FLAGGED item is justified with a `# quell: flagged` comment in source | +5 |
| A HIGH-confidence test is disabled with `@pytest.mark.skip`, `@pytest.mark.xfail` or `pytest.skip()` | -10 |

The code also defines a -5 penalty per SCAFFOLDED stub left unfinished for more than 14 days, tracked with git blame.

## What are the tiers?

| Score | Tier | Label |
| --- | --- | --- |
| 80 and above | `green` | Production Ready |
| 60 to 79 | `yellow` | Review Needed |
| below 60 | `red` | Edge Cases Uncovered |

## How is a test's confidence computed?

Confidence has four weighted factors:

| Factor | Weight |
| --- | --- |
| Spec source quality | 35% |
| Violation specificity | 25% |
| Assertion strength | 25% |
| Coverage uniqueness | 15% |

Spec source quality starts from a base score per source: type constraints (Pydantic `Field`) 95, docstring `Raises` 88, guard clauses 80, PySpark schemas 80, survived mutants 70, bug reports 55; an LLM-generated test uses 55. Tiers: HIGH is 85 and above (ship without review), MEDIUM is 60 to 84 (review recommended), LOW is below 60 (review required).

## Why can two commands print different scores?

- At the end of `quell find`, the summary uses a simple calculation: the number of written tests times a default confidence of 80, over the number of gaps. With nothing written that is 0.
- `quell score` reads a cached bucketed `quell-report.json` if present, and otherwise runs a quick scan that counts every gap the rule engine can write a test for as WRITTEN at confidence 80, without running the gates. It can therefore print a higher number than `quell find`.
- `quell ci` does not print the PRS: it prints the fraction of docstring and type requirements that have a covering test, as a percentage. See [quell ci](https://quelltest.com/docs/cli/ci.md).

## How do I improve it?

```bash
quell find src/ --fix    # write verified tests for the gaps it can prove
quell score src/         # see the current score
```

Functions with explicit `Raises:` sections, Pydantic models with `Field` constraints and functions with guard clauses at the top give the most extractable requirements. See [writing docstrings](https://quelltest.com/docs/guides/docstrings.md) and [CI integration](https://quelltest.com/docs/guides/ci-integration.md).

The npm package has its own score, defined as the share of candidates that your tests execute according to coverage data: see the [npm CLI reference](https://quelltest.com/docs/npm/cli.md).
