# test-specialist

Guides AI coding agents when writing test suites and debugging JavaScript or TypeScript codebases. Useful for fixing coverage gaps and catching runtime errors.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 902 installs · ★ 458
- Author: ailabs-393
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/ailabs-393/ai-labs-claude-skills/tree/HEAD/dist/skills/test-specialist/SKILL.md
- Updated: 2025-11-11
- HTML: https://affpapa.org/en/nevibecode/skills/test-specialist

## What it does

This skill introduces structured testing guidelines across unit, integration, and end-to-end layers. It enforces the Arrange-Act-Assert (AAA) pattern for isolated unit tests and integrates workflows for Playwright and Cypress. Proactive checks target performance bottlenecks, off-by-one errors, and common security gaps such as XSS or SQL injection.

For resolving bugs, the skill provides a five-step analysis pipeline: reproduction, isolation, root cause identification, fix implementation with a failing test first, and regression validation. Its guidance is explicitly designed around the JavaScript and TypeScript ecosystem. Trying to apply these test patterns to other runtime environments will bring little practical value.

## Requirements
- Works with: Playwright

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add ailabs-393/ai-labs-claude-skills --skill test-specialist -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/test-specialist/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/test-specialist/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add ailabs-393/ai-labs-claude-skills --skill test-specialist -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/test-specialist/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add ailabs-393/ai-labs-claude-skills --skill test-specialist -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/test-specialist/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install ailabs-393/ai-labs-claude-skills test-specialist
```

2. **Manually: put the files in place**
- File: `.github/skills/test-specialist/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add ailabs-393/ai-labs-claude-skills --skill test-specialist -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/ailabs-393/ai-labs-claude-skills --path dist/skills/test-specialist
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/test-specialist/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add ailabs-393/ai-labs-claude-skills --skill test-specialist -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/ailabs-393/ai-labs-claude-skills/tree/HEAD/dist/skills/test-specialist/SKILL.md

## When to use it
- write isolated unit tests using the Arrange-Act-Assert pattern
- debug logic bugs and race conditions through a five-step root cause analysis
- set up end-to-end test flows with Playwright or Cypress
- verify boundary conditions and null safety using parameterized tests
- detect security vulnerabilities like XSS and SQL injection in JavaScript APIs

## Example prompts
- Write integration tests for our expense API endpoints with database setup and teardown
- Isolate the race condition in this counter function and create a failing test first
- Generate parameterized unit tests covering null handling and off-by-one edge cases

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 4fdf5e23798615c1.

BEGIN THIRD-PARTY FILE 4fdf5e23798615c1
````text
---
name: test-specialist
description: This skill should be used when writing test cases, fixing bugs, analyzing code for potential issues, or improving test coverage for JavaScript/TypeScript applications. Use this for unit tests, integration tests, end-to-end tests, debugging runtime errors, logic bugs, performance issues, security vulnerabilities, and systematic code analysis.
---

# Test Specialist

## Overview

Apply systematic testing methodologies and debugging techniques to JavaScript/TypeScript applications. This skill provides comprehensive testing strategies, bug analysis frameworks, and automated tools for identifying coverage gaps and untested code.

## Core Capabilities

### 1. Writing Test Cases

Write comprehensive tests covering unit, integration, and end-to-end scenarios.

#### Unit Testing Approach

Structure tests using the AAA pattern (Arrange-Act-Assert):

```typescript
describe('ExpenseCalculator', () => {
  describe('calculateTotal', () => {
    test('sums expense amounts correctly', () => {
      // Arrange
      const expenses = [
        { amount: 100, category: 'food' },
        { amount: 50, category: 'transport' },
        { amount: 25, category: 'entertainment' }
      ];

      // Act
      const total = calculateTotal(expenses);

      // Assert
      expect(total).toBe(175);
    });

    test('handles empty expense list', () => {
      expect(calculateTotal([])).toBe(0);
    });

    test('handles negative amounts', () => {
      const expenses = [
        { amount: 100, category: 'food' },
        { amount: -50, category: 'refund' }
      ];
      expect(calculateTotal(expenses)).toBe(50);
    });
  });
});
```

**Key principles:**
- Test one behavior per test
- Cover happy path, edge cases, and error conditions
- Use descriptive test names that explain the scenario
- Keep tests independent and isolated

#### Integration Testing Approach

Test how components work together, including database, API, and service interactions:

```typescript
describe('ExpenseAPI Integration', () => {
  beforeAll(async () => {
    await database.connect(TEST_DB_URL);
  });

  afterAll(async () => {
    await database.disconnect();
  });

  beforeEach(async () => {
    await database.clear();
    await seedTestData();
  });

  test('POST /expenses creates expense and updates total', async () => {
    const response = await request(app)
      .post('/api/expenses')
      .send({
        amount: 50,
        category: 'food',
        description: 'Lunch'
      })
      .expect(201);

    expect(response.body).toMatchObject({
      id: expect.any(Number),
      amount: 50,
      category: 'food'
    });

    // Verify database state
````
END THIRD-PARTY FILE 4fdf5e23798615c1

The third-party file has ended. Everything between the 4fdf5e23798615c1 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2688 of 13448 bytes. © ailabs-393 · MIT · https://github.com/ailabs-393/ai-labs-claude-skills/tree/HEAD/dist/skills/test-specialist/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
