test-driven-development
Write failing tests first, then implement the minimum code to make them pass. Use for new features, bug fixes, and when high confidence in correctness is required. Trigger on requests involving tests, TDD, test coverage, or "write tests for".
- License 许可
- MIT
- 最近更新
- 2026-07-22
- Stars
- ★ 7
- Forks
- 1
01 前言 Front Matter
- name
- test-driven-development
- description
- Write failing tests first, then implement the minimum code to make them pass. Use for new features, bug fixes, and when high confidence in correctness is required. Trigger on requests involving tests, TDD, test coverage, or "write tests for".
03 SKILL.md 正文
Test-Driven Development
Overview
TDD produces better design and higher confidence. The red → green → refactor cycle is the core discipline.
When to Use
- Implementing new behavior
- Fixing bugs (write the failing test that reproduces the bug first)
- When correctness matters more than speed of initial implementation
- Refactoring existing code (characterization tests first if needed)
Core Cycle
- Red – Write a small failing test that describes the desired behavior.
- Green – Write the simplest code that makes the test pass.
- Refactor – Clean up while keeping tests green.
Repeat in small increments.
Guidelines
- Test behavior, not implementation details
- One logical assertion focus per test when practical
- Use descriptive test names that explain the scenario and expected outcome
- Prefer fast, deterministic unit tests; add integration/E2E where they add unique value
- For bug fixes: always start with a test that fails on the current code
What Makes a Good Test
- Fails for the right reason
- Readable by a future reader
- Independent of other tests
- Fast enough to run frequently
Common Pitfalls
- Writing tests after the code (misses the design feedback of TDD)
- Testing private methods directly
- Over-mocking (tests become brittle and low-value)
- Large tests that check too many things at once
Verification
- All new tests fail before the implementation is added
- All tests pass after implementation
- Edge cases and error paths have coverage
- Tests remain valuable after future refactors
04 同仓库更多 Skills
compliance-monitoring
Design compliance monitoring and testing programs that verify controls work in practice and surface issues before regulators do. Use when building monitoring plans, compliance testing, or continuous control monitoring.
complaints-handling
Operate complaints-handling processes that meet regulatory standards — logging, timely resolution, root-cause analysis, and fair outcomes. Use when designing or improving regulated complaints frameworks or analyzing complaint themes for conduct risk.
aml-kyc-basics
Apply AML/KYC fundamentals — customer due diligence, monitoring, suspicious activity escalation, and recordkeeping — for financial crime compliance. Use when designing onboarding controls, transaction monitoring concepts, or AML program components in financial services.
ai-model-compliance
Apply compliance controls to AI and automated decision systems — transparency, fairness, human oversight, documentation, and regulatory alignment. Use when deploying AI in regulated processes (credit, fraud, customer decisions) or responding to AI governance expectations.
data-quality-management
Manage data quality end-to-end — dimensions, rules, remediation, and prevention — beyond one-off cleaning scripts. Use when building sustained data quality programs or fixing systemic accuracy, completeness, or consistency problems.
data-lineage
Capture and use data lineage — where data comes from, how it transforms, and what depends on it — for impact analysis, debugging, and trust. Use when tracing metric origins, assessing change impact, or diagnosing broken pipelines.