---
name: using-checktest
description: Use CheckTest to collect deterministic, evidence-based findings about automated tests when creating, modifying, refactoring, or reviewing tests, or when investigating test-analysis results. Use it as supporting evidence, never as a substitute for test execution or engineering judgment.
---

<!--
MIRROR LOCATION: ~/.agents/skills/using-checktest/SKILL.md
Authored at ~/.config/opencode/skills/using-checktest/SKILL.md.
~/.agents/skills is the mirror. After every edit:
  mkdir -p /Users/victorpetropoulos/.agents/skills/using-checktest
  cp /Users/victorpetropoulos/.config/opencode/skills/using-checktest/SKILL.md \
     /Users/victorpetropoulos/.agents/skills/using-checktest/SKILL.md
-->

# Using CheckTest

Baseline for every command and output shown here: verified live at commit `0387d73` (v1.15.3) on 2026-11-26. Consult `checktest --help`, `checktest doctor --json`, and `checktest explain --rule <id>` for anything that may have changed since. Detailed command inventory and worked scenarios: [command reference](references/command-reference.md) and [examples](references/examples.md).

## What it is

CheckTest is a deterministic, evidence-based analysis tool for evaluating measurable characteristics of individual automated tests.

It examines test source code and supported external evidence, collects observations, and evaluates those observations against explicit rules. An LLM never determines a rule verdict.

It produces structured findings with verdicts, evidence, explanations, and information about analysis completeness.

CheckTest is designed to support human developers and AI coding agents. It can be used to review tests written by people, AI agents, or both.

**CheckTest evaluates evidence. You remain responsible for engineering judgment.**

## What it does not do

CheckTest analyzes one declared test in one `--test` file, statically, without executing it.

It does not establish that a test verifies the correct business requirement, guarantee that a test will catch a production defect, or determine whether a change should be merged.

It is not a universal test-quality score, an automatic test-rewriting tool, or a replacement for test execution, coverage collection, mutation testing, or code review. It is not a merge gate; CI policy that consumes its output is a separate decision above the tool.

## When to use it

Use CheckTest when:

- Creating or modifying automated tests.
- Changing assertions, test structure, fixtures, helpers, setup/teardown, or test data that affect evaluated tests.
- Refactoring existing tests.
- Reviewing a change that includes automated tests, including tests generated by an AI coding agent.
- Investigating CheckTest findings or measurable test-quality concerns.
- Interpreting CheckTest JSON or SARIF output.
- Diagnosing unsupported, incomplete, or indeterminate analysis.
- Modifying CheckTest rules, adapters, evidence models, or reporting.
- Discovering which adapters, rules, and assertion forms are currently supported.

Do not activate the skill merely because the word "test" appears: unrelated production code, documentation, UI components, or infrastructure do not warrant a run. The skill may still be consulted when planning test-related work that does not warrant a full evaluation.

Before invoking, decide: did this task create or modify an evaluated test, change its assertions or structure, change helpers/fixtures/data it depends on, change evidence CheckTest uses, or is a previous report no longer current for the present test and evidence state? If none of these apply, a new run is generally unnecessary. For a change review, analyze all changed automated test files that are applicable. If a file is excluded, state why.

## Validating CheckTest itself

Changing CheckTest's rules, adapters, evidence models, or reporting is not validated by a normal test-level `check`. Run the authoritative repository suites instead:

- Conformance: `tests/conformance/` — `typescript.conformance.test.ts`, `python.conformance.test.ts`, `external-evidence.conformance.test.ts`.
- Regression and goldens: `tests/integration/` — `goldens.test.ts`, `corpus-goldens.test.ts`, `cross-adapter-evidence.test.ts`, `fixtures.test.ts`.
- Adapter contract and registry: `tests/adapters/adapter-contract.test.ts`, `tests/adapters/registry-integration.test.ts`.
- Full gate: `npm test -- --coverage`. Narrow to one suite with `npm test -- <path>`.

`doctor` and `explain` confirm adapter registration, dispatch, and rule meaning; they are capability probes and never substitute for the suites above.

After such a change, rerun the affected conformance and regression coverage and report the original and new outcomes. Suite runs are pass/fail gates; `PASS`, `FAIL`, `INDETERMINATE`, and `N/A` are rule verdicts on individual test evaluations, not suite results.

## Basic workflow

