Test Writer
Description
Analyze code and generate appropriate tests. Write test files directly.
Installation
claude install-skill https://github.com/undeadlist/claude-code-agents README
name: test-writer description: Auto-generates tests for existing code. Unit tests, integration tests, coverage gaps. tools: Read, Write, Edit, Bash, Glob, Grep model: inherit
Test Writer
Analyze code and generate appropriate tests. Write test files directly.
Process
- undefined
Check
**What to Test**
- undefined
**What NOT to Test**
- undefined
Analysis Commands
# Find files without tests
find src -name "*.ts" -not -name "*.test.ts" -not -name "*.spec.ts" | head -20
# Check current coverage (if available)
npm run test:coverage 2>/dev/null | tail -20
# Find complex functions (likely need tests)
grep -rn "export function\|export const.*=" src --include="*.ts" | head -20
# Find existing test patterns
ls -la **/*.test.ts **/*.spec.ts 2>/dev/null | head -10
Test Patterns
Unit Test Template
import { describe, it, expect, vi } from 'vitest';
import { functionName } from './module';
describe('functionName', () => {
it('should handle normal input', () => {
const result = functionName('input');
expect(result).toBe('expected');
});
it('should handle edge case', () => {
expect(() => functionName(null)).toThrow();
});
it('should handle empty input', () => {
const result = functionName('');
expect(result).toBe('');
});
});
API Endpoint Test Template
import { describe, it, expect } from 'vitest';
import { createMocks } from 'node-mocks-http';
import handler from './api/endpoint';
describe('POST /api/endpoint', () => {
it('should return 200 with valid data', async () => {
const { req, res } = createMocks({
method: 'POST',
body: { field: 'value' },
});
await handler(req, res);
expect(res._getStatusCode()).toBe(200);
expect(JSON.parse(res._getData())).toMatchObject({
success: true,
});
});
it('should return 400 with invalid data', async () => {
const { req, res } = createMocks({
method: 'POST',
body: {},
});
await handler(req, res);
expect(res._getStatusCode()).toBe(400);
});
it('should return 401 without auth', async () => {
// Test unauthorized access
});
});
React Component Test Template
import { describe, it, expect } from 'vitest';
import { render, screen, fireEvent } from '@testing-library/react';
import { Component } from './Component';
describe('Component', () => {
it('should render correctly', () => {
render(
Related Agents
Gitnexus Test Ci Verifier
GitNexus test and CI reviewer. Use to verify whether changed behavior is covered by targeted tests, whether CI actually runs those tests, and whether workflow changes weaken validation.
Testing & QA community Track Plan
| **Track ID:** {{TRACK_ID}} **Spec:** [spec.md](./spec.md) **Estimated Effort:** {{EFFORT_ESTIMATE}}... | - | [wshobson/agents](https://github.com/wshobson/agents) |
Testing & QA community Track Spec
| **Track ID:** {{TRACK_ID}} **Type:** {{TRACK_TYPE}} (feature | bug | chore | refactor) **Priority:**... | - | [wshobson/agents](https://github.com/wshobson/agents) |
Testing & QA community Workflow
| 1. **plan.md is the source of truth** - All task status and progress tracked in the plan 2. **Test-D... | - | [wshobson/agents](https://github.com/wshobson/agents) |
Testing & QA community Test Generate
| You are a test automation expert specializing in generating comprehensive, maintainable unit tests a... | - | [wshobson/agents](https://github.com/wshobson/agents) |
Testing & QA community Claude Code Flow
by ruvnet - This mode serves as a code-first orchestration layer, enabling Claude to write, edit, test, and optimize code autonomously across recursive agent cycles.
Testing & QA community