microsoft/code-testing-agent
>- Generates and writes new unit tests for any programming language — scaffolds .NET test projects, pytest suites, Vitest/Jest suites, Go test files, and JUnit suites, and configures coverage tooling (coverlet, pytest-cov, @vitest/coverage-v8) as part of test generation. Use when asked to generate tests, generate pytest tests, generate Vitest tests, write unit tests, add tests, improve coverage, comprehensive tests, or scaffold a new test project or suite for an app, service, library, REST API, blueprint, or package — including project-wide, multi-file test generation across services, repositories, routes, and modules. Supports C#/.NET, Python (pytest, Flask/Django), TypeScript/JavaScript (Vitest, Jest, Mocha), Go, Rust, Java (JUnit). Runs a research, planning, and implementation pipeline so tests compile and pass. existing coverage reports (use coverage-analysis or crap-score); MSTest modernization (use writing-mstest-tests).
npx skills add https://github.com/microsoft/testfx --skill code-testing-agent
An AI-powered skill that generates comprehensive, workable unit tests for any programming language using a coordinated multi-agent pipeline.
Use this skill when you need to:
run-tests skill)writing-mstest-tests)This skill coordinates multiple specialized agents in a Research → Plan → Implement pipeline:
┌─────────────────────────────────────────────────────────────┐
│ 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 │
└─────────┘ └───────┘ └───────┘ └───────┘
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.
Start by calling the code-testing-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.
The code-testing-researcher agent analyzes your codebase to understand:
Output: .testagent/research.md
The code-testing-planner agent creates a structured implementation plan:
Output: .testagent/plan.md
The code-testing-implementer agent executes each phase sequentially:
code-testing-builder sub-agent to verify compilationcode-testing-tester sub-agent to verify tests passcode-testing-fixer sub-agent if errors occurcode-testing-linter sub-agent for code formattingEach phase completes before the next begins, ensuring incremental progress.
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) |
The generator picks a strategy based on request scope:
| User Request | Strategy | Why |
|---|---|---|
| "Generate tests for src/services/UserService.ts" | Direct | Single file, small scope — write tests immediately, skip sub-agents |
| "Add unit tests for my billing project" | Single pass | Moderate scope — one Research → Plan → Implement cycle covers it |
| "Achieve 80% coverage across the entire solution" | Iterative | Large scope — multiple R→P→I cycles, each narrowing remaining gaps |
Given a request like *"Generate unit tests for my InvoiceService"*, the pipeline produces:
.testagent/research.md containing detected language/framework, build commands, files to test ranked by priority, and existing test inventory.testagent/plan.md containing phased approach with specific methods and test scenarios (happy path, edge cases, error cases) for each fileThe code-testing-extensions skill provides concrete, filled-in examples for each pipeline phase showing real source code, real research output, real plans, and real generated tests. Call the code-testing-extensions skill to discover available extension files, then read:
dotnet-examples.md — MSTest example with InvoiceService: research output, plan output, generated test file, fix cycle walkthrough, and final reportpython-examples.md — pytest example with the same InvoiceService scenario: research, plan, generated test file (parametrized, unittest.mock), fix cycles (ModuleNotFoundError, patch target, Mock(spec=...)), and final reporttypescript-examples.md — Vitest example (also applicable to Jest) showing it.each parameterization, async tests, fake timers, and ESM/CJS fix cyclesgo-examples.md — Standard testing package example with table-driven subtests, hand-written fake repository, injected clock, and -run regex fix cyclejava-examples.md — JUnit 5 + Mockito example on Maven showing @ExtendWith(MockitoExtension.class), @ParameterizedTest + @CsvSource, Clock.fixed(...) for time, and Surefire fix cyclesFor languages without a dedicated examples file (Rust, Ruby, Swift, Kotlin, C++, PowerShell), use the base extension file (<language>.md) plus the example file for the closest paradigm — the pipeline shape (research → plan → generate → fix) and the categories of decisions (test layout, mocking strategy, fixed clock for time-dependent code, parameterization style) translate directly.
| Agent | Purpose |
| -------------------------- | -------------------- |
| code-testing-generator | Coordinates pipeline |
| code-testing-researcher | Analyzes codebase |
| code-testing-planner | Creates test plan |
| code-testing-implementer | Writes test files |
| code-testing-builder | Compiles code |
| code-testing-tester | Runs tests |
| code-testing-fixer | Fixes errors |
| code-testing-linter | Formats code |
The code-testing-fixer agent will attempt to resolve compilation errors. Check .testagent/plan.md for the expected test structure. Call the code-testing-extensions skill and read the language-specific extension file for error code references (e.g., dotnet.md for .NET).
Most failures in generated tests are caused by wrong expected values in assertions, not production code bugs:
[Ignore] or [Skip] just to make them passSpecify your preferred framework in the initial request: "Generate Jest tests for..."
Tests that depend on external services, network endpoints, specific ports, or precise timing will fail in CI environments. Focus on unit tests with mocked dependencies instead.
During phase implementation, build only the specific test project for speed. After all phases, run a full non-incremental workspace build to catch cross-project errors.
Take microsoft/code-testing-agent from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.