qe-harden
Runs the qestack quality loop after implementation: seeds hidden faults, runs the gates, gets an independent judge review, and scores and improves the tests until the bar is met. Use in a qestack repository after the feature is implemented.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- qe-harden
- license
- Apache-2.0
- description
- Runs the qestack quality loop after implementation: seeds hidden faults, runs the gates, gets an independent judge review, and scores and improves the tests until the bar is met. Use in a qestack repository after the feature is implemented.
- argument-hint
- [feature, for example 003-order-discount]
- compatibility
- Needs the qestack engine (Python 3.11+), git and a shell. Full guard only in Claude Code.
03 SKILL.md 正文
qe-harden
Output: specs/<feature>/quality-report.md with the decision ACCEPT or ESCALATE.
0. Prepare
- Preflight. Do the preflight of the
qestackskill. The feature is$ARGUMENTS. If it is empty, find it as the preflight says. - Run
qestack context --feature <feature>. Noteloop.max_iterationsandfeature_tag. - Compile the project (
commands.compile). If it fails, stop: the implementation is not complete. - Run the feature tests once:
commands.test_feature, with{feature_tag}replaced byfeature_tagfrom the context. For each failing test:- test right, code wrong: the implementation is not done. Report it. Ask the user if the code must be fixed first. Code is fixed, never the test.
- test wrong according to the spec: add an entry to
<runs_dir>/suspected-test-defects.mdand ask the user. - not sure: ask the user.
1. Hidden faults (once per feature)
- If
<runs_dir>/faults/has no*.patchfiles, startqestack:qe-fault-seeder(Feature). - Start
qestack:qe-test-judge(Feature, Mode: fault-review). If the verdict in<runs_dir>/faults/fault-review.jsonisrevise, start the seeder again. At most 2 rounds. If the verdict is stillrevise, continue, and list the open fault findings (counts and requirement IDs only) for the user. - Run
git status --porcelain. No production file may stay changed by the seeder. If a file is still changed, runqestack fault restore --feature <feature>. - Never tell the test writer about the faults. Do not paste fault details in the conversation.
2. Improvement loop (iteration i = 1 to max_iterations)
- Gates:
qestack gate --feature <feature>(lint, trace, guard, flakiness, mutation, seeded faults). Run it in the background (run_in_background: true) and wait for the completion notice. If a command is wrong, stop and tell the user which[commands]entry to fix. - Judge: start
qestack:qe-test-judge(Feature, Mode: test-review, Iteration: i). - Score:
qestack score --feature <feature> --iteration i- exit 0 = ACCEPT: go to section 3 (Finish)
- exit 3 = ESCALATE: go to section 3 (Finish)
- exit 1 = CONTINUE: continue with step 4
- Feedback:
qestack feedback --feature <feature> --iteration i - Snapshot:
qestack snapshot --feature <feature> - Improve: start
qestack:qe-test-writer(Feature, Mode: improve, Phase: harden, Feedback:<runs_dir>/feedback-i.md). - Check the writer:
qestack guard --feature <feature> --source-unchanged.- A VIOLATION means that the writer changed production code or weakened a test.
- In this loop, a REVIEW
STUB_IN_EXISTING_FILEis also a violation. The writer may not add stubs after the implementation. - Undo a test change with Edit, or ask the user. Ask the user to undo a production change. The hook blocks
git checkoutandgit restoreon locked test files.
- If
suspected-bugs.mdorsuspected-test-defects.mdhas new entries, show them to the user now. Ask whether to fix the code first. Do not continue the loop on a known product bug without the user's decision. - Start the next iteration (i + 1) at step 1.
3. Finish
- On ACCEPT:
qestack lock --feature <feature> --phase accepted. - Report to the user (short):
- the decision and the reason
- the Test Quality Score and its trend
- each hard gate with its status and value
- suspected product bugs (a good result)
- items for human decision (section 8 of the report)
- undetected faults: the path
<runs_dir>/faults/undetected.md. The user reads it. You do not read it or quote it. - the audit sample: ask the user to review those tests, record verdicts in
<runs_dir>/human-audit.json, then useqe-calibrate - the path of
quality-report.md
Rules
- Never weaken tests. Never change thresholds or protected files.
- Do not say that a gate passed if the scorecard says FAIL, NOT_RUN or SKIPPED.
- The writer never reads
seed.jsonor any file in<runs_dir>/faults/(patches,catalog.json,fault-review.json,undetected.md). The judge in test-review mode reads onlyseed-feedback.json. - Some faults are held out. They never appear in the feedback. The seed gate uses them to measure the tests without bias. Do not try to find them.
- If a gate cannot run (for example, no mutation tool), report NOT_RUN and tell the user what to install. Do not remove the gate from
required.
04 同仓库更多 Skills
unit-testing
Writes, fixes or improves unit tests for rules, calculations, validation and state logic: arrange-act-assert, exact oracles, boundary sets, doubles only at boundaries, controlled clock and randomness. Use when the user says 'write unit tests', 'TDD this' or 'mock this dependency'. Not for HTTP endpoints (use api-testing).
ui-automation
Writes, fixes or structures browser end-to-end tests for critical journeys: role, label or test ID locators, auto-waiting assertions, API data setup, page objects, auth reuse and traces. Use when the user says 'UI test', 'end-to-end test' or 'our UI tests are brittle'. Not for business rules (use unit-testing).
testcase-reviewer
Reviews automated tests or manual test cases like a senior test architect: scores fidelity, oracles, assertion depth, edge cases and determinism, and finds tests that pass on wrong code. Use when the user says 'review my tests', 'test smells' or 'review AI-written tests'. Not for fault injection (use mutation-probe).
testability-review
Scores how testable a feature, module or design is before tests exist (seams for clock, randomness and network, hidden state, observability) and gives the smallest production change per blocker. Use when the user asks 'is this testable' or 'why is this hard to test'. Not for writing the tests (use unit-testing).
test-strategy
Writes a test strategy for a product, system or team: quality goals, test levels and their share, environments, data, automation scope, non-functional testing, metrics and a roadmap. Use when the user says 'test strategy' or 'QA strategy'. Not for one sprint or release plan (use test-planning).
test-runner
Finds how a project runs its tests, runs the right subset, and triages each failure as product bug, test defect, environment problem or flaky test, with evidence. Use when the user says 'run the tests' or asks 'which tests fail and why'. Not for pipeline design (use ci-cd-integration).