regression-tests
Use when fixing a bug, changing behaviour or adding a feature in code that has tests, or when the user asks whether a change is covered by tests, wants regression tests, or wants coverage of the changed lines.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- regression-tests
- description
- Use when fixing a bug, changing behaviour or adding a feature in code that has tests, or when the user asks whether a change is covered by tests, wants regression tests, or wants coverage of the changed lines.
02 资源文件 1
- 其他.codex-harness6 B
03 SKILL.md 正文
Regression tests
Every behaviour change ships with a test that fails without the change and passes with it.
Bug fix
- Write the smallest test that reproduces the bug through the public interface.
- Run it and watch it fail for the reason in the bug report, not for a typo or a missing import.
- Fix the code, not the test.
- Run the test, then the whole suite.
New or changed behaviour
Write the test first, watch it fail, implement, watch it pass. When the change comes from a requirement, tag the test with its ID (see the hld-trace skill).
Follow the repo
Put tests where the repo already keeps them, with its framework, naming and fixtures. Do not add a test framework the repo does not use.
Coverage of the changed lines
diff-cover reads a Cobertura XML report and lists the changed lines no test executes. Install it with pip install diff-cover.
| Stack | Produce coverage.xml |
|---|---|
| Python | coverage run -m pytest, then coverage xml (in PowerShell 5.1, which has no &&: coverage run -m pytest; coverage xml) |
| .NET | DOTNET_CLI_TELEMETRY_OPTOUT=1 dotnet test --collect:"XPlat Code Coverage" writes TestResults/*/coverage.cobertura.xml |
| Node with c8 | npx c8 --reporter=cobertura npm test writes coverage/cobertura-coverage.xml |
| Vitest | npx vitest run --coverage --coverage.reporter=cobertura writes coverage/cobertura-coverage.xml |
| Jest | npx jest --coverage --coverageReporters=cobertura writes coverage/cobertura-coverage.xml |
Windows PowerShell has no NAME=value command form: write the variable first in the same command, for example $env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'; dotnet test --collect:"XPlat Code Coverage".
Then:
diff-cover <report.xml> --compare-branch=origin/main --include-untracked
Pass several reports at once for a multi-stack repo. Every uncovered changed line is either covered by a new test or explained: generated code, logging, a branch that only a real outage reaches.
Is the test good enough
A test that never fails proves nothing. For important logic, run mutation testing on the changed files (the bug-hunt skill): a surviving mutant is a regression the tests would miss.
Report
Name the test that failed before the change and passes after it, the full suite result, and each changed line diff-cover listed with the test that now covers it or the reason it stays uncovered.
04 同仓库更多 Skills
web-consensus
Use when a question has to be settled against the live web rather than from memory - researching a topic, proving or disproving a claim, checking whether something is still true, a sourced second opinion on a factual question - or when the user says "research", "prove it", "with sources", "check if this is true", "still accurate?".
skill-validate
Use when a SKILL.md is about to ship or was just edited, when a skill is reviewed or audited, when a skill seems ignored, skipped or misread by agents, or when the user says "validate this skill", "lint the skill", "check my skill", "is this skill any good".
regression-tests
Use when fixing a bug, changing behaviour or adding a feature in code that has tests, or when the user asks whether a change is covered by tests, wants regression tests, or wants coverage of the changed lines.
redacao
Use when writing, rewriting or editing a technical article or blog post in Portuguese, or when the user says "escreve um artigo", "reescreve o post", "redação", "pauta", "revisa o texto", "tira a cara de IA".
improve
Use when the user asks to improve the harness, its rules, Guardian policy, skills or knowledge from experience on this machine, or says "remember this for next time", "make this a rule", "teach the harness".
hld-trace
Use when the user asks whether the code follows the high-level design (HLD), which requirements have tests, which are untested, or wants tests linked to requirement or work item IDs.