home / skills / github / awesome-copilot / polyglot-test-agent

polyglot-test-agent skill

/skills/polyglot-test-agent

This skill generates comprehensive, runnable unit tests across languages using a multi-agent pipeline, ensuring coverage, compatibility, and project-conformant

npx playbooks add skill github/awesome-copilot --skill polyglot-test-agent

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
7.4 KB
---
name: polyglot-test-agent
description: 'Generates comprehensive, workable unit tests for any programming language using a multi-agent pipeline. Use when asked to generate tests, write unit tests, improve test coverage, add test coverage, create test files, or test a codebase. Supports C#, TypeScript, JavaScript, Python, Go, Rust, Java, and more. Orchestrates research, planning, and implementation phases to produce tests that compile, pass, and follow project conventions.'
---

# Polyglot Test Generation Skill

An AI-powered skill that generates comprehensive, workable unit tests for any programming language using a coordinated multi-agent pipeline.

## When to Use This Skill

Use this skill when you need to:
- Generate unit tests for an entire project or specific files
- Improve test coverage for existing codebases
- Create test files that follow project conventions
- Write tests that actually compile and pass
- Add tests for new features or untested code

## How It Works

This skill coordinates multiple specialized agents in a **Research → Plan → Implement** pipeline:

### Pipeline Overview

```
┌─────────────────────────────────────────────────────────────┐
│                     TEST GENERATOR                          │
│  Coordinates the full pipeline and manages state            │
└─────────────────────┬───────────────────────────────────────┘
                      │
        ┌─────────────┼─────────────┐
        ▼             ▼             ▼
┌───────────┐  ┌───────────┐  ┌───────────────┐
│ RESEARCHER│  │  PLANNER  │  │  IMPLEMENTER  │
│           │  │           │  │               │
│ Analyzes  │  │ Creates   │  │ Writes tests  │
│ codebase  │→ │ phased    │→ │ per phase     │
│           │  │ plan      │  │               │
└───────────┘  └───────────┘  └───────┬───────┘
                                      │
                    ┌─────────┬───────┼───────────┐
                    ▼         ▼       ▼           ▼
              ┌─────────┐ ┌───────┐ ┌───────┐ ┌───────┐
              │ BUILDER │ │TESTER │ │ FIXER │ │LINTER │
              │         │ │       │ │       │ │       │
              │ Compiles│ │ Runs  │ │ Fixes │ │Formats│
              │ code    │ │ tests │ │ errors│ │ code  │
              └─────────┘ └───────┘ └───────┘ └───────┘
```

## Step-by-Step Instructions

### Step 1: Determine the User Request

Make sure you understand what user is asking and for what scope.
When the user does not express strong requirements for test style, coverage goals, or conventions, source the guidelines from [unit-test-generation.prompt.md](unit-test-generation.prompt.md). This prompt provides best practices for discovering conventions, parameterization strategies, coverage goals (aim for 80%), and language-specific patterns.

### Step 2: Invoke the Test Generator

Start by calling the `polyglot-test-generator` agent with your test generation request:

```
Generate unit tests for [path or description of what to test], following the [unit-test-generation.prompt.md](unit-test-generation.prompt.md) guidelines
```

The Test Generator will manage the entire pipeline automatically.

### Step 3: Research Phase (Automatic)

The `polyglot-test-researcher` agent analyzes your codebase to understand:
- **Language & Framework**: Detects C#, TypeScript, Python, Go, Rust, Java, etc.
- **Testing Framework**: Identifies MSTest, xUnit, Jest, pytest, go test, etc.
- **Project Structure**: Maps source files, existing tests, and dependencies
- **Build Commands**: Discovers how to build and test the project

Output: `.testagent/research.md`

### Step 4: Planning Phase (Automatic)

The `polyglot-test-planner` agent creates a structured implementation plan:
- Groups files into logical phases (2-5 phases typical)
- Prioritizes by complexity and dependencies
- Specifies test cases for each file
- Defines success criteria per phase

Output: `.testagent/plan.md`

### Step 5: Implementation Phase (Automatic)

The `polyglot-test-implementer` agent executes each phase sequentially:

1. **Read** source files to understand the API
2. **Write** test files following project patterns
3. **Build** using the `polyglot-test-builder` subagent to verify compilation
4. **Test** using the `polyglot-test-tester` subagent to verify tests pass
5. **Fix** using the `polyglot-test-fixer` subagent if errors occur
6. **Lint** using the `polyglot-test-linter` subagent for code formatting

