Claude Skills Guide

Automated Testing Pipeline with Claude TDD Skill

The tdd skill in Claude Code brings test-driven development workflows directly into your AI sessions. This guide walks through building a practical automated testing pipeline using the skill, with real configuration examples and CI/CD integration patterns.

Understanding the TDD Skill

The /tdd skill is a plain Markdown file stored in ~/.claude/skills/tdd.md When you type /tdd in a Claude Code session, Claude loads the skill’s instructions and applies TDD principles to your task—generating test cases, structuring your implementation against those tests, and reviewing coverage.

The skill does not install packages or modify your project configuration It guides Claude’s reasoning process during your session.

To activate it, type in Claude Code:

/tdd

Then describe what you want to build or test. For example:

/tdd
Write tests for a calculateShipping function that takes weight, distance, and an expedited flag.

Claude will generate the test suite first, then help you implement the function to satisfy those tests.

Project Structure for a Testing Pipeline

Organize your project to separate test types:

project/
├── src/
│   └── calculateShipping.js
├── tests/
│   ├── unit/
│   ├── integration/
│   └── e2e/
├── jest.config.js
└── package.json

Configure Jest to handle different test types:

// jest.config.js
module.exports = {
  projects: [
    {
      displayName: 'unit',
      testMatch: ['<rootDir>/tests/unit/**/*.test.js'],
      coverageDirectory: 'coverage/unit',
    },
    {
      displayName: 'integration',
      testMatch: ['<rootDir>/tests/integration/**/*.test.js'],
      testEnvironment: 'node',
    },
  ],
  coverageThreshold: {
    global: {
      lines: 80,
    },
  },
};

Example: Unit Tests Generated with /tdd

Start a Claude Code session, activate the TDD skill, and paste your function:

// src/calculateShipping.js
export function calculateShipping(weight, distance, expedited = false) {
  const baseRate = 0.5;
  const distanceRate = distance * 0.01;
  const weightRate = weight * 0.1;
  const multiplier = expedited ? 2 : 1;
  return (baseRate + distanceRate + weightRate) * multiplier;
}

Claude generates tests covering standard cases, edge cases, and boundary values:

// tests/unit/calculateShipping.test.js
import { calculateShipping } from '../../src/calculateShipping';

describe('calculateShipping', () => {
  it('calculates standard shipping correctly', () => {
    expect(calculateShipping(10, 100)).toBe(2.5);
  });

  it('applies expedited multiplier', () => {
    expect(calculateShipping(10, 100, true)).toBe(5);
  });

  it('handles zero weight', () => {
    expect(calculateShipping(0, 100)).toBe(1.5);
  });

  it('handles zero distance', () => {
    expect(calculateShipping(10, 0)).toBe(1.5);
  });

  it('handles zero weight and zero distance', () => {
    expect(calculateShipping(0, 0)).toBe(0.5);
  });
});

Integration Testing Patterns

For API endpoints, use the /tdd skill to structure integration tests that verify data flow end-to-end:

// tests/integration/user-api.test.js
import { createUser, getUser, deleteUser } from '../../src/api/users';

describe('User API Integration', () => {
  let userId;

  afterEach(async () => {
    if (userId) await deleteUser(userId);
  });

  it('creates and retrieves a user successfully', async () => {
    const user = await createUser({ name: 'Test', email: 'test@example.com' });
    userId = user.id;
    const retrieved = await getUser(user.id);

    expect(retrieved.name).toBe('Test');
    expect(retrieved.email).toBe('test@example.com');
  });

  it('rejects duplicate email on creation', async () => {
    const first = await createUser({ name: 'First', email: 'dup@example.com' });
    userId = first.id;

    await expect(
      createUser({ name: 'Second', email: 'dup@example.com' })
    ).rejects.toThrow('Email already exists');
  });
});

CI/CD Integration

Add your test commands to a GitHub Actions workflow. Note: Claude Code and its skills run locally in developer sessions—they are not invoked from CI. Your CI pipeline runs the standard test commands that the /tdd skill helped you write:

# .github/workflows/test-pipeline.yml
name: Automated Testing Pipeline

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm ci

      - name: Run unit tests with coverage
        run: npm test -- --coverage

      - name: Run integration tests
        run: npx jest --config jest.integration.config.js

      - name: Upload coverage report
        uses: actions/upload-artifact@v4
        with:
          name: coverage
          path: coverage/

Combining /tdd with Other Skills

Pair /tdd with other skills for related tasks in the same session:

Each skill is invoked independently with its slash command; you can use multiple in the same session.

Parallel Test Execution for Large Codebases

Configure separate Jest configs for unit and integration tests to run them in parallel on CI:

// jest.integration.config.js
module.exports = {
  testMatch: ['**/tests/integration/**/*.test.js'],
  maxWorkers: 4,
  setupFilesAfterFramework: ['<rootDir>/tests/setup/integration.js'],
  testTimeout: 30000,
};

Run both in parallel on CI:

- name: Run tests in parallel
  run: |
    npm test &
    npx jest --config jest.integration.config.js &
    wait

Measuring Pipeline Health

Track these metrics over time:

Conclusion

The /tdd skill guides Claude Code to generate meaningful test suites and structure implementations against those tests. The skill itself is a Markdown file that shapes Claude’s behavior during your session. Your CI/CD pipeline then runs the tests your sessions produced using standard test runners like Jest. Combining /tdd with /frontend-design, /supermemory, and /pdf gives you a productive local workflow backed by automated quality checks.


Built by theluckystrike — More at zovo.one