bug-repro-test-first
Start bug work by proving the reported bug with a failing regression test before attempting a fix. Use when the user reports a bug, asks to fix a bug, or describes a regression, failing behavior, or reproduction case with a plausible test surface.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- bug-repro-test-first
- description
- Start bug work by proving the reported bug with a failing regression test before attempting a fix. Use when the user reports a bug, asks to fix a bug, or describes a regression, failing behavior, or reproduction case with a plausible test surface.
02 资源文件 1
03 SKILL.md 正文
Bug Repro Test First
Use this when the user reports a bug or asks for a bug fix.
Source
Read references/tangming2005-test-first-bug-report.md if you need the source note behind this workflow.
Rule
Do not start by fixing the code.
First write or adapt a test that fails for the reported bug. The test is the definition of the bug.
If there is no useful test surface, create the narrowest reproducible check available instead (a script under scripts/, a curl against a local server, an e2e case), then state why a regression test was not practical before fixing production code.
Workflow
-
Reproduce or inspect the failure enough to choose the narrowest useful test. Tests live under
test/mirroringsrc/(test/cli,test/core,test/runtime,test/server,test/connectors) and use Vitest, withvi.stubGlobal("fetch", mockFetch)for HTTP and a temporaryVANA_HOMEfor state. -
Add a failing test that captures the bug, preferably near existing coverage for the same behavior. Assert on the public contract (route status and body shape, exported function result, error code or class), not on log text or private helpers.
-
Run that test and confirm it fails for the expected reason:
pnpm test test/<area>/<file>.test.tsNo build is needed for unit tests. Tests that exercise the built CLI binary or the install lanes do need
pnpm buildfirst. -
Only then change production code.
-
Run the same test and confirm it passes.
-
Run the smallest relevant surrounding test/check slice, then the repo proof before handoff:
pnpm validate
Parallel Fixes
If the user explicitly asks for subagents or the active tool policy permits delegation for this task, spawn fix workers only after the failing test exists. Give each worker the failing test command and a disjoint write scope.
If delegation is not available or not appropriate, fix locally after proving the failing test.
Done
- The bug has a regression test.
- The regression test, or documented fallback check, failed before the fix.
- The same test or check passes after the fix.
- The final report names the test file and exact command run.
04 同仓库更多 Skills
verify-setup-resume
Verify BUI-936 setup/resume identities, funding readiness and overlapping resumes. Use when changing app request, test-credit transport or the request journal. Runs bounded TLA+ checks and offline real-code replays without live funding or paid reads.
verify-server-supervision
Verify the local Personal Server stop and restart boundary. Use when changing the supervisor's backoff, port probing, replacement launch or Stop handling.
verify-paid-read-recovery
Verify interrupted and overlapping CLI paid reads, receipt-file writers and dead-owner recovery. Use when changing src/cli/app/read.ts, src/core/receipts.ts or src/core/receipts-lock.ts. Runs TLA+ models and offline real-code replays without live paid reads.
verify-mainnet-registration
Verify mainnet app registration and Account association recovery. Use for the registration journal, gateway confirmation, retry, or ownership check.
verify-hosted-provisioning
Verify hosted Personal Server resource ownership across create and delete. Use for Connect's server API, provisioning-row updates, or deprovisioning admission.
verify-export-settlement
Verify queued export owner binding and generation settlement. Use for result publication, pending upload receipts, or retry and sync changes.