test
Write or assess tests that prove behavior and would fail without the fix. Use when: writing tests, TDD, or asked whether a green test is enough.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1.6k
- Forks
- 491
01 前言 Front Matter
- name
- test
- consumes
- [ "standards", "repo-context" ]
- metadata
- { "tier": "execution", "effects": [ "write_test_files", "write_test_evidence", "modify_source_files" ], "disposition": "keep_specialist", "capabilities": [ "test" ], "dependencies": [], "canonical_status": "canonical" }
- produces
- [ "test-evidence" ]
- practices
- [ "tdd", "property-based-testing", "bdd-gherkin" ]
- context_rel
- []
- description
- Write or assess tests that prove behavior and would fail without the fix. Use when: writing tests, TDD, or asked whether a green test is enough.
- hexagonal_role
- supporting
- user-invocable
- true
- output_contract
- behavioral tests and reproducible check facts; coverage results when requested
- skill_api_version
- 1
02 资源文件 7
- 参考文档references/error-recovery.md3.0 KB
- 参考文档references/exploratory-qa.md6.0 KB
- 参考文档references/proof-fidelity.md4.8 KB
- 参考文档references/real-service-e2e.md1.8 KB
- 参考文档references/subject-performance.md5.8 KB
- 参考文档references/suite-audit.md5.1 KB
- 脚本scripts/validate.sh2.9 KB
03 SKILL.md 正文
Test
This skill makes a test assert the effect the behavior promises, with exact values, and shows that the test fails without the fix before it counts as proof. A user sees it worked when the handoff names each test's asserted values and how it was shown failing, or says "not shown".
A green test is evidence for the caller's decision, never the test author's merge approval; the binding verdict belongs to Validate. To only run a known suite, run it directly.
Critical Constraints
- Assert the promised effect. Check the state change, outbound call or count the behavior promises at its boundary, reading a stored record back through the product's own read path unless the stored shape is the contract. Take exact expected values from a literal, worked example or the specification, never the implementation's own formula or a mock's answer: for a 20% discount on 50, assert 40. A status code, a returned object or the absence of an exception alone does not prove the behavior; would the test stay green if the code returned an empty or default result? A rejection test asserts the error its name claims, since another guard can reject the same input.
- A regression test proves nothing until it fails on the defect. Show that it fails on the pre-fix code (see Mutation-kill proof) through the callers, sequence or state that produced the report, not only at the changed line. Until then, report its proof as "not shown"; green alone is not yet proof.
- Derive cases from accepted observable behavior; reuse examples from the conversation, bead, specification or existing contract before inventing new ones. Keep established domain names; do not unify bounded-context terms by renaming tests.
- Use the repository's framework and real check recipe; keep tests free of accidental timing, ordering and shared-state dependencies.
- A test that starts green on existing correct behavior is legitimate; use such tests to pin untested code before changing it, marking an odd result as a suspected defect. Never manufacture a RED claim or alter acceptance to excuse a product defect.
- Repair a discovered defect when already authorized; otherwise report the reproducer and finding, never masking it by deleting or weakening a test (fix the cause, not the oracle).
- Never refresh a golden or snapshot file to turn a test green. Find the source change behind the diff; update the artifact only for intended behavior or fixture drift and say why in the handoff; for a bug, fix the generator.
Oracle-strength hierarchy
Prefer exact observable values or errors when known. Use properties or invariants when they express the contract more faithfully than one example. Differential agreement needs an independently credible reference. A smoke check proves only what it observes; it cannot establish an exact behavior by itself. When correctness is a matter of meaning, as for a summary or ranking, a count is only a proxy; judge it as in proof fidelity. Explain a material oracle limit in the native handoff, without creating a worksheet or mandatory report.
Mutation-kill proof
Establish that an important new behavioral check can catch the defect it claims to guard. An authentic pre-fix RED or reproduction is usually sufficient. If a regression test was written after the fix, run it against the pre-fix version (revert the fix in an isolated copy) or use a safe, targeted negative control. Mutate only when that would resolve real doubt about the oracle, then restore and verify the candidate. Do not demand one mutation experiment per table row or new test. Trust a revert or mutation result only from a copy confirmed to hold this candidate's commit and uncommitted changes plus that one edit; a worktree cut from HEAD can lack the fix or test. Never mutate a shared checkout.
Harness health floors
Confirm the runner completed, the intended tests actually ran, and assertions
observe the promised behavior. Take the result from the runner's exit status,
not its printed output, and keep that status through pipes (pipefail):
make test | tail reports tail. A check that edits tracked files has changed
the subject; report the edit. Report crashes, truncation, unexpected skips or
exclusions as gaps. When runner discovery or failure reporting changed, use a
negative control through that same path before trusting green. When the change
is itself a check standing in for a real run, also match its context to what it
protects (proof fidelity).
No need to re-prove an unchanged healthy runner on each edit.
Modes
| Mode | Use when | Result |
|---|---|---|
generate |
Existing behavior needs tests | Useful tests and focused/suite results |
coverage |
The caller asks to find or fill gaps | Before/after coverage, valuable tests and remaining risks |
tdd |
The caller asks for TDD on new behavior | A test shown failing without the change, the change, green, then refactor |
strategy |
The caller wants test design only | Prioritized risks and proposed checks in the existing discussion |
Default to generate; mode and scope are skill prompt choices, not invented
CLI flags. Coverage thresholds come from the caller or repository.
Workflow
- Read the accepted examples and the relevant public interface. One
discriminating example may suffice for a small change; add the error and
boundary cases that could falsify acceptance. A
.featurefile is optional; if the repository already uses scenario-to-test annotations, maintain them and use its scenario coverage checker. When several record kinds support different actions, read kind and action pairs. Done when each accepted example and each falsifying case has a named test or anot_checkedline. - Find the owning suite and a narrow baseline. For a defect, choose which test
carries its proof before changing code; with no seam that reaches the
reported chain, write no shallower stand-in
(proof fidelity).
Measure broad coverage only in
coveragemode or under an existing repository requirement. - Write the smallest test that observes the promised result through a stable
interface: the entry point callers use. Add no export, flag or hook only
tests call (a time, randomness or external-boundary seam excepted), mock no
collaborator inside the unit, and move to the interface any test you write
here that a behavior-preserving rewrite would break; list existing ones under
rewrite(suite audit). Intddmode the proof is a test that fails without the change for the expected missing-behavior reason. Running it before implementation or against the pre-change code (Mutation-kill proof) both show that; do not require one order. Then refactor under green (Refactor when the cleanup reaches beyond the change). Take one behavior at a time, each next case chosen from what the last cycle showed. - Run focused checks while editing and the relevant integration recipe before handoff; broaden only for changed risk, a failure or repository policy.
- Compare against the original accepted examples. New tests added after implementation may supplement but never replace them.
Specialized references
Load only the guidance needed by the subject:
- Service integration: real-service E2E
- Selected user journeys: exploratory QA
- Authorized suite maintenance: suite audit
- Defect proof placement, stand-in checks and judged output: proof fidelity
- CLI/API failure signals and uncertain write outcomes: error recovery
- Timing, shared-state or concurrency failures: difficult-failure experiments
- Workload baseline and candidate comparison: subject performance
Output Specification
Tests belong in the repository's language-native locations. Check facts and limits go in the existing handoff:
tests: <file::name> -> <behavior and exact values it asserts>
proof: <each important new test> -> how it was shown to fail on its defect:
pre-fix RED | reverted-fix run | negative control | not shown
commands: <exact command> -> <result>
harness: <runner completed; how many ran; skips or exclusions>
coverage: <before -> after, command> (coverage mode only)
defects: <discovered defect and reproducer, or none>
rewrite: <existing test a behavior-preserving change would break>
not_checked: <material behavior no test covers>
Persist coverage or other reports only when requested or required by a declared
consumer, at its selected destination; no automatic .agents/ output.
Example: for a duplicate Job delivery, assert that the completed result is returned and the external side effect is called only once. A coverage increase without those assertions would not prove the behavior.
This guidance uses original examples informed by Matt Pocock's engineering skills, with AgentOps' existing acceptance and evidence boundaries.
04 同仓库更多 Skills
migrate-to-e2e
Moves an existing Playwright, Cypress, Selenium, Appium, Detox, Maestro, or TesterArmy suite to e2e one slice at a time, with the old suite running beside the new one until each ported test is proven. Keeps a MIGRATION.md progress file so any later session resumes where the last stopped. Optionally plants a defect to show both suites catch it. Use for /migrate-to-e2e, "migrate our tests to e2e", "port these Maestro flows", "move our TesterArmy tests", or when a project has an e2e config and an older suite still running.
e2e
Writes, runs, and debugs end-to-end tests for web and mobile apps with e2e, the agentic test runner, which mixes agent.act goals with exact locator assertions on a Playwright browser or an iOS or Android device. Also drives a project's running app live over the e2e MCP server to look at a screen, check a UI change, take a screenshot or record a video, and try a locator; and runs bug bashes, parallel e2e explore runs with each bug proven by a repro test. Use when a project depends on e2e or has an e2e.config.ts, when asked for end-to-end, browser, mobile, or agentic UI tests, to check a change in the running app, to QA or bug bash an app or branch, or when an e2e run fails.
create-verification-skill
Generate a project-local verify-<app> skill on top of e2e, so any coding agent can launch the app, check it is worth driving, exercise a feature the way a user does, keep evidence, and bug bash it. Writes the skill, a feature map with one explore charter per feature, and proves it once. Use for /create-verification-skill, "make a verification skill for this repo", or when a project has no scripted way to prove UI behavior.
deja-search
deja-vu memory — search the user's past AI coding sessions with the deja CLI. Holds what they already settled and never wrote into the repo (naming rules, banned or already-tried tools, required checks before merge, preferred values, who owns what). Use before your first edit in a task, before you call a change done or ready to merge, before you recommend a tool, library, design or reviewer, before re-debugging an error that may already be solved, when they say 'didn't we fix this before', 'what did we decide about X' or 'I already have that', and before telling them something on this machine does not exist.
deja-reflect
End-of-session reflection and memory curation with deja-vu. Review what was decided, what commands broke and what repaired them, and record durable project rules or decisions with deja remember so the next session starts with them.
revid
Make, edit, export and post AI videos with Revid (revid.ai) through the Revid MCP server. Use whenever the user wants a short-form or long-form video made (from an idea, a script, a URL, an article, a PDF, a tweet, a product page, their own clips, or a song), wants to find what is going viral on TikTok, YouTube, Instagram or X before making something, wants to edit or re-export an existing Revid project, generate a standalone AI image or clip, make a series episode, or publish and schedule a finished video to connected social accounts. Covers setup (hosted MCP with OAuth, or an API key), the 36 tools, credits, polling and the rules for publishing. Routes to the more specific revid-* skills when one fits.