Code Testing Generation Skill
An AI-powered skill that generates comprehensive, workable unit tests for any programming language using a coordinated multi-agent pipeline.
skill by
@dotnetGenerate or add unit tests for existing code, from one function to a complete project-wide suite. ALWAYS USE when asked to "write unit tests", "add tests", "generate tests", "cover this untested method", scaffold tests where none exist, or create comprehensive tests across multiple modules or packages. Polyglot: C#/.NET, Python/pytest, TS/JS, Go, Rust, Java, Ruby. Handles classic non-SDK/packages.config MSTest projects, explicit Compile registration, sparse workspaces, existing-suite extension, and proportional focused work. DO NOT USE for only running/diagnosing tests, analyzing a coverage report, auditing test quality, or answering an MSTest API question without writing tests.
Permissions
Files
Generate or add unit tests for existing code, from one function to a complete project-wide suite. ALWAYS USE when asked to "write unit tests", "add tests", "generate tests", "cover this untested method", scaffold tests where none exist, or create comprehensive tests across multiple modules or packages. Polyglot: C#/.NET, Python/pytest, TS/JS, Go, Rust, Java, Ruby. Handles classic non-SDK/packages.config MSTest projects, explicit Compile registration, sparse workspaces, existing-suite extension, and proportional focused work. DO NOT USE for only running/diagnosing tests, analyzing a coverage report, auditing test quality, or answering an MSTest API question without writing tests.
An AI-powered skill that generates comprehensive, workable unit tests for any programming language using a coordinated multi-agent pipeline.
Install
It’s free, and every skill you add syncs into every AI tool on your computer, instantly.
Version history
Classify scope before editing:
.testagent/research.md and .testagent/plan.md before implementation, then
.testagent/status.md after the final test-quality review. If these files are
absent, the broad workflow is incomplete..testagent/ artifacts or fan out to multiple
agents. A sparse project-wide request remains broad even when only one source
module is present.For either scope, run the narrowest relevant test command to a clean exit and
finish with a compact Requirement | Evidence table. Each requested behavior
must cite an exact test name; validation rows cite the successful command.
Use this skill when you need to:
writing-mstest-tests as supporting
guidance after this entry skill has established scope and project conventionsrun-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.
Match the machinery to the scope. Running the full pipeline on a one-file request costs turns and tool calls without improving the tests.
| Scope | What it looks like | How to run it |
|---|---|---|
| Focused | One function, class, or file; "tests for X only"; extending an existing suite with the missing cases | Skip the .testagent/ artifacts and the sub-agent fan-out. Keep the requirement checklist in your head (or in the final table), read only the target and one neighbouring test for conventions, write the tests, run the narrowest test command, review your own assertions inline. |
| Broad | A project, package, or module set; "comprehensive suite"; a coverage threshold to clear across several files | Run the full Research → Plan → Implement pipeline in Step 3, with the .testagent/ artifacts and the completion contract below. |
When in doubt, start focused and escalate only if the request turns out to span several files. Escalating costs one extra pass; running the broad pipeline on a focused request costs several.
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. Treat the current workspace as authoritative even when it is sparse, gutted-looking, synthetic, or missing tracked files; never restore or reconstruct it, including with `git checkout`, `git restore`, `git reset`, or `git clean`.
The Test Generator will manage the entire pipeline automatically.
If code-testing-generator is unavailable, do not skip the workflow. Execute the
same Research → Plan → Implement sequence inline, create the .testagent/
artifacts described below, and apply the same completion contract.
For multi-file requests:
.testagent/research.md.find-untested-sources once and consume its pairing and suggested-path output; do not repeat that discovery manually.code-testing-extensions only when the repository has no representative tests and the base extension is insufficient.packages.config, existing framework/mock versions and custom base fixtures, add every new test file to the project's explicit <Compile Include> items, and use the repository's MSBuild/test-runner commands. Never modernize the project or dependency stack merely to generate tests.Every scope must satisfy points 3–5 below. Points 1 and 2 are the broad-scope
artifacts: on a focused request the same reasoning happens inline and no
.testagent/ files are written.
Do not report completion until all of these are true:
.testagent/research.md records the bounded target
inventory, existing test conventions, and the acceptance checklist..testagent/plan.md maps each checklist item to a planned
test or an explicit blocker.test-gap-analysis and assertion-quality when available and
record the findings and fixes in .testagent/status.md. On a focused scope,
do the equivalent review inline — re-read each generated assertion against
the source — without spawning extra passes.The final response MUST include a compact Requirement | Evidence table.
Behavioral rows cite exact generated test names. Non-behavioral rows cite the
relevant project file, validation command, or coverage report. A generic list
of tested areas is not a substitute for requirement-by-requirement evidence.
Quote the user's requirement verbatim in each row. When the request names a specific combination — "a case where a composite discount, regional tax, and weight-based shipping all apply", "the difference between summed and chained discounts", "constructor validation for every class" — the row must cite the one test that demonstrates exactly that. A test that merely exercises the same collaborators does not satisfy a requirement about their interaction, and per-class requirements need a citation per class.
Cite a clean run, not an attempt. The commands behind the evidence table must have finished successfully: quote the final passing test summary and, when thresholds were requested, the per-module coverage table from a run that exited 0. If the last coverage run exited non-zero, fix it and re-run before reporting; never infer threshold clearance from a failed or partial run.
Broad-scope runs store pipeline state in the .testagent/ folder. A focused
request does not create these files:
| File | Purpose |
|---|---|
.testagent/research.md | Codebase analysis results |
.testagent/plan.md | Phased implementation plan |
.testagent/status.md | Final quality review and fixes |
| 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 |
Classic non-SDK .NET projects are supported when their existing build/test
toolchain is available. When it is not available on the current machine, the
agent can still add and register version-compatible tests, but must report
execution as blocked rather than substituting dotnet test.
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.
In these kits
More from @dotnet
Works with
Claude, Codex, Cursor & more