Skip to main content

Manage AI Skills

Docs for xUnit SDK v0.4.0

AI-led project setup installs durable, version-matched LiveDoc guidance automatically. Use this page when installing manually, refreshing skills after a package update, or adding another AI tool. Skills stay inside the repository so they can be reviewed, committed, and shared without affecting other projects.

One Command​

From your test project directory, run:

dotnet msbuild -t:LiveDocInstallSkills

This installs skill files for all supported AI tools into your repository. Commit them to share with your team.

Options​

Install for selected tools only:

dotnet msbuild -t:LiveDocInstallSkills -p:LiveDocAITool=copilot,codex,claude

Supported AI Tools​

AI ToolRepository Scope
GitHub Copilot (VS Code/CLI)✅
OpenAI Codex✅
Claude Code✅
Roo Code✅
Cursor✅
Windsurf✅
tip

Repository scope keeps the installed skill aligned with this project's LiveDoc version. Commit the files and every developer on the team benefits automatically.


Where Files Are Installed​

The installer places skill instruction files in tool-specific locations:

AI ToolRepository Location
GitHub Copilot.github/skills/livedoc-xunit/
OpenAI Codex.agents/skills/livedoc-xunit/
Claude Code.claude/skills/livedoc-xunit/
Roo Code.roo/skills/livedoc-xunit/
Cursor.cursor/rules/livedoc-xunit/
Windsurf.windsurf/rules/livedoc-xunit/

Manual Fallback​

If the MSBuild target doesn't work in your environment, you can copy the files manually. The skill files are bundled in the NuGet package under tools/skills/. Find them in your NuGet cache:

# Typical locations:
~/.nuget/packages/swedevtools.livedoc.xunit/<version>/tools/skills/
# Or on Windows:
%USERPROFILE%\.nuget\packages\swedevtools.livedoc.xunit\<version>\tools\skills\

Copy the contents (SKILL.md, VALIDATION.md, examples/, and resources/) to the appropriate directory from the table above.


What the Skill Provides​

Once installed, your AI assistant will:

  • Choose the correct base class — FeatureTest for BDD, SpecificationTest for MSpec patterns
  • Use correct attributes — [Feature]/[Scenario]/[ScenarioOutline] or [Specification]/[Rule]/[RuleOutline]
  • Write self-documenting tests — all inputs and expected outputs embedded in step titles
  • Extract values correctly — using ctx.Step.Values, Rule.Values, Rule.Params, or method parameters
  • Include descriptions — adding Description to container attributes for context
  • Organize namespaces — structuring tests for clean viewer hierarchy
  • Configure coverage — choosing Microsoft or XPlat collection, installing only required dependencies, preserving custom runsettings, and diagnosing LD-COV-* messages

Ask AI to Configure Coverage​

The installed skill includes the complete coverage decision path. A useful project-setup prompt is:

Configure this LiveDoc xUnit solution for full solution coverage with line and branch data in the Viewer. Prefer Microsoft Code Coverage. Explain every dependency and preserve existing runsettings.

The assistant should:

  1. Verify SweDevTools.LiveDoc.xUnit, Microsoft.NET.Test.Sdk, xUnit, and the Visual Studio runner are referenced.

  2. Prefer:

    dotnet test .\MySolution.sln --collect:"Code Coverage;Format=Cobertura"
  3. Avoid adding Coverlet for the Microsoft collector because LiveDoc already ships LiveDocCoverage.

  4. Install dotnet-coverage only when Visual Studio produces binary .coverage files or a dotnet-coverage-missing diagnostic appears.

  5. Preserve custom runsettings and merge the LiveDocCoverage collector entry instead of replacing the file.

  6. Confirm the Viewer receives line and branch metrics for every expected module.

If you explicitly request XPlat, the assistant should install coverlet.collector in every test project, explain that it supports branch coverage, and explain its narrower default scope and per-testhost artifacts. See Code Coverage for the full matrix.

Example: Before and After​

Without the skill, an AI assistant might write:

[Fact]
public void TestShipping()
{
var cart = new Cart { Country = "Australia", Total = 100 };
cart.Calculate();
Assert.Equal("Free", cart.ShippingType);
}

With the skill, the same request produces:

[Feature("Shipping Costs", Description = "Avoids assigning the wrong delivery tier for the tested destinations and totals.")]
public class ShippingCostsTests : FeatureTest
{
public ShippingCostsTests(ITestOutputHelper output) : base(output) { }

[Scenario]
public void Free_shipping_for_Australian_orders_over_100()
{
Given("the customer is from 'Australia'", ctx =>
{
_cart = new Cart { Country = ctx.Step!.Values[0].AsString() };
});

When("the order totals '100.00' dollars", ctx =>
{
_cart.Total = ctx.Step!.Values[0].AsDecimal();
_cart.Calculate();
});

Then("shipping type is 'Free'", ctx =>
{
Assert.Equal(ctx.Step!.Values[0].AsString(), _cart.ShippingType);
});
}
}

Verifying the Installation​

After installing, ask your AI assistant to write a LiveDoc test. It should:

  • Inherit from FeatureTest or SpecificationTest
  • Use [Feature]/[Scenario] or [Specification]/[Rule] attributes
  • Embed test data in step titles with single quotes
  • Extract values using ctx.Step.Values or ctx.Step.Params
  • Include ITestOutputHelper in the constructor

If the assistant doesn't follow these patterns, verify the skill files were installed to the correct location for your tool.