1. Identify the relevant automated test files.
2. Determine whether CheckTest is installed or available in the repository. For local repository execution, `npx --yes tsx src/cli.ts` is the in-repo form; an installed `checktest` binary takes the same arguments. Do not assume the global executable is installed.
3. Consult `checktest --help` if the CLI invocation or options are unclear.
4. Use `checktest doctor --json` when adapter selection or supported capabilities are unclear. `doctor --test <path>` probes dispatch for a single file. Not a habit.
5. Use `checktest explain --rule <id>` when a rule's meaning, applicability, or evidence requirements are unclear.
6. Analyze each applicable file with `checktest check --test <path>`. Scope is exactly one file per `check` — there is no repeatable `--test`, no per-test selection flag, and no repository-wide mode at this baseline. Choose the narrowest scope that satisfies the task; multi-file changes get one check per file (loop pattern in the [command reference](references/command-reference.md)).
   - `--rule <id>` is repeatable: evaluate several rules against one file in one run (deduped, first-occurrence order).
   - `--all-rules` evaluates every ACTIVE registered rule in one run (DRAFT rules stay excluded unless also named via `--rule`).
   - `--provenance <path>` writes a provenance manifest sidecar (input sha256, adapter, decidedBy, rules, external evidence, exit code) for re-derivation. Manifest is metadata, not report output.
7. Supply `--type` only when the test type is known from reliable context (`UNIT`, `COMPONENT`, `INTEGRATION`, `CONTRACT`, `E2E`). Do not infer it from a filename; the default is `UNKNOWN`.
8. When a rule needs external evidence, attach it with `--coverage-report`, `--coverage-map`, `--per-test-run`, `--source-revision`, `--mutation-report`, `--mutation-source-revision`, or `--per-declaration-coverage`, and confirm the declared revision matches the current state. Never reuse stale evidence as current proof. Mutation evidence is file-level only; never claim per-test attribution for it. `--per-declaration-coverage` is opt-in, default off; it has effect only together with `--coverage-report`; Tier 1 numeric per-declaration `line_coverage` applies only under strict preconditions (attestation + declared revision + self-coverage + single declaration); Tier 2/3 availability is UNKNOWN (no numeric value — UNKNOWN ⇒ no value); it is not per-test causality proof.
9. Execute, capture the report (JSON is the default; `--format sarif` emits SARIF 2.1.0; `check` has no `--json` flag), and record the exit code and stderr.
10. Verify completion before interpreting anything: the process ended, the intended adapter ran (`adapter`, `decidedBy`), the report parses, and `analysisStatus`, `evaluationStatus`, and `completeness` are inspected. A failed command, missing report, or partial analysis is not a successful evaluation.
11. Read the individual results and evidence, inspect the source at the reported `location`, and decide independently whether any change is warranted.

## Selecting an adapter

1. Identify the language and framework from the file.
2. Ask `checktest doctor --json` for registered adapters, extensions, frameworks, and assertion forms. Never hardcode an inventory; capabilities change between releases.
3. Confirm the relevant constructs are supported before analyzing.
4. Use the documented adapter id. Pass `--adapter <id>` only to force one; default resolution is flag, then manifest, then extension (ADR-034).
5. Never invent an adapter id or substitute an unrelated adapter for an unsupported construct, and never fabricate normalized evidence. Report unsupported language or framework combinations honestly.

## Interpret results correctly

Rule verdicts:

- `PASS`: available evidence satisfies the rule. Record the rule and evidence; do not claim the test is universally good or that all quality concerns were evaluated.
- `FAIL`: available evidence establishes that the rule's condition is not satisfied. Read the rule (`explain`), the evidence, and the test at the reported location; confirm the evidence supports the finding before deciding anything. A FAIL is a reason to investigate, not an instruction to change code, and its importance in context is your call.
- `INDETERMINATE`: available evidence cannot establish PASS or FAIL. Name the missing or ambiguous evidence, collect more when it would materially change the evaluation, rerun, and if uncertainty remains report it. Never present it as PASS.
- `N/A`: the rule does not apply. Not a failure, not proof of quality, and never force applicability.

Keep rule verdicts separate from analysis status, evaluation status, and completeness. In particular:

- `UNSUPPORTED` is an analysis status, not a rule verdict. Name the unsupported capability; do not claim the affected analysis was completed; consider a supported alternative.
- `INCOMPLETE` describes an analysis or evidence limitation. Name what was not evaluated and why; rerun once the cause is addressed.
- A no-verdict report (`evaluationStatus FAILED`, empty `ruleResults`, exit `2`) is neither PASS nor FAIL. `FAILED` is never a rule `FAIL`.
- Exit code `0` does not mean PASS — a FAIL also exits `0`. Inspect the JSON report.
- Exit codes: `check` — `0` at least one scope reached a verdict, `1` usage error or crash, `2` no verdict. `doctor` — `0` diagnostic success, `1` usage error, `2` unresolvable dispatch. `explain` — `0` printed, `1` unknown or missing `--rule`. Full matrix in the [command reference](references/command-reference.md).
- Do not convert INDETERMINATE, N/A, UNSUPPORTED, or missing results into PASS or FAIL.

## Test type is declared, not inferred — and rule applicability is category-derived

`--type` is caller-declared: CheckTest never infers test type from a filename (`src/adapters/adapter.ts:90-95`). Supply it only when known from reliable context (`UNIT`, `COMPONENT`, `INTEGRATION`, `CONTRACT`, `E2E`); the default is `UNKNOWN`. Do not guess it.

