tdd-practices_skill
- Python
2
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill pluginagentmarketplace/custom-plugin-software-design --skill tdd-practices- SKILL.md5.7 KB
Overview
This skill guides test-driven development workflows, designs practical test cases, and recommends mocking strategies for clean, maintainable tests. It focuses on Red-Green-Refactor cycles and produces concrete test templates and step-by-step TDD guidance for multiple languages and frameworks. The output is actionable: test cases, TDD steps, mock patterns, and basic coverage analysis suggestions.
How this skill works
Provide an action (design_tests, tdd_guide, mock_strategy, coverage_analysis) and a target language; optionally include code, feature description, or dependency list. The skill analyzes public behavior, identifies edge cases and priorities, and returns test case templates, TDD steps, recommended mock types, or a brief coverage checklist. Defaults map languages to common frameworks (e.g., pytest for Python) and validation enforces supported languages and actions.
When to use it
- When you need concrete unit or integration test templates for existing code.
- When adopting or coaching a Red-Green-Refactor TDD workflow for a feature.
- When deciding between stubs, mocks, spies, or fakes for external dependencies.
- When preparing a focused test plan to increase baseline coverage quickly.
- When you want minimal code examples to start tests in a specific test framework.
Best practices
- Start small: write a single failing test that asserts one behavior before implementing code.
- Prefer minimal implementation in green phase; avoid premature optimization.
- Keep tests deterministic: isolate external systems with appropriate mocks, stubs, or fakes.
- Verify interactions only when behavior depends on them; use spies or mocks sparingly.
- Refactor tests and production code together to keep tests expressive and maintainable.
Example use cases
- Design unit tests for a service method that calls payment and repository layers.
- Generate a Red-Green-Refactor plan for adding a discount-code feature to checkout.
- Recommend a mocking strategy for third-party HTTP clients and database access.
- Produce pytest templates for Python functions and suggest priority and edge cases.
- Provide a quick coverage checklist for critical flows before a release.
FAQ
Use a stub or fake if you need predictable canned responses; use a mock or spy when you must verify interaction patterns such as retries or specific call parameters.
How granular should my tests be in TDD?
Aim for single-behavior tests: one assertion of observable behavior per test. Group tests by public method or feature and avoid testing implementation details.