polyglot-test-agent
Original:🇺🇸 English
Translated
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.
16installs
Sourcegithub/awesome-copilot
Added on
NPX Install
npx skill4agent add github/awesome-copilot polyglot-test-agentTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →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. 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 agent with your test generation request:
polyglot-test-generatorGenerate unit tests for [path or description of what to test], following the [unit-test-generation.prompt.md](unit-test-generation.prompt.md) guidelinesThe Test Generator will manage the entire pipeline automatically.
Step 3: Research Phase (Automatic)
The agent analyzes your codebase to understand:
polyglot-test-researcher- 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.mdStep 4: Planning Phase (Automatic)
The agent creates a structured implementation plan:
polyglot-test-planner- 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.mdStep 5: Implementation Phase (Automatic)
The agent executes each phase sequentially:
polyglot-test-implementer- Read source files to understand the API
- Write test files following project patterns
- Build using the subagent to verify compilation
polyglot-test-builder - Test using the subagent to verify tests pass
polyglot-test-tester - Fix using the subagent if errors occur
polyglot-test-fixer - Lint using the subagent for code formatting
polyglot-test-linter
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 folder:
.testagent/| File | Purpose |
|---|---|
| Codebase analysis results |
| Phased implementation plan |
| Progress tracking (optional) |
Examples
Example 1: Full Project Testing
Generate unit tests for my Calculator project at C:\src\CalculatorExample 2: Specific File Testing
Generate unit tests for src/services/UserService.tsExample 3: Targeted Coverage
Add tests for the authentication module with focus on edge casesAgent Reference
| Agent | Purpose | Tools |
|---|---|---|
| Coordinates pipeline | runCommands, codebase, editFiles, search, runSubagent |
| Analyzes codebase | runCommands, codebase, editFiles, search, fetch, runSubagent |
| Creates test plan | codebase, editFiles, search, runSubagent |
| Writes test files | runCommands, codebase, editFiles, search, runSubagent |
| Compiles code | runCommands, codebase, search |
| Runs tests | runCommands, codebase, search |
| Fixes errors | runCommands, codebase, editFiles, search |
| 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 agent will attempt to resolve compilation errors. Check for the expected test structure.
polyglot-test-fixer.testagent/plan.mdTests 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..."