Declared type is a contract input the engine evaluates against each rule's declared `applies_to`, in order (`src/core/evaluation.ts:337-354`):

- Step 1 — `UNKNOWN` test type: applicability itself is undecidable → `INDETERMINATE`, never `N/A`.
- Step 2 — a concrete type outside the rule's `applies_to` → `N/A` (a mismatch between two concrete types). This path is unreachable for registered rules: `registerRule` rejects any declared/derived mismatch after the `validateRule()` structural pass (`src/rules/registry.ts:176-201`), so a registered rule never ships with an `applies_to` its category does not allow.

Category-derived tiers (allowed set computed by a pure `derivedAppliesTo(category)` helper in the registry; `applies_to` stays declared on `RuleMetadata`):

- `integrity` → all five concrete types
- `coverage` → all five concrete types
- `mutation` → `UNIT`, `COMPONENT` only
- unknown/default category → all five concrete types

Shipped reality today: integrity and coverage rules declare all five concrete types (CT-INT-001 `src/rules/ct-int-001.ts:59`, CT-INT-003 `:35`, CT-INT-004 `:43`, CT-COV-001 `src/rules/ct-cov-001.ts:21`); CT-MUT-001 declares `UNIT` + `COMPONENT` only (`src/rules/ct-mut-001.ts:37`), so an INTEGRATION/CONTRACT/E2E invocation of CT-MUT-001 evaluates N/A while UNIT/COMPONENT evaluate normally.

CT-DEMO-001 stays the unregistered UNIT-only N/A witness (`src/rules/ct-demo-001.ts:1-31`, applies_to `:22`); it is referenced only as an unregistered N/A witness in tests (resolved directly at `tests/integration/fixtures.test.ts:262-264`; registerRule rejects it — proof: `tests/rules/gate-repro-ct-demo.test.ts` + `tests/rules/rule-contract.test.ts:548`) and must never appear in `tests/fixtures` as a registered rule — `registerRule` rejects `CT_DEMO_001` as derived-mismatch (`src/rules/registry.ts:176-201`).

## Investigating a finding

Before recommending any action: read the rule description and its intended measurement; inspect the evidence values and their `availability`, `provenance`, and `evidenceStrength`; read the test at the reported location and understand its purpose; check that the evidence is attributed to the right test; and note any limitation that changes interpretation.

Distinguish which situation you are looking at: a legitimate finding, a false positive, a rule-applicability problem, an adapter defect, an evidence-collection or evidence-attribution defect, an incomplete analysis, an unsupported construct, or a product defect. If you cannot tell, report the uncertainty instead of inventing a conclusion.

## Remediating a confirmed finding

Only after the finding is confirmed: decide whether a change is warranted; make the smallest change that preserves what the test is meant to establish; never weaken an assertion or delete coverage merely to clear a FAIL; rerun the affected tests, then CheckTest; compare the new result with the original and report the outcome. A PASS obtained by weakening a test is not an improvement.

## Dispositions stay separate from verdicts

CheckTest verdicts and workflow decisions are different records. Dispositions: `FIXED`, `ACCEPTED`, `NOT_A_DEFECT`, `NEEDS_EVIDENCE`, `DEFERRED`, `NOT_APPLICABLE`.

Example: a rule returns FAIL, investigation confirms the condition exists, and the team decides it is intentional. The record is: verdict `FAIL`, disposition `ACCEPTED`, and the reason. The original verdict is never rewritten as PASS.

## When to rerun

Rerun when a relevant test, assertion, structure, helper, fixture, setup/teardown, test data, or required evidence changes; when coverage or mutation evidence is regenerated; when a prior INCOMPLETE cause has been fixed; or when the existing report is stale relative to the current test state. Do not rerun for unrelated production-code changes, unchanged evidence, or a still-valid report. When unsure, verify freshness rather than assume.

## Reporting

When CheckTest findings are relevant, report: whether CheckTest was run and why or why not; the evaluation scope; the adapter and framework; the evidence sources and their revisions; counts by verdict; unsupported capabilities and incomplete analysis; key diagnostics; the findings that need attention; dispositions; whether remediation or a rerun happened; and where the authoritative report lives. Reuse the report's own fields; do not invent a second reporting schema. A template is in the [command reference](references/command-reference.md).

CheckTest is advisory evidence. The final engineering decision remains yours.

When a run is worth preserving for later audit, pass `--provenance <path>` to write a
sidecar manifest recording the input file (sha256 + size), adapter, decidedBy,
rules, external evidence paths + hashes, CheckTest version, and exit code. To
reproduce a run: keep the input file and any external evidence reports, re-run the
command recorded in the manifest's `command` field. Outputs are byte-identical
when inputs, flags, and CheckTest version match. Outputs are terminal — CheckTest
does not accept its own reports as inputs.