Each phase completes before the next begins, ensuring incremental progress.

### Coverage Types
- **Happy path**: Valid inputs produce expected outputs
- **Edge cases**: Empty values, boundaries, special characters
- **Error cases**: Invalid inputs, null handling, exceptions

## State Management

All pipeline state is stored in `.testagent/` folder:

| File | Purpose |
|------|---------|
| `.testagent/research.md` | Codebase analysis results |
| `.testagent/plan.md` | Phased implementation plan |
| `.testagent/status.md` | Progress tracking (optional) |

## Examples

### Example 1: Full Project Testing
```
Generate unit tests for my Calculator project at C:\src\Calculator
```

### Example 2: Specific File Testing
```
Generate unit tests for src/services/UserService.ts
```

### Example 3: Targeted Coverage
```
Add tests for the authentication module with focus on edge cases
```

## Agent Reference

| Agent | Purpose | Tools |
|-------|---------|-------|
| `polyglot-test-generator` | Coordinates pipeline | runCommands, codebase, editFiles, search, runSubagent |
| `polyglot-test-researcher` | Analyzes codebase | runCommands, codebase, editFiles, search, fetch, runSubagent |
| `polyglot-test-planner` | Creates test plan | codebase, editFiles, search, runSubagent |
| `polyglot-test-implementer` | Writes test files | runCommands, codebase, editFiles, search, runSubagent |
| `polyglot-test-builder` | Compiles code | runCommands, codebase, search |
| `polyglot-test-tester` | Runs tests | runCommands, codebase, search |
| `polyglot-test-fixer` | Fixes errors | runCommands, codebase, editFiles, search |
| `polyglot-test-linter` | Formats code | runCommands, codebase, search |

## Requirements

- Project must have a build/test system configured
- Testing framework should be installed (or installable)
- VS Code with GitHub Copilot extension

## Troubleshooting

### Tests don't compile
The `polyglot-test-fixer` agent will attempt to resolve compilation errors. Check `.testagent/plan.md` for the expected test structure.

### Tests fail
Review the test output and adjust test expectations. Some tests may require mocking dependencies.

### Wrong testing framework detected
Specify your preferred framework in the initial request: "Generate Jest tests for..."

Overview

This skill generates comprehensive, workable unit tests for projects in many programming languages using a coordinated multi-agent pipeline. It orchestrates research, planning, and implementation phases to produce test files that compile, run, and follow project conventions. Use it to add or improve test coverage across C#, TypeScript, JavaScript, Python, Go, Rust, Java, and more.

How this skill works

The pipeline runs Research → Plan → Implement across specialized agents: a researcher analyzes the codebase and testing framework, a planner creates phased test plans, and an implementer writes tests and verifies them. Subagents build, run, fix, and lint tests so each phase compiles and passes before moving on. State and artifacts are stored in a .testagent folder for traceability and incremental progress.

When to use it

  • Generate unit tests for an entire project or specific files
  • Improve or reach target test coverage (typical goal: ~80%)
  • Create test files that match project conventions and frameworks
  • Add tests for new features, bug fixes, or untested modules
  • Convert manual test ideas into executable, passing unit tests

Best practices

  • Start by specifying scope and preferred testing framework if you have one (e.g., Jest, pytest, xUnit)
  • Aim for phased delivery: prioritize core modules then expand to edge and error cases
  • Include happy-path, edge-case, and error-case tests for each function or module
  • Provide build/test commands or CI details when the project uses custom tooling
  • Review generated tests for domain-specific mocking and external dependency handling

Example use cases

  • Generate Jest unit tests for a TypeScript service folder
  • Add pytest cases for a Python authentication module focused on edge cases
  • Create Go unit tests for a new package and ensure go test passes
  • Increase coverage for a legacy Java project by generating JUnit tests incrementally
  • Produce Rust tests for library functions and run cargo test to validate

FAQ

What languages and frameworks are supported?

The pipeline detects many languages and common frameworks (C#, TypeScript/JavaScript, Python, Go, Rust, Java) and targets frameworks like xUnit, MSTest, Jest, pytest, and go test when present.

What if tests fail to compile or run?

The implementer includes builder, tester, fixer, and linter subagents that attempt to compile, run, and fix issues. You can review .testagent/plan.md and .testagent/research.md for details and provide additional guidance if needed.

How do I control style and conventions?

Specify preferred patterns or frameworks in your initial request. If unspecified, the skill sources conventions from built-in guidelines and adapts to project structure.