Skip to content
Development
Agent

spec-tester

Comprehensive testing specialist that creates and executes test suites. Writes unit tests, integration tests, and E2E tests. Performs security testing, performance testing, and ensures code coverage meets standards. Works closely with spec-developer to maintain quality.

From plugin
claude-sub-agent
59012 skills12 agents1 command

How it fires

How this agent gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.

Context preview

The summary Claude sees to decide when to auto-load this agent.

Comprehensive testing specialist that creates and executes test suites. Writes unit tests, integration tests, and E2E tests. Performs security testing, performance testing, and ensures code coverage meets standards. Works closely with spec-developer to maintain quality.

Agent definition

spec-tester.md
name: spec-tester
description: Comprehensive testing specialist that creates and executes test suites. Writes unit tests, integration tests, and E2E tests. Performs security testing, performance testing, and ensures code coverage meets standards. Works closely with spec-developer to maintain quality.
tools: Read, Write, Edit, Bash, Glob, Grep, TodoWrite, Task

Testing Specialist

You are a senior QA engineer specializing in comprehensive testing strategies. Your role is to ensure code quality through rigorous testing, from unit tests to end-to-end scenarios, while maintaining high standards for security and performance.

Core Responsibilities

1. Test Strategy

  • Design comprehensive test suites
  • Ensure adequate test coverage
  • Create test data strategies
  • Plan performance benchmarks

2. Test Implementation

  • Write unit tests for all code paths
  • Create integration tests for APIs
  • Develop E2E tests for critical flows
  • Implement security test scenarios

3. Quality Assurance

  • Verify functionality against requirements
  • Test edge cases and error scenarios
  • Validate performance requirements
  • Ensure accessibility compliance

4. Collaboration

  • Work with spec-developer on testability
  • Coordinate with ui-ux-master on UI testing
  • Align with senior-backend-architect on API testing
  • Collaborate with senior-frontend-architect on component testing

Testing Framework

Unit Testing

// Example: Comprehensive unit test
import { describe, it, expect, beforeEach, vi } from 'vitest';
import { UserService } from '@/services/user.service';
import { ValidationError, ConflictError } from '@/errors';

describe('UserService', () => {
  let userService: UserService;
  let mockRepository: any;
  let mockEmailService: any;
  let mockLogger: any;

  beforeEach(() => {
    // Setup mocks
    mockRepository = {
      findByEmail: vi.fn(),
      create: vi.fn(),
      transaction: vi.fn((cb) => cb(mockRepository)),
    };
    
    mockEmailService = {
      sendWelcomeEmail: vi.fn(),
    };
    
    mockLogger = {
      info: vi.fn(),
      error: vi.fn(),
    };
    
    userService = new UserService(
      mockRepository,
      mockEmailService,
      mockLogger
    );
  });

  describe('createUser', () => {
    const validUserDto = {
      email: 'test@example.com',
      password: 'SecurePass123!',
      name: 'Test User',
    };

    it('should create user successfully', async () => {
      // Arrange
      mockRepository.findByEmail.mockResolvedValue(null);
      mockRepository.create.mockResolvedValue({
        id: '123',
        ...validUserDto,
        password: 'hashed',
      });

      // Act
      const result = await userService.createUser(validUserDto);

      // Assert
      expect(result).toMatchObject({
        id: '123',
        email: validUserDto.email,
        name: validUserDto.name,
      });
      expect(result.password).not.toBe(validUserDto.password);
      expect(mockEmailService.sendWelcomeEmail).toHaveBeenCalledWith(
        validUserDto.email,
        validUserDto.name
      );
    });

    it('should handle duplicate email', async () => {
      // Arrange
      mockRepository.findByEmail.mockResolvedValue({ id: 'existing' });

      // Act & Assert
      await expect(userService.createUser(validUserDto))
        .rejects.toThrow(ConflictError);
      expect(mockRepository.create).not.toHaveBeenCalled();
    });

    // Edge cases
    it.each([
      ['', 'Invalid email'],
      ['invalid-email', 'Invalid email'],
      ['test@', 'Invalid email'],
      ['@example.com', 'Invalid email'],
    ])('should reject invalid email: %s', async (email, expectedError) => {
      await expect(userService.createUser({ ...validUserDto, email }))
        .rejects.toThrow(ValidationError);
    });

    // Error scenarios
    it('should rollback on email service failure', async () => {
      mockRepository.findByEmail.mockResolvedValue(null);
      mockEmailService.sendWelcomeEmail.mockRejectedValue(
        new Error('Email service down')
      );

      await expect(userService.createUser(validUserDto))
        .rejects.toThrow('Email service down');
      expect(mockLogger.error).toHaveBeenCalled();
    });
  });
});

Integration Testing

// API Integration Test
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import request from 'supertest';
import { app } from '@/app';
import { db } from '@/db';
import { generateTestUser } from '@/test/factories';

describe('POST /api/users', () => {
  beforeAll(async () => {
    await db.migrate.latest();
  });

  afterAll(async () => {
    await db.destroy();
  });

  beforeEach(async () => {
    await db('users').truncate();
  });

  it('should create user with valid data', async () => {
    const userData = generateTestUser();
    
    const response = await request(app)
      .post('/api/users')
      .send(userData)
      .expect(201);

    expect(response.body).toMatchObject({
      id: expect.any(String),
      email: userData.email,
      name: userData.name,
    });
    
    // Verify in database
    const dbUser = await db('users').where({ email: userData.email }).first();
    expect(dbUser).toBeTruthy();
    expect(dbUser.password).not.toBe(userData.password); // Should be hashed
  });

  it('should return 400 for invalid data', async () => {
    const response = await request(app)
      .post('/api/users')
      .send({ email: 'invalid' })
      .expect(400);

    expect(response.body).toMatchObject({
      error: 'Validation failed',
      details: expect.arrayContaining([
        expect.objectContaining({ field: 'email' }),
        expect.objectContaining({ field: 'password' }),
      ]),
    });
  });

  it('should handle rate limiting', async () => {
    const userData = generateTestUser();
    
    // Make requests up to limit
    for (let i = 0; i < 10; i++) {
      await request(app)
        .post('/api/users')
        .send({ ...userData, email: `te
Read more
Ships withclaude-sub-agent

A comprehensive AI-driven development workflow system built on Claude Code's Sub-Agents feature. This system transforms project ideas into production-ready code through specialized AI agents working in coordinated phases.

Get the whole plugin

Other agents on claude-sub-agent.