Sub-Agent Test Generator Command banner
derek-opdee derek-opdee

Sub-Agent Test Generator Command

Testing & QA community intermediate

Description

Generates comprehensive test suites by analyzing code patterns, identifying untested paths, and creating meaningful test cases using multiple specialized agents.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

Repository README

This is the README for derek-codebridge/subagent-example-script, shared by 8 entries in this directory. It describes the repository, not this entry specifically.

Sub-Agent Test Generator Command

Generates comprehensive test suites by analyzing code patterns, identifying untested paths, and creating meaningful test cases using multiple specialized agents.

Command Syntax

sub-agent-test-generator [target] [options]

# Aliases
@test-gen [target] [options]
@test-generator [target] [options]
@satg [target] [options]

Parameters

  • target - Files or directories to generate tests for
  • --coverage-target - Target coverage percentage (default: 80)
  • --type - Test types (unit, integration, e2e, all)
  • --framework - Test framework (jest, phpunit, playwright, cypress)
  • --only-untested - Only generate for untested code
  • --from-flows - Generate from user flow analysis
  • --mock-strategy - Mocking approach (minimal, realistic, full)
  • --assertions - Assertion style (expect, should, assert)
  • --update-existing - Update existing tests
  • --edge-cases - Include edge case testing

Examples

# Generate missing unit tests
@test-gen src/services/ --only-untested

# Generate tests with 90% coverage target
@test-gen src/ --coverage-target 90 --type unit

# Generate E2E tests from user flows
@test-gen --type e2e --from-flows src/features/

# Update existing tests with edge cases
@test-gen src/utils/ --update-existing --edge-cases

Agent Orchestration

Stage 1: Analysis Agents (Parallel)

Agent 1: Coverage Analyzer

Analyze test coverage in [TARGET]

Tasks:
1. Coverage Metrics:
   - Line coverage
   - Branch coverage
   - Function coverage
   - Statement coverage
   - Path coverage

2. Untested Code:
   - Functions without tests
   - Uncovered branches
   - Error paths not tested
   - Edge cases missing
   - Integration gaps

3. Test Quality:
   - Assertion density
   - Mock coverage
   - Test isolation
   - Setup/teardown patterns
   - Test naming

4. Critical Paths:
   - Business logic coverage
   - Error handling coverage
   - Security function coverage
   - Data validation coverage
   - API endpoint coverage

Return:
- Coverage report by file
- Untested functions list
- Critical gap analysis
- Test quality metrics
- Priority test targets

Agent 2: Code Path Analyzer

Analyze code paths and behaviors in [TARGET]

Tasks:
1. Function Analysis:
   - Input parameters
   - Return values
   - Side effects
   - Dependencies
   - Error conditions

2. Branch Analysis:
   - Conditional branches
   - Loop variations
   - Switch cases
   - Try-catch blocks
   - Early returns

3. State Analysis:
   - State mutations
   - Class properties
   - Global state usage
   - Context dependencies
   - Lifecycle methods

4. Integration Points:
   - API calls
   - Database queries
   - File operations
   - External services
   - Event emissions

Return:
- Function behavior map
- Branch conditions
- State dependencies
- Integration points
- Test scenarios needed

Agent 3: Pattern Recognizer

Identify testing patterns and conventions in [TARGET]

Tasks:
1. Exi