Testing rules: TDD, regression tests, the existing test infrastructure, choosing the test level, edge and error cases, deterministic tests, browsers and screen widths, both states of a feature flag, ported behavior, and generated output. Load when writing tests or code that changes behavior.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Testing?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/the-up-testing)
---
name: testing
description: "Testing rules: TDD, regression tests, the existing test infrastructure, choosing the test level, edge and error cases, deterministic tests, browsers and screen widths, both states of a feature flag, ported behavior, and generated output. Load when writing tests or code that changes behavior."
---
# Testing
- Practice TDD: write a failing test first, then the least code that makes it pass, then refactor. When fixing a bug, the first test is a regression test that reproduces the bug.
- Use the existing unit and e2e test infrastructure; if there's none, or it isn't enough for the change, set it up.
- Choose the test level by the scope and risk of the change; don't repeat coverage across levels unnecessarily.
- Besides the normal flow, test edge cases, error scenarios, and the scenarios in the [Security](../security/SKILL.md) rules.
- Write deterministic tests; don't make them depend on time, execution order, or real external services.
- Test the UI in the browsers the project supports and at least at mobile, tablet, and desktop widths. When a change adds or restyles a form control, measure its font size with a touch screen emulated, as the [UI](../ui/SKILL.md) rules describe.
- Test a flagged feature with its flag on and off, as the [Feature Flags](../feature-flags/SKILL.md) rules describe.
- When you replace a system, pin each behavior you port with a test that names the system it came from.
- Check generated output, such as images or documents, with record-and-replay tests against committed baselines; when you replace the code that produces it, compare the new output with the old one.