Skill
test
Write or run tests. Use when implementing new tests, fixing broken tests, or running the test suite.
From saas-toolkitInstall
1
Run in your terminal$
npx claudepluginhub mickaelmamani/saas-toolkit --plugin saas-toolkitTool Access
This skill is limited to using the following tools:
ReadWriteEditGrepGlobBash(npx vitest*, npx playwright*)Task
Skill Content
/test — Testing Workflows
Write, run, and analyze tests for SaaS applications using Vitest and Playwright.
Modes
Specify which mode when invoking:
/test write— Write tests for specified files/features/test run— Run existing tests/test coverage— Run tests with coverage analysis
Mode: Write Tests
- Identify what to test — Read the source file(s) and understand the behavior
- Check existing tests — Look for existing test patterns in the project
- Write tests following these patterns:
Server Actions:
import { describe, it, expect, vi } from 'vitest';
// Mock Supabase
vi.mock('@/lib/supabase/server', () => ({
createClient: vi.fn(() => mockSupabaseClient),
}));
describe('createProject', () => {
it('creates a project for authenticated user', async () => {
// Arrange: set up mocks
// Act: call the server action
// Assert: verify behavior
});
it('redirects to login if not authenticated', async () => { ... });
it('returns error for invalid input', async () => { ... });
});
API Routes (webhook handlers):
describe('POST /api/webhooks/stripe', () => {
it('verifies webhook signature', async () => { ... });
it('handles checkout.session.completed', async () => { ... });
it('returns 400 for invalid signature', async () => { ... });
});
React Components:
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
describe('PricingCard', () => {
it('renders plan name and price', () => { ... });
it('calls checkout on button click', async () => { ... });
it('shows current plan badge for active subscription', () => { ... });
});
Stripe integration tests:
- Use Stripe test mode keys
- Mock
stripe.webhooks.constructEventfor webhook tests - Test subscription gating logic with different subscription states
Mode: Run Tests
# Run all unit/integration tests
npx vitest run
# Run specific test file
npx vitest run path/to/test.ts
# Run tests matching pattern
npx vitest run -t "pattern"
# Run E2E tests
npx playwright test
# Run specific E2E test
npx playwright test path/to/test.ts
Report results to the user with pass/fail summary and any error details.
Mode: Coverage
npx vitest run --coverage
Analyze coverage output and report:
- Overall coverage percentage
- Files with lowest coverage
- Untested critical paths (auth, billing, data access)
- Recommendations for where to add tests
Test File Naming
- Unit/integration:
*.test.tsor*.test.tsxnext to source file - E2E:
e2e/*.spec.ts
Rules
- Only run tests with
npx vitestornpx playwright— no other bash commands - Follow existing test patterns in the project
- Test behavior, not implementation details
- Keep tests independent — no shared mutable state
- Use descriptive test names:
it('redirects to login when not authenticated') - Launch the testing-specialist agent for complex test writing tasks
Similar Skills
Stats
Parent Repo Stars0
Parent Repo Forks0
Last CommitFeb 11, 2026