Skip to content
Back to skills

Test Patterns

ASecurity

Testing conventions - test design, fixtures, mocking, query priority, async handling, behavior-vs-implementation tests, boundary coverage, and what to skip. Use whenever the project contains a test config file (`vitest.config.*`, `jest.config.*`, `playwright.config.*`, `pytest.ini`, `conftest.py`) or a test directory (`tests/`, `__tests__/`, `spec/`), OR the user asks about tests at any level, mocking, fixtures, coverage, or a failing test, in any stack and even if a framework is not named.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 5, 2026
ai-agentsgoreactdjangotestinggit

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned October 5, 2026

npx -y skills add ku5ic/claude-kit --skill test-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Test Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Test Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ku5ic-test-patterns/badge)](https://www.skillsdirectory.com/skills/ku5ic-test-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: test-patterns
description: Testing conventions - test design, fixtures, mocking, query priority, async handling, behavior-vs-implementation tests, boundary coverage, and what to skip. Use whenever the project contains a test config file (`vitest.config.*`, `jest.config.*`, `playwright.config.*`, `pytest.ini`, `conftest.py`) or a test directory (`tests/`, `__tests__/`, `spec/`), OR the user asks about tests at any level, mocking, fixtures, coverage, or a failing test, in any stack and even if a framework is not named.
---

# Test patterns

Apply the runner-specific reference matching the detected test runner. Principles apply to all stacks.

## Reference files

| File                                                                     | Covers                                                                             |
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------- |
| [reference/anti-patterns.md](reference/anti-patterns.md)                 | Severity-labeled anti-patterns: implementation details, async pitfalls, mock abuse |
| [reference/principles.md](reference/principles.md)                       | Test design principles + Test Pyramid (Fowler) vs Testing Trophy (Dodds)           |
| [reference/vitest-and-jest.md](reference/vitest-and-jest.md)             | Shared Jest / Vitest patterns, runner choice, MSW for HTTP mocking                 |
| [reference/react-testing-library.md](reference/react-testing-library.md) | Query priority, full priority order, `getBy` vs `queryBy` vs `findBy` semantics    |
| [reference/playwright.md](reference/playwright.md)                       | Playwright patterns, page object, property-based testing (fast-check, hypothesis)  |
| [reference/pytest.md](reference/pytest.md)                               | pytest fixtures, parametrize, pytest-django                                        |
| [reference/coverage-and-skip.md](reference/coverage-and-skip.md)         | Coverage discipline, what to skip, output expectations                             |

## References

- Vitest: https://vitest.dev/
- Jest: https://jestjs.io/
- React Testing Library: https://testing-library.com/docs/react-testing-library/intro/
- Testing Library guiding principles: https://testing-library.com/docs/guiding-principles/
- Playwright: https://playwright.dev/
- pytest: https://docs.pytest.org/en/stable/
- pytest-django: https://pytest-django.readthedocs.io/
- Kent C. Dodds (Testing Trophy): https://kentcdodds.com/blog/the-testing-trophy-and-testing-classifications
- Martin Fowler (Test Pyramid): https://martinfowler.com/articles/practical-test-pyramid.html
- MSW: https://mswjs.io/
- fast-check: https://github.com/dubzzz/fast-check
- hypothesis: https://hypothesis.readthedocs.io/en/latest/

## Version notes

Checked: 2026-09-26 against https://pypi.org/project/pytest/ and the migration and release pages listed above

- Vitest 4.x (Context7 /vitest-dev/vitest); the migration guide at vitest.dev lists for the next major: `vi.mock` / `vi.unmock` / `vi.hoisted` must be module-scoped, `clearMocks` defaults to true, automocked modules return `undefined` in browser mode. None of the patterns in `reference/vitest-and-jest.md` depend on the old behavior.
- Jest 30 (2025-06): `--testPathPattern` renamed `--testPathPatterns`; `expect` aliases removed. pytest 9 (2025-11; 9.1.1 current): fixture visibility now decides precedence over registration order; `PytestRemovedIn9Warning` is an error.
- MSW 2: `http` / `HttpResponse` replace `rest` and the `req, res, ctx` signature. Unchanged.

Files in this skill

  • SKILL.md3.6 KB
  • reference/anti-patterns.md2.9 KB
  • reference/coverage-and-skip.md1.1 KB
  • reference/playwright.md2.1 KB
  • reference/principles.md2.3 KB
  • reference/pytest.md799 B
  • reference/react-testing-library.md2.7 KB
  • reference/vitest-and-jest.md2.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.