# testing-best-practices

testing-best-practices — a skill that teaches the agent to pick the right test type (Playwright, integration, or unit) and run it against an isolated Neon branch that auto-deletes after an hour.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 113 installs · ★ 23 repo stars
- Author: andrelandgraf
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/andrelandgraf/fullstackrecipes/tree/HEAD/skills/testing-best-practices/SKILL.md
- Updated: 2026-06-08
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/andrelandgraf-testing-best-practices

## What it does

The skill defines three tiers: Playwright for UI flows and forms, integration tests for API responses and database state, unit for pure functions. Each suite runs in parallel against a separate Neon schema — the branch lives for an hour, data stays isolated.

It includes code examples for each type: how to call a route handler directly in an integration test, how to generate an email with `uuid` for data isolation, where to store files (unit co-located with the module, others under `tests/`). For Playwright, there are `--headed` and `--debug` flags; failed run screenshots land in `test-results/`.

Requires Playwright, Bun, and Neon CLI already set up — the skill assumes three setup recipes from the same repository. Without them, commands like `bun run test:playwright` and branch access will not work.

## Requirements
- Works with: Playwright

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add andrelandgraf/fullstackrecipes --skill testing-best-practices -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/testing-best-practices/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/testing-best-practices/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add andrelandgraf/fullstackrecipes --skill testing-best-practices -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/testing-best-practices/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add andrelandgraf/fullstackrecipes --skill testing-best-practices -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/testing-best-practices/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install andrelandgraf/fullstackrecipes skills/testing-best-practices
```

2. **Manually: put the files in place**
- File: `.github/skills/testing-best-practices/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add andrelandgraf/fullstackrecipes --skill testing-best-practices -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/andrelandgraf/fullstackrecipes --path skills/testing-best-practices
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/testing-best-practices/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add andrelandgraf/fullstackrecipes --skill testing-best-practices -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/andrelandgraf/fullstackrecipes/tree/HEAD/skills/testing-best-practices/SKILL.md

## When to use it
- pick the right test tier: browser, integration, or unit
- run tests against a temporary database schema
- isolate data between parallel suites
- debug Playwright failures using screenshots and traces
- write an integration test without making an HTTP call

## Example prompts
- Write a Playwright test for the registration form that checks redirect after successful submit
- Add an integration test for `GET /api/users`, call the handler directly and verify status 200
- Run unit tests only via `bun run test:unit`

## Similar
- [testing](https://affpapa.org/en/nevibecode/rules/sangrokjung-testing.md) — rule · ★ 880 repo stars
- [testing-craft](https://affpapa.org/en/nevibecode/skills/testing-craft.md) — skill · 1200 installs
- [testing-expert](https://affpapa.org/en/nevibecode/skills/testing-expert.md) — skill · 206 installs
- [om-integration-tests](https://affpapa.org/en/nevibecode/skills/om-integration-tests.md) — skill · 3800 installs
- [clerk-testing](https://affpapa.org/en/nevibecode/skills/clerk-testing.md) — skill · 48900 installs
- [e2e-testing-patterns](https://affpapa.org/en/nevibecode/skills/e2e-testing-patterns.md) — skill · 24343 installs

## Other versions with the same name
- [testing-best-practices · asyrafhussin](https://affpapa.org/en/nevibecode/skills/testing-best-practices.md) — 975 installs

From the same set: [andrelandgraf/fullstackrecipes](https://affpapa.org/en/nevibecode/by/andrelandgraf/fullstackrecipes.md) — 9 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
