Home
cd ../playbooks
Developer ToolsIntermediate

Test Specialist

Comprehensive JavaScript/TypeScript testing guidance with test writing, bug analysis, coverage analysis, and proactive issue detection.

10 minutes
By AI LabsSource
#testing#jest#playwright#tdd#code-quality#javascript#typescript

Your test coverage is at 30%, bugs keep shipping to production, and nobody on the team enjoys writing tests. This playbook provides comprehensive JS/TS testing guidance — writing effective unit and integration tests, analyzing coverage gaps, and proactively detecting issues before they reach users.

Who it's for: JavaScript developers wanting to improve test quality beyond basic snapshot tests, frontend teams building comprehensive test suites for React components and hooks, Node.js engineers writing integration tests for API endpoints and middleware, tech leads establishing testing standards and coverage requirements for their teams, QA engineers transitioning from manual testing to automated test development

Example

"Add comprehensive tests to our Express API with 30% coverage" → Test specialist pipeline: coverage gap analysis identifying untested critical paths, unit test generation for business logic and utility functions, integration test creation for API endpoints with database mocking, edge case identification for error handling and boundary conditions, and CI configuration for coverage reporting with minimum thresholds

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# Test Specialist

## Your Role
You are my testing specialist for JavaScript/TypeScript projects. Help me write comprehensive tests, analyze bugs, identify coverage gaps, and detect potential issues proactively.

## Core Capabilities

### 1. Test Writing
Write tests using Arrange-Act-Assert pattern:
- Unit tests for individual functions/components
- Integration tests for module interactions
- E2E tests for complete user flows

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

Complete testing guidance for JavaScript/TypeScript projects. Write unit, integration, and E2E tests. Analyze bugs systematically. Identify coverage gaps. Detect potential issues proactively.


Quick Start

Step 1: Navigate to Your Project

cd ~/your-js-project

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ./

Step 3: Start Testing

claude

Then ask: "Help me write tests for the user authentication module"


Testing Approach

Arrange-Act-Assert Pattern

describe('UserService', () => {
  it('should create a new user', async () => {
    // Arrange
    const userData = { email: 'test@example.com', name: 'Test' };

    // Act
    const user = await userService.create(userData);

    // Assert
    expect(user.email).toBe('test@example.com');
  });
});

Testing Types

Type Purpose Tools
Unit Individual functions/components Jest, Vitest
Integration Module interactions Jest, Supertest
E2E Full user flows Playwright, Cypress

Example Prompts

Test Writing

  • "Write unit tests for this function"
  • "Create integration tests for the API endpoints"
  • "Generate E2E tests for the checkout flow"

Bug Analysis

  • "Help me debug this failing test"
  • "Find the root cause of this bug"
  • "This test is flaky - help me fix it"

Coverage

  • "Find untested code in this project"
  • "Which files need more test coverage?"
  • "Prioritize what to test next"

Bug Analysis Process

  1. Reproduce: Confirm the issue exists
  2. Isolate: Find the minimal reproduction case
  3. Root Cause: Identify why it happens
  4. Fix: Implement the solution
  5. Validate: Add tests to prevent regression

Common Bug Patterns

Pattern Symptom Solution
Race Condition Intermittent failures Add proper async handling
Null/Undefined TypeError crashes Add null checks
Off-by-One Wrong counts/indices Review loop boundaries
State Mutation Unexpected side effects Use immutable patterns

Test Coverage Strategy

Priority Order:

  1. Critical business logic
  2. Edge cases and error handling
  3. Happy path flows
  4. Integration points
  5. UI components

Security Testing

Include tests for:

  • SQL injection prevention
  • XSS sanitization
  • Authentication bypasses
  • Authorization checks

Tips

  • One behavior per test: Keep tests focused
  • Test the interface: Not the implementation
  • Independent tests: No order dependencies
  • Clear naming: Test name should explain what and why

$Related Playbooks

Developer Tools

Accessibility Engineering for Components

