Agent skill
smith-tests
Testing standards and TDD workflow. Use when writing tests, running test suites, implementing TDD, or organizing test files. Covers unit vs integration test separation, pytest patterns, and test-driven development methodology.
Install this agent skill to your Project
npx add-skill https://github.com/tianjianjiang/smith/tree/main/smith-tests
SKILL.md
Testing Standards
- Load if: Writing tests, running test suites, TDD
- Prerequisites: @smith-principles/SKILL.md, @smith-standards/SKILL.md,
@smith-python/SKILL.md
CRITICAL (Primacy Zone)
- MUST mirror source structure:
foo/bar/xyz.py→tests/unit/foo/bar/test_xyz.py - MUST use pytest functions (not classes) - see
@smith-python/SKILL.md - MUST separate unit (
tests/unit/) and integration (tests/integration/) tests - MUST use virtual env runner for pytest (
poetry runoruv run) - MUST write tests BEFORE implementation (TDD)
- MUST run full test suite proactively after code changes — do not wait for the user to ask
- MUST run the module's quality gate before reporting completion — linting, type checks, and tests (
make quality> project CI script > run individually; see@smith-dev/SKILL.mdPre-PR Quality Gates)
- NEVER use
pytest -m "not integration"if folder structure is mirrored (import conflicts) - NEVER write implementation before tests
- NEVER skip running tests after changes
Test Organization
Unit:
- Location:
tests/unit/ - Characteristics: Mock dependencies, fast
Integration:
- Location:
tests/integration/ - Characteristics: Real services,
@pytest.mark.integration
TDD Workflow
- Understand: Read existing test patterns
- Design: Write failing tests defining expected behavior
- Implement: Write minimal code to pass tests
- Verify: Run tests, validate coverage
- Refactor: Improve code while keeping tests green
Environment Configuration
tests/conftest.pydisables tracking (OPIK, etc.)- Virtual env runners load
.envautomatically - Use
.env.exampleas template (NEVER commit.env)
Claude Code Plugin Integration
When pr-review-toolkit is available:
- pr-test-analyzer agent: Analyzes behavioral coverage, identifies critical gaps
- Rates test gaps 1-10 (10 = critical, must add)
- Trigger: "Check if the tests are thorough" or use Task tool
Ralph Loop Integration
TDD = Ralph iteration: test → implement → pytest → iterate until <promise>TESTS PASS</promise>.
See @smith-ralph/SKILL.md for full patterns.
@smith-python/SKILL.md- Python testing patterns (pytest functions)@smith-playwright/SKILL.md- Playwright failure monitoring@smith-dev/SKILL.md- Development workflow (quality gates)- @smith-principles/SKILL.md - Core principles
ACTION (Recency Zone)
Run tests (use project's virtual env runner):
VENV_RUNNER pytest tests/unit/ -v
VENV_RUNNER pytest tests/integration/ -v
VENV_RUNNER = poetry run, uv run, etc. — check project CLAUDE.md or pyproject.toml.
Success criteria:
- All new functionality has tests
- Test names follow project conventions
- Tests are isolated and deterministic
- No regressions in existing tests
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
smith-style
File naming, path standards, and conventional commits. Use when naming files, creating branches, writing commit messages, or setting up new projects. Covers underscore vs hyphen conventions, commit format, and branch naming patterns.
smith-stacks
Stacked pull request workflows for large features. Use when creating stacked PRs, managing dependent PRs, or rebasing after parent merges. Covers stack creation, merge order, and squash merge handling.
smith-python
Python development with uv, pytest, ruff, and type hints. Use when writing Python code, running tests, managing Python packages, or working with virtual environments. Covers import organization, type hints, pytest patterns, and environment variables.
smith-principles
Fundamental coding principles (DRY, KISS, YAGNI, SOLID, HHH). Use when starting any development task, evaluating implementation approaches, or reviewing code quality. Always active as foundation for all development decisions.
smith-nuxt
Nuxt 3 development patterns including auto-import stubbing for tests, environment variable conventions, and middleware testing. Use when working with Nuxt projects, testing Nuxt components/middleware, or configuring Nuxt environment variables.
smith-plan
Plan tracking protocol (portable). Progress tracking with checkboxes, iteration workflow, completion/blocker signals. Use when executing multi-step plans, tracking task progress, or working from plan files. IMPORTANT - Always update the plan file after completing tasks.
Didn't find tool you were looking for?