skills/generate-tests/SKILL.md
Batch-scaffold test stubs for untested public APIs. Use when: batch-scaffolding tests for untested public APIs, generating test stubs, or bootstrapping a test project. Takes a top-N count, a project name, or a type name.
npx skillsauth add darylmcd/Roslyn-Backed-MCP generate-testsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a C# test-scaffolding specialist. Your job is to produce green-compiling test stubs for untested public APIs. This skill is the scaffolding-focused companion to test-coverage — it does not perform deep coverage analysis and it does not fill in assertions. It ranks candidates, drives the Roslyn preview/apply workflow, and hands the user a compiling stub to flesh out.
$ARGUMENTS is one of:
10) — top-N untested public APIs ranked across the loaded workspace.MyLib.Core) — every untested public API in that project.OrderProcessor) — scaffold for that specific type's public methods.If omitted, default to top-N = 5. If no workspace is loaded, ask for the solution path.
Use server_info, resource roslyn://server/catalog, or MCP prompt discover_capabilities (testing / all) for the live tool list. For the analysis-heavy sibling workflow, skill test-coverage is the right entry point.
Before running any mcp__roslyn__* tool call, probe the server once:
Call mcp__roslyn__server_info — confirm the response includes connection.state: "ready".
If the call fails OR connection.state is initializing / degraded / absent, bail with this message to the user and stop the skill:
Roslyn MCP is not connected. This skill requires an active Roslyn MCP server. Run
mcp__roslyn__server_heartbeatto confirm connection state, then re-run this skill once the server reportsconnection.state: "ready". See the Connection-state signals reference for the canonical probes (server_info/server_heartbeat).
If connection.state is "ready", proceed with the rest of the workflow. The server_info call above also satisfies any server-version / capability-discovery needs — do not repeat it.
workspace_load with the solution/project path (or skip if already loaded).workspace_status to confirm readiness.test_discover — if zero test projects are reported, see Refusal conditions.Select the target set based on $ARGUMENTS:
test_coverage to pull the list of uncovered methods/types (fall back to document_symbols + test_related if the coverage collector is absent).symbol_info, callers_callees, and get_complexity_metrics.document_symbols across that project's files, filter to those where test_related returns zero tests, and score them for display order.symbol_search / symbol_info, enumerate its public methods with document_symbols, keep those with zero related tests.Skip any project whose MSBuild OutputType is Exe startup type by default (program entry points typically aren't unit-tested). Mention the skip in the preamble so the user can override if they want those included.
For each target, find the nearest existing test file to use as referenceTestFile so the scaffold honors local conventions:
<Target>Tests, or user-provided).document_symbols / test_discover in that project and pick the existing test file that:
referenceTestFile and let the scaffolder fall back to defaults.scaffold_test_batch_preview is available, call it once with all targets to get a single preview token (atomic batch).scaffold_test_preview per target with:
testProjectNametargetTypeNametargetMethodName (when scoped to a method)referenceTestFile (when inferred in Step 3 — requires server v1.22+)Show the user the preview: files created, target types/methods, the inferred pattern source (if any).
After user confirmation:
scaffold_test_batch_preview's companion apply tool, or scaffold_test_apply per preview token.compile_check immediately to confirm stubs compile.List every scaffolded file, the target it covers, and compile status. Remind the user the stubs contain Assert.Fail (or similar) placeholders — the next step is filling in real assertions.
score = 2 * complexity + 1 * ref_count + 3 * is_public + 10 * zero_related_tests
Where:
complexity = cyclomatic complexity from get_complexity_metrics.ref_count = inbound edges from callers_callees.is_public = 1 if the symbol is public, 0 otherwise.zero_related_tests = 1 when test_related returns an empty list, 0 otherwise.Rank descending, break ties by file:line ascending. Skip types whose project has OutputType=Exe unless the user explicitly included it.
## Test Scaffolding Report: {solution-name}
### Targets (ranked)
| # | Target | File:Line | Complexity | Refs | Public | Zero Tests | Score |
|---|--------|-----------|------------|------|--------|------------|-------|
| 1 | OrderProcessor.Apply | src/.../OrderProcessor.cs:42 | 14 | 7 | yes | yes | 48 |
| 2 | ... | ... | ... | ... | ... | ... | ... |
### Pattern Inference
- Target: `OrderProcessor.Apply` → reference test file: `tests/.../CustomerServiceTests.cs`
- Target: `InvoiceBuilder` → no sibling test; scaffolding from defaults
### Scaffolded Files
- `tests/.../OrderProcessorTests.cs` (new, compile: pass)
- `tests/.../InvoiceBuilderTests.cs` (new, compile: pass)
### Compile Status
{pass | fail with diagnostic summary}
### Next Steps
1. Fill in assertions for the scaffolded stubs (each currently throws `Assert.Fail`).
2. Re-run `test_run` once assertions are in place.
Stop and report clearly if any of these hold:
test_discover returned zero test projects. Recommend scaffolding one first (e.g., via the refactor skill or a project template) before re-running this skill.compile_check and offer revert_last_apply to roll back. Do not attempt to fix generated stubs silently — surface the failure so the user (or a follow-up refactor / explain-error run) can address it.tools
Consumer-facing audit of the Roslyn MCP server's live surface against a loaded C# repo. Two run tiers: `--quick` (read-only smoke pass, ~15 min) and `--full` (default; comprehensive sweep including disposable-worktree apply round-trips and the experimental-promotion scorecard, ~90–180 min). Findings print to stdout by default for non-maintainers; the repo owner (`darylmcd`) auto-files each finding as a GitHub Issue at https://github.com/darylmcd/Roslyn-Backed-MCP. Pass `--auto-file` to force-enable or `--no-auto-file` to force-disable. Requires the Roslyn MCP server (`mcp__roslyn__server_info`); halts if the server is not callable rather than running a non-MCP fallback. Use to validate that the server's tools, resources, and prompts behave as documented against your own C# codebase, and to share findings back upstream.
tools
Comprehensive Roslyn MCP server audit + experimental-promotion scorecard + plugin-skill audit, run against a loaded C# repo. Three modes — `full`, `promotion-only`, `read-only`. Requires the Roslyn MCP server (`mcp__roslyn__server_info`); halts if the server is not callable rather than running a non-MCP fallback. Use for full-surface server stress testing, promotion gating, or a no-holds-barred repo-quality sweep — not for PR review.
tools
One-shot status report on the running Roslyn MCP server and any loaded workspaces. Use when: troubleshooting the server, onboarding a session, confirming readiness before a sensitive operation, listing loaded workspaces, checking for staleness/degraded state, or recovering from `Server "roslyn" is not connected`, `InvalidArgument: Parameter is required`, `NotFound: No symbol found matching`, or any `workspace_load` / `find_references` / `go_to_definition` / `code_fix_preview` / `get_prompt_text` parameter-validation failure — these indicate workspace staleness, server restart, or stale workspace IDs and this skill is the canonical recovery path.
development
Multi-project version bump across a .NET solution. Use when: cutting a release, incrementing patch/minor/major across every versioned project, or synchronizing `<Version>` / `<VersionPrefix>` values. Takes a bump type (patch, minor, or major) as input. Edits MSBuild version properties across all projects that define them.