Build accessible UI components at the code level, not just the audit level — 14 concrete engineering principles (focus-visible over bare :focus, roving tabindex for composite widgets, inert-based modal focus trapping, WCAG 2.5.8 hit-area minimums), a common-mistakes table with fixes, and a severity-rated review format ending in a hard Block/Needs-changes/Approve verdict.

5 minutes
Intermediate
Developer Tools

Adversary Emulation: MuddyWater

An intelligence-grounded, authorized purple-team emulation profile for MuddyWater (MITRE ATT&CK G0069), Iran's MOIS-linked cyber-espionage group — attribution, targeting, representative TTPs by ATT&CK tactic, emulation guidance mapped to generic red-team tooling, and paired detection/defense recommendations for every offensive technique, all under an explicit authorized-use caveat.

15 minutes
Advanced
Developer Tools

Adversary Emulation: Turla

An intelligence-grounded, authorized purple-team emulation profile for Turla (MITRE ATT&CK G0010), Russia's FSB-linked espionage group — attribution, distinctive TTPs (satellite C2 hijacking, steganographic email backdoors, parasitizing rival APT infrastructure), emulation guidance mapped to generic red-team tooling, and paired detection recommendations, under an explicit authorized-use and lab-only caveat for rootkit techniques.

15 minutes
Advanced
Developer Tools

AI Agent Red Team Methodology

A first-principles methodology for authorized red-team exercises against AI products, agents, MCP servers, skills, and repositories — capability and trust-boundary modeling, AI-specific attack hypothesis families (prompt injection, tool misuse, data leakage, SSRF), harmless-proof testing with canaries, one-variable-at-a-time adaptive iteration, and business-language evidence-based reporting.

10 minutes
Advanced
Developer Tools

Datadog Error Triage to PR

Take Datadog Error Tracking issues from raw occurrence counts to a reviewable, tested PR — a five-class bug taxonomy that filters out infra noise and deploy-skew before ranking, a recency premium that catches fresh regressions early, a mandatory approval gate before any fix is written, and a test-first fix workflow that generalizes past the one reported occurrence.

10 minutes
Advanced
Developer Tools

Agent DX CLI Scale

A 7-axis, 0-21 scoring scale for evaluating how well a CLI is designed for AI agents rather than humans — machine-readable output, raw payload input, schema introspection, context-window discipline, input hardening, safety rails, and agent knowledge packaging.

5 minutes
Intermediate
Developer Tools

Agent Design Philosophy

A mental model for designing AI agents in any domain — the model already knows how to be an agent, so design is about capabilities, knowledge, and context, added only as far as a Progressive Complexity ladder (basic → planning → subagents → skills) that real usage actually demands.

10 minutes
Intermediate
Developer Tools

Agent Prompt Architect

A compact seven-field skeleton (Role, Goal, Inputs, Constraints, Process, Output, Verification, Fallback) and a fast refinement loop for turning vague intent into a prompt an agent can execute reliably every time.

5 minutes
Beginner
Developer Tools

Agent SDK App Builder

Scaffold new Claude Agent SDK applications in TypeScript or Python, and verify existing ones against official SDK patterns before you ship.

10 minutes
Intermediate
Developer Tools

Brandkit Generator: Premium Identity Board Creator

An image-direction rule set that produces a complete brand-guidelines board in one image: logo concept, color system, typography, and applications, grounded in brand strategy instead of random logo generation

5 minutes
Beginner
Developer Tools

Brutalist UI Skill: Industrial & Tactical Interface Design

A design language that forces Claude to build raw, mechanical interfaces — Swiss industrial print or CRT terminal telemetry, with rigid grids and zero rounded corners

5 minutes
Intermediate
Developer Tools

Programmatic Screen Capture

Capture screenshots programmatically on macOS — find window IDs, control application windows via AppleScript, and capture specific windows for documentation and visual workflows.

10 minutes
Intermediate

Browse all Developer Tools playbooks →