Skip to content

Commit 5eceaee

Browse files
AlexPEClubclaude
andcommitted
feat: Add automated testing with Vitest and Playwright
- Install Vitest (integration tests for API routes) and Playwright (E2E tests) - Add vitest.config.ts, playwright.config.ts, src/test/setup.ts - Add test scripts: npm test, npm run test:e2e, npm run test:all - Backend skill: writes integration tests for each API route - QA skill: checks Playwright browser install, runs both suites, writes E2E tests from acceptance criteria as permanent regression suite - Fix all skill frontmatter: remove unsupported context/agent/model/allowed-tools, fix argument-hint to be a quoted string - Fix broken relative paths to docs/production/ in deploy and backend skills - Update README with playwright install step and test script reference Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 0225214 commit 5eceaee

13 files changed

Lines changed: 2226 additions & 179 deletions

File tree

.claude/skills/architecture/SKILL.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
22
name: architecture
33
description: Design PM-friendly technical architecture for features. No code, only high-level design decisions.
4-
argument-hint: [feature-spec-path]
4+
argument-hint: "feature-spec-path"
55
user-invocable: true
6-
allowed-tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion
7-
model: sonnet
86
---
97

108
# Solution Architect

.claude/skills/backend/SKILL.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
---
22
name: backend
33
description: Build APIs, database schemas, and server-side logic with Supabase. Use after frontend is built.
4-
argument-hint: [feature-spec-path]
4+
argument-hint: "feature-spec-path"
55
user-invocable: true
6-
context: fork
7-
agent: Backend Developer
8-
model: opus
96
---
107

118
# Backend Developer
@@ -53,8 +50,17 @@ Use `AskUserQuestion` for:
5350
- Replace any mock data or localStorage with API calls
5451
- Handle loading and error states
5552

56-
### 6. User Review
53+
### 6. Write Integration Tests
54+
For each API route created, write a Vitest integration test in `src/app/api/[route]/[route].test.ts`:
55+
- Test the happy path (valid input → expected response)
56+
- Test validation errors (invalid input → 400 with error message)
57+
- Test authentication (unauthenticated request → 401)
58+
- Test authorization (wrong user → 403)
59+
- Run tests: `npm test`
60+
61+
### 7. User Review
5762
- Walk user through the API endpoints created
63+
- Show test results
5864
- Ask: "Do the APIs work correctly? Any edge cases to test?"
5965

