一键导入
testing-conventions
Day-to-day testing principles — tests-are-sacred, verification-first, and the 3-layer pyramid — for Developer-tier users.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Day-to-day testing principles — tests-are-sacred, verification-first, and the 3-layer pyramid — for Developer-tier users.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Release discipline and mechanics in one skill — pre-release checklist (CI green on every OS, version bump committed, CHANGELOG authored, dist/ committed, paired-release order locked for cross-repo releases), then the mechanical cut (conventional-commit semver auto-sizing, CHANGELOG prepend, tag, push, `gh release create`).
Two-step cross-model prose pass for design docs and other authored prose — Gemini simplifies via the headless prose_pass.py script, then Claude verifies every fact-guard held and applies. The prose sibling of code-review's cross-review.sh.
Author + maintain a Diátaxis-style wiki for any repo. Live authoring guidance (mode selection + template-fill + filename style), ongoing drift detection + repair, one-shot migration of legacy audience-based wikis to the six-section documentation layout (how-to · reference · architecture · designs · explanation · operational; onboarding folds into how-to, marked with a mode-tutorial hint), and single-page mode classification with sub-agent fallback on ambiguous cases. Reads operator conventions from AgentMemory `_always-load/diataxis-*.md`; composes a base style-guide ⊕ on-demand voice overlay into authored drafts, and learns generalizable voice lessons from the operator's own edits (edit-driven capture, operator-gated for generality + scope); offers to capture judgment calls back as new conventions (operator-confirmed via permeable-boundary helper). Dispatches the existing `documenter` sub-agent for mechanical-write work; never auto-forks into wiki/ without preview. Subsumes the predecessor `migrate-to-diatax
Update or create a Diátaxis wiki page for the current repo (or another registered repo). Triggers when the operator says 'update the wiki', 'document this in the wiki', 'add this to the wiki', 'create a wiki page for X', or 'update <repo>'s wiki'. Resolves target repo via cwd (default) or explicit repo name (cross-repo via repo_registry from V4 #30 plan 1). Dispatches the documenter sub-agent for the structural edit with preview-before-write. Defers to diataxis-author skill for mode selection when needed. Honors per-repo .diataxis-conventions.md override. Does NOT auto-generate content — agent gathers context from the conversation; the skill handles dispatch + write contract.
Test coverage audit via the Beyonce Rule (uncovered behavior is behavior you've agreed to change silently), DAMP over DRY (tests read like specs, not production code), and the Prove-It pattern (every behavioral claim needs a falsifying test). Use when reviewing a PR for test gaps or when a feature lands without coverage.
The harness discipline every phase workflow and every persona operates under — phase-gated sessions, state-on-disk-not-conversation, single-threaded implementation with read-only sub-agent fan-out, the PLAN.md shape, wake-on-CI, no parallel implementers, and the single-cycle shape for background primitives. A re-home of standards that previously lived only in agentm's AGENTS.md / harness/principles.md and the operator's global ~/.claude/CLAUDE.md — this domain owns the standard now; those files keep a pointer.
| name | testing-conventions |
| description | Day-to-day testing principles — tests-are-sacred, verification-first, and the 3-layer pyramid — for Developer-tier users. |
| kind | skill |
| supported_hosts | ["claude-code","antigravity"] |
| version | 0.1.0 |
| install_scope | project |
Day-to-day testing practice for developers. These are standing principles, not one-off review rules — they apply every time you write, change, or touch code with observable behavior.
For review-time gap auditing (identifying missing test types in a diff), use the
code-reviewplugin'stesting-strategyskill. This skill owns the practice; that skill owns the audit.
A failing test is information, not an obstacle. It is telling you something true about the gap between what you intended and what you built. Never delete or skip a test to make a build pass.
Acceptable responses to a failing test:
What is never acceptable: deleting a test because it is inconvenient, marking @pytest.mark.skip with only "TODO", or weakening an assertion so it always passes.
Concrete example. A test asserts response.status_code == 201. After a refactor it starts returning 200. Acceptable: update the response contract and fix the assertion with a comment explaining the intent change. Not acceptable: change the assertion to assert response.status_code in (200, 201) to silence the failure without understanding it.
Write the scenario that can fail before the code that makes it pass. A test written after the fact verifies that the code does what you just wrote — it doesn't tell you whether the code does what you needed. That is a documentation exercise, not a safety net.
The practical constraint: if you cannot describe, in one sentence, what observable behavior the test is checking before you write the implementation, the requirement is underspecified. Clarify the requirement before writing code.
Concrete example. You're adding a calculate_discount(price, tier) function. Write test_gold_tier_gets_20_percent_discount with an explicit fixture and assertion first. Then write the function until the test passes. If the test was easy to write, the function's contract is clear. If the test was hard to write, the contract needs work.
Verification-first is not about test-driven development as a ritual — it is about forcing a moment of precision before you commit to an implementation path.
Each layer has a distinct purpose, scope, and speed contract. Do not collapse them.
| Layer | What it tests | Speed | Isolation |
|---|---|---|---|
| Unit | One function/module's behavior in isolation | < 1 ms per test | No network, no disk, no DB |
| Integration | Cross-boundary contracts (e.g. your code + a real DB, or two modules wired together) | 10 ms – 1 s | Real collaborators at the boundary |
| E2E | Golden user paths through the full system | Seconds | Full stack, real environment |
Unit tests check behavior, not implementation. A test that breaks whenever you rename a private method is testing implementation; rewrite it to test the observable output. Fast unit tests run on every save — if your unit suite takes > 5 seconds you have integration tests disguised as unit tests.
Integration tests verify the contract at a boundary your code doesn't control (a database schema, an external API contract, a message queue format). Mock the boundary in unit tests; prove the contract works at the integration layer.
E2E tests cover golden paths only — the two or three flows a real user must complete successfully. E2E tests are expensive to write, slow to run, and brittle to maintain. They are not a substitute for unit or integration coverage.
Concrete example. A UserRepository.save(user) function has three layers of coverage: a unit test that mocks the DB call and asserts the right SQL parameters are passed; an integration test that hits a real (test) database and asserts the record was persisted correctly; an E2E test that logs in, creates a user via the API, and asserts the user appears in the list view. Each layer is doing a job the others cannot.
Do not push integration failures down. If an integration test fails, fix the integration — do not add more unit mocks to paper over it.