← ClaudeAtlas

tdd-pytestlisted

Python/pytest TDD specialist for test-driven development workflows. Use when writing tests, auditing test quality, running pytest, or generating test reports. Integrates with uv and pyproject.toml configuration.
aiskillstore/marketplace · ★ 329 · Testing & QA · score 85
Install: claude install-skill aiskillstore/marketplace
# TDD-Pytest Skill Activate this skill when the user needs help with: - Writing tests using TDD methodology (Red-Green-Refactor) - Auditing existing pytest test files for quality - Running tests with coverage - Generating test reports to `TESTING_REPORT.local.md` - Setting up pytest configuration in `pyproject.toml` ## TDD Workflow ### Red-Green-Refactor Cycle 1. **RED** - Write a failing test first - Test should fail for the right reason (not import errors) - Test should be minimal and focused - Show the failing test output 2. **GREEN** - Write minimal code to pass - Only implement what's needed to pass the test - No premature optimization - Show the passing test output 3. **REFACTOR** - Improve code while keeping tests green - Clean up duplication - Improve naming - Extract functions/classes if needed - Run tests after each change ## Test Organization ### File Structure ```text project/ src/ module.py tests/ conftest.py # Shared fixtures test_module.py # Tests for module.py pyproject.toml # Pytest configuration ``` ### Naming Conventions - Test files: `test_*.py` or `*_test.py` - Test functions: `test_*` - Test classes: `Test*` - Fixtures: Descriptive names (`mock_database`, `sample_user`) ## Pytest Best Practices ### Fixtures ```python import pytest @pytest.fixture def sample_config(): return {"key": "value"} @pytest.fixture def mock_client(mocker): return mocker.MagicMock() ```