一键导入
testing-python
Writes tests following TDD (using pytest and Hypothesis) and BDD best practices. Use when writing unit tests, integration tests, or BDD scenarios.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Writes tests following TDD (using pytest and Hypothesis) and BDD best practices. Use when writing unit tests, integration tests, or BDD scenarios.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Audit and tighten codebase quality gates — lint, types, tests, code review. Use when onboarding a project, before a release, or when validation is too permissive.
Compacts verbose context into structured summary. Use after pollution sources (searches, logs, JSON) or at phase milestones.
Audits and aligns project documentation against its own declared hierarchy. Discovers authority chains from CONTRIBUTING.md (or equivalent), then detects broken links, duplicates, and misplaced content. Use when reviewing doc health, fixing stale references, or enforcing single-source-of-truth.
Implements concise, streamlined Python code matching exact architect specifications. Use when writing Python code, creating modules, or when the user asks to implement features in Python.
Investigates codebase before planning. Use before any non-trivial implementation task to gather context in isolation.
Provides concise, focused code reviews matching exact task complexity requirements. Use when reviewing code quality, security, or when the user asks for code review.
| name | testing-python |
| description | Writes tests following TDD (using pytest and Hypothesis) and BDD best practices. Use when writing unit tests, integration tests, or BDD scenarios. |
| compatibility | Designed for Claude Code |
| metadata | {"allowed-tools":"Read, Grep, Glob, Edit, Write, Bash","argument-hint":["test-scope or component-name"],"stability":"stable","content-hash":"sha256:7ec36cfc580c044cc46fd4fece46741526f9252b688e55b741223b2397d42064","last-verified-cc-version":"1.0.34"} |
Target: $ARGUMENTS
Writes focused, behavior-driven tests following project testing strategy.
TDD methodology (language-agnostic): See tdd-core plugin (testing-tdd skill)
Python-specific documentation: references/
references/testing-strategy.md - Python tools (pytest, Hypothesis, inline-snapshot, pytest-bdd)references/tdd-best-practices.md - Python TDD examples (extends tdd-core)references/bdd-best-practices.md - BDD methodology with pytest-bddTDD (default): Use pytest for known cases, Hypothesis for edge cases. Works at unit/integration/acceptance levels.
BDD (optional): Use Given-When-Then for stakeholder collaboration on acceptance criteria.
See references/testing-strategy.md for full methodology comparison.
Cycle: RED (failing test) → GREEN (minimal pass) → REFACTOR (clean up)
Structure: Arrange-Act-Assert (AAA)
def test_order_processor_calculates_total():
# ARRANGE
items = [Item(price=10.00, qty=2), Item(price=5.00, qty=1)]
processor = OrderProcessor()
# ACT
total = processor.calculate_total(items)
# ASSERT
assert total == 25.00
| Priority | Area | Example |
|---|---|---|
| CRITICAL | Math formulas | Scores always in bounds |
| CRITICAL | Loop termination | Never hangs |
| HIGH | Input validation | Handles any text |
| HIGH | Serialization | Always valid JSON |
High-Value: Business logic, integration points, edge cases, contracts
Avoid: Library behavior, trivial assertions, implementation details, default constants, stale fixture patches (see references/testing-strategy.md → "Patterns to Remove")
See references/testing-strategy.md → "Patterns to Remove" for full list.
Format: test_{module}_{component}_{behavior}
test_user_service_creates_new_user()
test_order_processor_validates_items()
make test # All tests
make test_rerun # Rerun failed tests (fast iteration)
make validate # Full pre-commit validation
pytest tests/ -v # Verbose
pytest -k test_user_ # Filter by name
make test)