# Test Generation

Use when the user asks for tests, mentions TDD, or when new code has been written and...

- Repository: https://github.com/darrenhinde/OpenAgentsControl (4967 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-10-26
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add darrenhinde/OpenAgentsControl --skill test-generation -g -a claude-code -y`
Codex: `npx skills add darrenhinde/OpenAgentsControl --skill test-generation -g -a codex -y`
Cursor: `npx skills add darrenhinde/OpenAgentsControl --skill test-generation -g -a cursor -y`
Gemini CLI: `npx skills add darrenhinde/OpenAgentsControl --skill test-generation -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add darrenhinde/OpenAgentsControl`

## Description

Use when the user asks for tests, mentions TDD, or when new code has been written and needs test coverage.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Test Generation

## Overview
Generate comprehensive tests following TDD principles and project testing standards. Runs in isolated test-engineer context with pre-loaded testing conventions.

**Announce at start:** "I'm using the test-generation skill to create tests for [feature/component]."

## The Process

### Step 1: Specify Test Requirements

Provide clear requirements to test-engineer:

```markdown
/test-generation

Feature: JWT token validation middleware

Behaviors:
1. Valid token → allow request
2. Expired token → reject with 401
3. Invalid signature → reject with 401
4. Missing token → reject with 401

Coverage: All critical paths

Testing Standards (pre-loaded):
- Framework: vitest
- Mocks: vi.mock()
- Structure: AAA pattern
```

### Step 2: Review Test Plan

Test-engineer proposes a test plan:

```markdown
## Test Plan

Behaviors:
1. Valid token
   - ✅ Positive: Allow request with valid JWT
   - ❌ Negative: Reject malformed JWT
2. Expired token
   - ✅ Positive: Normal token works
   - ❌ Negative: Expired token rejected with 401

Mocking Strategy:
- JWT verification: Mock with vi.mock()
- Request/Response: Use test doubles

Coverage Target: 95% line coverage, all critical paths
```

**IMPORTANT**: Review and approve before implementation proceeds.

### Step 3: Implement Tests

Test-engineer implements following AAA pattern (Arrange-Act-Assert):

```typescript
describe('JWT Middleware', () => {
  it('allows request with valid token', () => {
    // Arrange
    const req = mockRequest({ headers: { authorization: 'Bearer valid.jwt.token' } });
    
    // Act
    const result = jwtMiddleware(req);
    
    // Assert
    expect(result.authorized).toBe(true);
  });
});
```

### Step 4: Run Self-Review

Test-engineer verifies:
- ✅ Positive AND negative tests for each behavior
- ✅ AAA pattern followed
- ✅ All external dependencies mocked
- ✅ Tests are deterministic (no flakiness)
- ✅ Standards compliance

### Step 5: Run Tests

The rest: https://github.com/darrenhinde/OpenAgentsControl/blob/HEAD/plugins/claude-code/skills/test-generation/SKILL.md
