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.zipInstalls 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.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
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
- Python:
4. Resources
- Templates: Use
assets/templates/test_boilerplate.pyto 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.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| testing-best-practices (this skill) | 0 | 6mo | No flags | Intermediate |
| unit-testing-test-generate | 2 | 4mo | Review | Intermediate |
| checking-changes | 1 | 5mo | Review | Beginner |
| designing-tests | 1 | 6mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by MatrixFounder
View all by MatrixFounder →You might also like
unit-testing-test-generate
sickn33
Generate comprehensive, maintainable unit tests across languages with strong coverage and edge case focus.
checking-changes
streamlit
Validates all code changes before committing by running format, lint, type, and unit test checks. Use after making backend (Python) or frontend (TypeScript) changes, before committing or finishing a work session.
designing-tests
CloudAI-X
Designs and implements testing strategies for any codebase. Use when adding tests, improving coverage, setting up testing infrastructure, debugging test failures, or when asked about unit tests, integration tests, or E2E testing.
migrate
alirezarezvani
Migrate from Cypress or Selenium to Playwright. Use when user mentions "cypress", "selenium", "migrate tests", "convert tests", "switch to playwright", "move from cypress", or "replace selenium".
moai-foundation-quality
modu-ai
Enterprise code quality orchestrator with TRUST 5 validation, proactive analysis, and automated best practices enforcement
test-generator
alirezarezvani
Automatically suggest tests for new functions and components. Use when new code is written, functions added, or user mentions testing. Creates test scaffolding with Jest, Vitest, Pytest patterns. Triggers on new functions, components, test requests, testing mentions.