designing-tests — Claude Code skill: testing and installation
designing-tests is a skill for planning test coverage, choosing test types, and investigating failures during test additions or testing-workflow setup.
MIT ★ 1,424 updated 2026-10-06
/plugin marketplace add CloudAI-X/claude-workflow-v2
/plugin install project-starter@claude-workflowWhat designing-tests does
The skill guides testing work from deciding what needs coverage to running checks and fixing failures. It distinguishes unit, integration, and E2E tests, with critical user journeys assigned to E2E checks. Its framework suggestions include Vitest, Jest, and Playwright for JavaScript and TypeScript; pytest and Playwright for Python; and Go’s testing package with supporting tools.
Templates cover unit, integration, and browser tests. The skill also gives guidance on coverage, test-data factories, fixtures, and when to mock external services, databases, time, or random values. Example validation commands include npm test and npm test -- --coverage, plus commands for a single test file and watch mode. The sample Jest configuration sets global thresholds to 80% and src/core/ branch and function thresholds to 95%; Vitest uses test.coverage.thresholds. Treat those figures as configuration examples, not automatic targets for every project.
What it helps with
- choose a test type for a new feature
- cover component interactions and API contracts
- add checks for edge cases and error handling
- set coverage thresholds for Jest or Vitest
- investigate failing or flaky tests
Example prompts for the agent
- Plan tests for a new feature and identify the cases that need coverage.
- Add integration tests for the API, including error handling.
- Investigate the failing tests and suggest commands to check coverage.
How to install designing-tests
1Plugin marketplace
/plugin marketplace add CloudAI-X/claude-workflow-v2/plugin install project-starter@claude-workflowThis installs the whole project-starter plugin with all its skills
2Skills CLI (Vercel)
npx skills add CloudAI-X/claude-workflow-v2 --skill designing-tests -a claude-code3Manually: put the files in place
~/.claude/skills/designing-tests/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/designing-tests/
1Skills CLI (Vercel)
npx skills add CloudAI-X/claude-workflow-v2 --skill designing-tests -a codex2Manually: put the files in place
.agents/skills/designing-tests/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add CloudAI-X/claude-workflow-v2 --skill designing-tests -a cursor2Manually: put the files in place
.cursor/skills/designing-tests/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install CloudAI-X/claude-workflow-v2 skills/designing-tests2Manually: put the files in place
.github/skills/designing-tests/SKILL.md1Skills CLI (Vercel)
npx skills add CloudAI-X/claude-workflow-v2 --skill designing-tests -a gemini-cli2Platform CLI
gemini skills install https://github.com/CloudAI-X/claude-workflow-v2 --path skills/designing-testsManually: put the files in place
.devin/skills/designing-tests/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about designing-tests
How do I install designing-tests in Claude Code?
Add the marketplace with /plugin marketplace add CloudAI-X/claude-workflow-v2, then install the plugin with /plugin install project-starter@claude-workflow.
What does the designing-tests skill do?
It helps select test types, draft checks from templates, assess coverage, and address test failures. Its guidance spans unit, integration, and E2E testing.
Which testing tools does designing-tests recommend?
For JavaScript and TypeScript, it lists Vitest, Jest, and Playwright; for Python, pytest and Playwright; and for Go, testing, testify, httptest, and chromedp.
Source text
SKILL.md · MIT
---
name: designing-tests
description: Designs and implements testing strategies for any codebase. Use when adding tests, improving coverage, setting up testing infrastructure, debugging test failures, or when asked about unit tests, integration tests, or E2E testing.
---
# Designing Tests
### When to Load
- **Trigger**: Adding tests, test strategy planning, improving coverage, setting up testing infrastructure
- **Skip**: Non-test code changes where testing is not part of the task
## Test Implementation Workflow
Copy this checklist and track progress:
```
Test Implementation Progress:
- [ ] Step 1: Identify what to test
- [ ] Step 2: Select appropriate test type
- [ ] Step 3: Write tests following templates
- [ ] Step 4: Run tests and verify passing
- [ ] Step 5: Check coverage meets targets
- [ ] Step 6: Fix any failing tests
```
## Testing Pyramid
Apply the testing pyramid for balanced coverage:
```
/\
/ \ E2E Tests (10%)
/----\ - Critical user journeys
/ \ - Slow but comprehensive
/--------\ Integration Tests (20%)
/ \ - Component interactions
/------------\ - API contracts
/ \ Unit Tests (70%)
/________________\ - Fast, isolated
- Business logic focus
```
## Framework Selection
### JavaScript/TypeScript
| Type | Recommended | Alternative |
| ----------- | --------------- | ------------------- |
| Unit | Vitest | Jest |
| Integration | Vitest + MSW | Jest + SuperTest |
| E2E | Playwright | Cypress |
| Component | Testing Library | Vitest Browser Mode |
### Python
| Type | Recommended | Alternative |
| ----------- | --------------------------- | ----------------- |
| Unit | pytest | unittest |
| Integration | pytest + httpx | pytest + requests |
| E2E | Playwright | Selenium |
| API | pytest + FastAPI TestClient | - |
### Go
| Type | Recommended |
| ----------- | ------------------ |
| Unit | testing + testify |
| Integration | testing + httptest |
| E2E | testing + chromedp |
## Test Structure Templates
### Unit Test
```javascript
describe("[Unit] ComponentName", () => {
describe("methodName", () => {
it("should [expected behavior] when [condition]", () => {
// Arrange
const input = createTestInput();
// Act
const result = methodName(input);
// Assert
expect(result).toEqual(expectedOutput);
});
it("should throw error when [invalid condition]", () => {
expect(() => methodName(invalidInput)).toThrow(ExpectedError);
});
});
});
```
### Integration Test
```javascript
describe("[Integration] API /users", () => {
beforeAll(async () => {
await setupTestDatabase();
});
afterAll(async () => {
await teardownTestDatabase();
});
it("should create user and return 201", async () => {
const response = await request(app)
.post("/users")
.send({ name: "Test", email: "[email protected]" });
expect(response.status).toBe(201);
expect(response.body.id).toBeDefined();
});
});
```
### E2E Test
```javascript
import { test, expect } from "@playwright/test";
test.describe("[E2E] User Registration Flow", () => {
test("should complete registration successfully", async ({ page }) => {
await page.goto("/register");
await page.getByTestId("email").fill("[email protected]");
await page.getByTestId("password").fill("SecurePass123!");
await page.getByTestId("submit").click();
await expect(page.locator(".welcome-message")).toBeVisible();
await expect(page).toHaveURL("/dashboard");
});
});
```
## Coverage Strategy
### What to Cover
- ✅ Business logic (100%)
- ✅ Edge cases and error handling (90%+)
- ✅ API contracts (100%)
- ✅ Critical user paths (E2E)
- ⚠️ UI components (snapshot + interaction)
- ❌ Third-party library internals
- ❌ Simple getters/setters
### Coverage Thresholds
Jest config shown; the Vitest equivalent is `test.coverage.thresholds` in vitest.config.
```json
{
"coverageThreshold": {
"global": {
"branches": 80,
"functions": 80,
"lines": 80,
"statements": 80
},
"src/core/": {
"branches": 95,
"functions": 95
}
}
}
```
## Test Data Management
### Factories/Builders
```javascript
// factories/user.js
export const userFactory = (overrides = {}) => ({
id: faker.string.uuid(),
name: faker.person.fullName(),
email: faker.internet.email(),
createdAt: new Date(),
...overrides,
});
// Usage
const admin = userFactory({ role: "admin" });
```
### Fixtures
```javascript
// fixtures/users.json
{
"validUser": { "name": "Test", "email": "[email protected]" },
"invalidUser": { "name": "", "email": "invalid" }
}
```
## Mocking Strategy
### When to Mock
- ✅ External APIs and services
- ✅ Database in unit tests
- ✅ Time/Date for determinism
- ✅ Random values
- ❌ Internal modules (usually)
- ❌ The code under test
### Mock Examples
```javascript
// API mocking with MSW
import { http, HttpResponse } from "msw";
export const handlers = [
http.get("/api/users", () => {
return HttpResponse.json([{ id: 1, name: "John" }]);
}),
];
// Time mocking
vi.useFakeTimers();
vi.setSystemTime(new Date("2024-01-01"));
```
## Test Validation Loop
After writing tests, run this validation:
```
Test Validation:
- [ ] All tests pass: `npm test`
- [ ] Coverage meets thresholds: `npm test -- --coverage`
- [ ] No flaky tests (run multiple times)
- [ ] Tests are independent (order doesn't matter)
- [ ] Test names clearly describe behavior
```
If any tests fail, fix them before proceeding. If coverage is below target, add more tests for uncovered code paths.
```bash
# Run tests
npm test
# Run with coverage
npm test -- --coverage
# Run specific test file
npm test -- path/to/test.spec.ts
# Run in watch mode during development
npm test -- --watch
```
© CloudAI-X · MIT · CloudAI-X/claude-workflow-v2