Loading...
Loading...
Guide Test-Driven Development workflow (Red-Green-Refactor) for new features, bug fixes, and refactoring. Identifies test improvement opportunities and applies pytest best practices. Use when writing tests, implementing features, or following TDD methodology. **PROACTIVE ACTIVATION**: Auto-invoke when implementing features or fixing bugs in projects with test infrastructure (pytest files, tests/ directory). **DETECTION**: Check for tests/ directory, pytest.ini, pyproject.toml with pytest config, or test files. **USE CASES**: Writing production code, fixing bugs, adding features, legacy code characterization.
npx skill4agent add mguinada/agent-skills tdduv run pytest tests/feature/test_new_function.py -vuv run pytest tests/feature/test_new_function.py::test_new_function -v
uv run pytestuv run pytest --cov=src --cov-report=term-missingdef test_calculate_total_with_negative_price_raises_error():
items = [Item("Coke", -1.50)]
with pytest.raises(ValueError, match="Price cannot be negative"):
calculate_total(items)uv run pytest tests/legacy/test_old_module.py -v
uv run pytest --cov=src/legacy_module --cov-report=term-missing@pytest.mark.slowbin/ci-local 2>&1 | tee baseline.txt
grep "passed" baseline.txt # Note test count
grep "Cover" baseline.txt # Note coverage %uv run pytest --cov=src --cov-report=term-missinguv run pytestuv run pytest --cov=src --cov-report=term-missinguv run mypy src/uv run ruff check src/uv run pytest --durations=10bin/ci-local# Run all tests
uv run pytest
# Run specific test file
uv run pytest tests/models/test_registry.py -v
# Run specific test
uv run pytest tests/test_file.py::TestClass::test_function -vv
# Run with coverage
uv run pytest --cov=src --cov-report=term-missing --cov-report=html
# Run full CI pipeline
bin/ci-local
# Check test execution time
uv run pytest --durations=10
# Run fast tests only
uv run pytest -m "not slow"