TE

testing-best-practices

Sets standards for unit, integration, and E2E testing to ensure code reliability.

Install

mkdir -p .claude/skills/testing-best-practices && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13812" && unzip -o skill.zip -d .claude/skills/testing-best-practices && rm skill.zip

Installs to .claude/skills/testing-best-practices

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Guidelines for implementing effective and maintainable tests.
61 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Implement E2E tests with stub and implementation stages
  • Cover edge cases, error handling, and specific algorithms with unit tests
  • Run the full test suite before submission for regression testing
  • Ensure database state is reset between tests for isolation
  • Organize test files to mirror source structure
  • Use templates for new test files

How it works

The skill provides guidelines for implementing tests, including hierarchy, critical rules like isolation and realism, and naming conventions. It emphasizes E2E, unit, and regression testing.

Inputs & outputs

You give it
Codebase or task requiring testing
You get back
Implemented tests following best practices

When to use testing-best-practices

  • Implementing unit tests
  • Scaffolding test files
  • Improving test coverage

About this skill

Testing Best Practices

1. Hierarchy & Strategy

  • E2E (End-to-End): Mandatory for every task.
    • Stub Stage: Assert hardcoded values (verify structure).
    • Impl Stage: Assert real logic (verify behavior).
  • Unit: Cover edge cases, error handling, and specific algorithms.
  • Regression: ALWAYS run the full test suite before submitting.

2. Critical Rules

  • NO LLM MOCKING in Tests: Do not mock OpenAI/Anthropic calls in standard tests. Use recorded responses (VCR.py) or separate integration environments.
  • Realism: Minimize mocks. Test real component capability where possible.
  • Isolation: Tests must be independent. Database state should be reset between tests.
  • Environment: Use the project's virtual environment (e.g., /opt/projects/.../venv).

3. Naming & Structure

  • Clear Names: test_shoud_return_error_when_invalid_input.
  • Organization: Mirror source structure (src/auth -> tests/auth).
  • Docstrings: specificy WHAT is being tested.
  • Reference Examples:
    • Python: examples/pytest_structure.py
    • JavaScript: examples/jest_structure.js

4. Resources

  • Templates: Use assets/templates/test_boilerplate.py to start new test files quickly.

When not to use it

  • When mocking OpenAI/Anthropic calls in standard tests
  • When tests are not independent
  • When not using the project's virtual environment

Limitations

  • The skill prohibits LLM mocking in standard tests
  • Tests must be independent and reset database state
  • The skill requires using the project's virtual environment

How it compares

This skill mandates specific testing hierarchies, critical rules like no LLM mocking, and structured naming conventions, providing a disciplined approach compared to ad-hoc testing practices.

Compared to similar skills

testing-best-practices side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
testing-best-practices (this skill)06moNo flagsIntermediate
unit-testing-test-generate24moReviewIntermediate
checking-changes15moReviewBeginner
designing-tests16moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry