test-driven-development
Test new or changed behavior and bug fixes before implementation; use a passing baseline for behavior-preserving refactors. Use when implementing behavior, adding a regression check, or explicitly requesting TDD.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- test-driven-development
- description
- Test new or changed behavior and bug fixes before implementation; use a passing baseline for behavior-preserving refactors. Use when implementing behavior, adding a regression check, or explicitly requesting TDD.
02 资源文件 1
- 参考文档testing-anti-patterns.md8.1 KB
03 SKILL.md 正文
Test behavior before changing it
For new or changed behavior and bug fixes, make the expected behavior executable before implementation. For a behavior-preserving refactor, establish a relevant passing baseline; do not invent a failing test. Preserve existing work and unrelated edits. Do not delete implementation merely because tests came later.
- Name the promised behavior, affected interface and real trigger. Read the existing tests and choose the closest check that reaches that trigger.
- Write one focused failing test before the change. Derive its expected result from the requirement. Run it and verify that it fails because the behavior is missing or wrong, rather than a broken fixture, missing dependency or typo.
- Apply the smallest implementation or fix. Run the new test, the original reproduction where applicable, and affected checks. Preserve error handling, validation and cleanup. Address failures without weakening acceptance criteria.
- Refactor only while the relevant checks remain green. Report the failure before the change, the result after it, and unresolved gaps.
Judge a test against two changes: breaking the promised behavior should make it fail; reorganizing internals without changing behavior should leave it passing. Observe returns, errors, persisted state and effects through the interface that consumers use. An external service's request can be behavior; an internal helper's invocation usually is not. Never calculate the expected answer with the implementation being tested.
If no practical automated regression reaches the trigger, use an adequate executable script, replay, browser scenario or documented manual reproduction. Explain what it covers and what remains unverified. Do not treat a weak mock test as evidence, create unrelated infrastructure to satisfy a ritual, or weaken existing checks to obtain a pass. Necessary verification remains an obligation even when expensive.
For intermittent failures, retain the seed, trace or observed failure rate instead of claiming a passing rerun proves the defect is gone.
When adding mocks or test utilities, read the setup and lifecycle examples in testing anti-patterns. Apply the observable-boundary criterion above when judging assertions on test doubles. Understand the real dependency and preserve the side effects the test needs; avoid test-only methods in production classes. A skipped, blocked or incomplete check is unverified.
Selected test-quality guidance adapts pstack under the MIT license.
04 同仓库更多 Skills
turnstile-spin
Set up Cloudflare Turnstile end-to-end in a project. Scan the codebase, create the widget via the Cloudflare API, embed it where user requests need bot verification (form submissions, SPA actions, API endpoints, download links, comment or vote submissions, etc.), wire canonical server-side siteverify in the customer's existing backend, validate, and persist the skill. Load this when a user asks to add Turnstile, set up CAPTCHA, protect a form or endpoint from bots, or fix a Turnstile integration. Uses Cloudflare's documented Turnstile contract.
frontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
source-insights
Prepare inspected source evidence, preserve exact citations, and publish reviewed insights into an explicit local library.
skill-graph
Discover skills and workflows through independent lexical search, relationship paths and a terminal graph.
session-search
Recall public session turns with exact provenance, bounded excerpts and independent piped exports.
newsletter
Produce a private local AI newsletter from bounded public research, with cited deep dives, HTML/Markdown output, Dagu scheduling and seven-day retention.