unit-tests
Author unit tests using the repo's existing framework; one test per behavior, no mocking of internal collaborators. Writes tests; not gap analysis (coverage-gap) or strategy (test-strategy).
- License 许可
- MIT
- 最近更新
- 2026-10-29
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- unit-tests
- description
- Author unit tests using the repo's existing framework; one test per behavior, no mocking of internal collaborators. Writes tests; not gap analysis (coverage-gap) or strategy (test-strategy).
02 资源文件 1
- 参考文档routing.yaml334 B
03 SKILL.md 正文
unit-tests
Author unit tests for behaviors a
coverage-gappass identified as MISSING (unit).
Mode: analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked [TBD] or [VERIFY], never filled in.
When to use
- A workflow invokes
polymath-qa:unit-tests. - The user asks "write tests for this".
coverage-gaplistedMISSING (unit)items.
Inputs
- The behavior list (from
coverage-gapor a manual request). - Repo conventions (test framework, layout, naming).
Procedure
- Detect the framework:
pytest,vitest,jest,xunit,go test, etc. - For each behavior, write one test:
- Name describes the behavior, not the implementation.
- Arrange / Act / Assert blocks are visible.
- One assertion per behavior; multiple
asserts only when they describe the same observation.
- Prove each test can fail. For a test written against existing code, temporarily break the behavior it protects (flip the condition, return the wrong value) and watch it fail, then restore. A test that stays green is vacuous — fix the assertion.
- If a new test fails because the code is wrong, report the bug — don't change the assertion to match the buggy output. Mark the test as a known failure only if the user agrees (with a link to the bug).
- Avoid:
- Mocking internal collaborators (mock only the boundaries you don't own — clock, network, filesystem).
- Asserting on private attributes.
- Time-of-day or random seeds without explicit injection.
- "Helper test" that calls another test.
Output
tests/test_refunds.py
test_refund_rejects_negative_amount PASS
test_refund_above_balance_returns_409 PASS
Covered: 2 behavior(s) Still uncovered: 0
Run: pytest tests/test_refunds.py → green
- Test files in the repo's conventional location.
- Each new test runs green when invoked through the repo's test command.
- A summary lists which behaviors are now covered and which (if any) still aren't.
Anti-patterns to avoid
- Snapshot tests for behaviors that should have explicit assertions.
- "Should not throw" tests where a specific outcome is what matters.
- Parameterized tests where each case actually tests a different behavior — split them.
04 同仓库更多 Skills
runbook
Write or refresh an operational runbook for an alert/symptom; structured as TL;DR + Pre-checks + Steps + Verification + Rollback + Escalation.
rfc
Draft a lightweight design RFC to docs/rfcs/<slug>.md; Summary, Motivation, Detailed design, Drawbacks, Alternatives, Unresolved questions. A proposal to debate, not a recorded decision (adr).
editorial-pass
Review and tighten prose in a Markdown artifact for a target tone (terse, formal, friendly) without dropping information; preserve quotations and load-bearing constraints.
architecture-review-facilitation
Run an architecture review as a process — entry criteria, reviewer checklist, decision log, and follow-up actions — pairing the design artifact with a red-team pass.
architecture-doc
Write a C4-style architecture document; System Context + Containers (+ Components when interesting) with mermaid diagrams. Describes structure, not a decision (adr) or proposal (rfc).
adr
Write an Architecture Decision Record (Michael Nygard format) to docs/adrs/NNNN-<slug>.md; frontmatter validated by the ADR artifact schema. Records a made decision, not a proposal to debate (rfc).