6066
## Context Recovery
@@ -87,8 +93,8 @@ CREATE INDEX idx_tasks_status ON tasks(status);
8793
```
8894

8995
## Production References
90-
- See [database-optimization.md](../../docs/production/database-optimization.md) for query optimization
91-
- See [rate-limiting.md](../../docs/production/rate-limiting.md) for rate limiting setup
96+
- See [database-optimization.md](../../../docs/production/database-optimization.md) for query optimization
97+
- See [rate-limiting.md](../../../docs/production/rate-limiting.md) for rate limiting setup
9298

9399
## Checklist
94100
See [checklist.md](checklist.md) for the full implementation checklist.

.claude/skills/deploy/SKILL.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
22
name: deploy
33
description: Deploy to Vercel with production-ready checks, error tracking, and security headers setup.
4-
argument-hint: [feature-spec-path or "to Vercel"]
4+
argument-hint: "feature-spec-path or 'to Vercel'"
55
user-invocable: true
6-
allowed-tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion
7-
model: sonnet
86
---
97

108
# DevOps Engineer
@@ -55,11 +53,11 @@ Guide the user through:
5553

5654
For first deployment, guide the user through these setup guides:
5755

58-
**Error Tracking (5 min):** See [error-tracking.md](../../docs/production/error-tracking.md)
59-
**Security Headers (copy-paste):** See [security-headers.md](../../docs/production/security-headers.md)
60-
**Performance Check:** See [performance.md](../../docs/production/performance.md)
61-
**Database Optimization:** See [database-optimization.md](../../docs/production/database-optimization.md)
62-
**Rate Limiting (optional):** See [rate-limiting.md](../../docs/production/rate-limiting.md)
56+
**Error Tracking (5 min):** See [error-tracking.md](../../../docs/production/error-tracking.md)
57+
**Security Headers (copy-paste):** See [security-headers.md](../../../docs/production/security-headers.md)
58+
**Performance Check:** See [performance.md](../../../docs/production/performance.md)
59+
**Database Optimization:** See [database-optimization.md](../../../docs/production/database-optimization.md)
60+
**Rate Limiting (optional):** See [rate-limiting.md](../../../docs/production/rate-limiting.md)
6361

6462
### 6. Post-Deployment Bookkeeping
6563
- Update feature spec: Add deployment section with production URL and date

.claude/skills/frontend/SKILL.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
---
22
name: frontend
33
description: Build UI components with React, Next.js, Tailwind CSS, and shadcn/ui. Use after architecture is designed.
4-
argument-hint: [feature-spec-path]
4+
argument-hint: "feature-spec-path"
55
user-invocable: true
6-
context: fork
7-
agent: Frontend Developer
8-
model: opus
96
---
107

118
# Frontend Developer

.claude/skills/help/SKILL.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
22
name: help
33
description: Context-aware guide that tells you where you are in the workflow and what to do next. Use anytime you're unsure.
4-
argument-hint: [optional question]
4+
argument-hint: "optional question"
55
user-invocable: true
6-
allowed-tools: Read, Glob, Grep, Bash
7-
model: opus
86
---
97

108
# Project Help Guide

.claude/skills/qa/SKILL.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
---
22
name: qa
33
description: Test features against acceptance criteria, find bugs, and perform security audit. Use after implementation is done.
4-
argument-hint: [feature-spec-path]
4+
argument-hint: "feature-spec-path"
55
user-invocable: true
6-
context: fork
7-
agent: QA Engineer
8-
model: opus
96
---
107

118
# QA Engineer
@@ -20,6 +17,14 @@ You are an experienced QA Engineer AND Red-Team Pen-Tester. You test features ag
2017
4. Check recent bug fixes: `git log --oneline --grep="fix" -10`
2118
5. Check recently changed files: `git log --name-only -5 --format=""`
2219

20+
### Check Playwright Browser Installation
21+
Run: `npx playwright install --dry-run 2>&1 | head -5`
22+
23+
If browsers are not installed, tell the user:
24+
> "Playwright browsers need to be installed once. I'll do this now — it downloads ~300MB of browser binaries."
25+
> Then run: `npx playwright install chromium`
26+
> This is a one-time setup per machine. After cloning the repo, always run this once before E2E tests.
27+
2328
## Workflow
2429

2530
### 1. Read Feature Spec
@@ -51,11 +56,27 @@ Verify existing features still work:
5156
- Test core flows of related features
5257
- Verify no visual regressions on shared components
5358

54-
### 5. Document Results
59+
### 5. Run Automated Tests
60+
Run existing test suites before manual testing:
61+
```bash
62+
npm test # Vitest: integration tests for API routes
63+
npm run test:e2e # Playwright: E2E tests from previous QA runs
64+
```
65+
Note any failures — these are regressions and must be treated as High bugs.
66+
67+
### 6. Write E2E Tests
68+
For each acceptance criterion that passed manual testing, write a Playwright test in `tests/PROJ-X-feature-name.spec.ts`:
69+
- One `test()` per acceptance criterion
70+
- Tests describe the user journey in plain language
71+
- Run to confirm all pass: `npm run test:e2e`
72+
73+
These tests become the permanent regression suite for this feature.
74+
75+
### 7. Document Results
5576
- Add QA Test Results section to the feature spec file (NOT a separate file)
5677
- Use the template from [test-template.md](test-template.md)
5778

58-
### 6. User Review
79+
### 8. User Review
5980
Present test results with clear summary:
6081
- Total acceptance criteria: X passed, Y failed
6182
- Bugs found: breakdown by severity

.claude/skills/requirements/SKILL.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
22
name: requirements
33
description: Create detailed feature specifications with user stories, acceptance criteria, and edge cases. Use when starting a new feature or initializing a new project.
4-
argument-hint: [project-description or feature-idea]
4+
argument-hint: "project-description or feature-idea"
55
user-invocable: true
6-
allowed-tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion
7-
model: sonnet
86
---
97

108
# Requirements Engineer

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This template uses [Claude Code](https://docs.anthropic.com/en/docs/claude-code)
1212
git clone https://github.com/YOUR_USERNAME/ai-coding-starter-kit.git my-project
1313
cd my-project
1414
npm install
15+
npx playwright install chromium # one-time: installs browser for E2E tests (~300MB)
1516
```
1617

1718
### 2. (Optional) Supabase Setup
@@ -301,10 +302,13 @@ Standalone guides in `docs/production/`:
301302
## Scripts
302303

303304
```bash
304-
npm run dev # Development server (localhost:3000)
305-
npm run build # Production build
306-
npm run start # Production server
307-
npm run lint # ESLint
305+
npm run dev # Development server (localhost:3000)
306+
npm run build # Production build
307+
npm run start # Production server
308+
npm run lint # ESLint
309+
npm test # Vitest: integration tests for API routes
310+
npm run test:e2e # Playwright: E2E tests for user flows
311+
npm run test:all # Run both test suites
308312
```
309313

310314
---

0 commit comments

Comments
 (0)