New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Structured .NET toolkit covering single-file runs, selective testing, coverage, API inspection, analyzers, and Roslyn queries.

GitHub stars
143
View on GitHub

What it does

  • Adds dotnet-run-file, dotnet-inspect, dotnet-test, coverage-report, dotnet-analyzers, and roslyn-query skills for everyday .NET work
  • Runs C# files directly with dotnet run and #:package directives, including one-liners via stdin on .NET 10+
  • Generates branch-scoped coverage reports, and queries NuGet and platform APIs with diffs between package versions
  • Designed for .NET developers who want structural code analysis without writing a full project for each question

.NET development skills: dotnet run file support, selective unit testing, coverage, API inspection, analyzers and Roslyn queries

Add marketplace

/plugin marketplace add NikiforovAll/claude-code-rules

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install handbook-dotnet@cc-handbook

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

Code Coverage Report

Generate a code coverage report scoped to source files changed in the current branch compared to a base branch.

Workflow

1. Determine base branch

Detect the base branch to diff against. Use the MR/PR target branch if known, otherwise default to main or master (whichever exists). Ask the user if ambiguous.

git merge-base --fork-point main HEAD || git merge-base --fork-point master HEAD

2. Detect changed source files

git diff <base-branch> --name-only -- '*.cs'

Filter out test files (paths containing Test, Tests, .Tests, .Test). If no source files changed, stop and inform the user.

3. Identify test project(s)

Determine which test project(s) to run. Strategies (in order):

  1. User-specified: If the user names a test project, use it
  2. Convention-based: Look for test projects whose name matches the changed project (e.g., MyProject -> MyProject.Tests)
  3. Solution-wide: Run all tests in the solution if scope is unclear
  4. Ask: If ambiguous, ask the user which test project(s) to run

4. Clean previous results

rm -rf TestResults/

5. Run tests with coverage

dotnet test <test-project-or-solution> \
  --collect:"XPlat Code Coverage" \
  --results-directory ./TestResults/

6. Build file filters

From the changed file list (step 2), extract basenames and build a filter string:

+*FileName1.cs;+*FileName2.cs;+*FileName3.cs

7. Generate report

dotnet reportgenerator \
  -reports:"TestResults/**/coverage.cobertura.xml" \
  -targetdir:"TestResults/CoverageReport" \
  -reporttypes:"Html;TextSummary" \
  -filefilters:"<filters>"

8. Display results

  1. Print TestResults/CoverageReport/Summary.txt to the terminal
  2. Open the HTML report (platform-aware):
    • Windows: start TestResults/CoverageReport/index.html
    • macOS: open TestResults/CoverageReport/index.html
    • Linux: xdg-open TestResults/CoverageReport/index.html

Tips

  • For large solutions, scope to specific test projects to speed up collection
  • The -filefilters flag accepts wildcards -- basename matching avoids path sensitivity

Readme

Handbook .NET

.NET development skills: running single C# files, testing, coverage, API inspection, analyzers and Roslyn queries.

Automatic CSharpier formatting left this plugin in 1.20.1. It is now dotnet-csharpier, so you can take these skills without the formatting hook.

Features

  • dotnet-run-file skill: Run C# files directly without projects (.NET 10+)
  • coverage-report skill: Generate code coverage reports scoped to branch changes
  • dotnet-inspect skill: Query .NET APIs across NuGet packages, platform libraries, and local assemblies
  • dotnet-analyzers skill: Fix code style and analyzer diagnostics with dotnet format, plus an HTML dashboard
  • roslyn-query skill: Query C# codebases structurally via Roslyn AST analysis

Installation

/plugin marketplace add nikiforovall/claude-code-rules
/plugin install handbook-dotnet

Skills

dotnet-run-file

Run C# code directly without creating project files using .NET 10's dotnet run file.cs feature.

Invoke the skill:

Use the dotnet-run-file skill to help me run this C# code

Quick examples:

# Run a .cs file
dotnet run app.cs

# One-liner via stdin (Claude Code friendly)
echo 'Console.WriteLine("Hello");' | dotnet run -

# Multi-line with heredoc
dotnet run - << 'EOF'
var now = DateTime.Now;
Console.WriteLine($"Time: {now}");
EOF

# With NuGet package
dotnet run - << 'EOF'
#:package Humanizer@*
using Humanizer;
Console.WriteLine(TimeSpan.FromMinutes(90).Humanize());
EOF

Directives:

  • #:package Humanizer@* - Add NuGet packages (version required)
  • #:sdk Microsoft.NET.Sdk.Web - Set SDK (for web apps)
  • #:property LangVersion preview - MSBuild properties

See skills/dotnet-run-file/references/ for detailed guides.

dotnet-inspect

Query .NET library APIs — the same commands work across NuGet packages, platform libraries, and local .dll/.nupkg files.

Quick examples:

# Scan a type's members
dnx dotnet-inspect -y -- member JsonSerializer --package System.Text.Json --oneline

# Triage what changed between two versions
dnx dotnet-inspect -y -- diff --package System.CommandLine@2.0.0-beta4.22272.1..2.0.3 --oneline

# Find extension methods for a type
dnx dotnet-inspect -y -- extensions IServiceCollection --extensions

Generic types need quotes and a type parameter: 'Option<T>'. Use the built-in -n N / -s Section limits instead of piping through head.

dotnet-analyzers

Fix code style and analyzer diagnostics (IDE*, CA*, SA*) with dotnet format. Always reports first — never fixes without confirmation.

Quick examples:

# List violations without fixing
dotnet format style --verify-no-changes --severity warn -v diag

# Fix a specific diagnostic
dotnet format style --diagnostics IDE0005 --severity warn

# CI gate
dotnet format --verify-no-changes --severity warn

Pass --dashboard for an interactive HTML report, or --dashboard --sarif for comprehensive SARIF-based coverage that respects .editorconfig severity.

roslyn-query

Query C# codebases structurally using Roslyn AST analysis, run as throwaway scripts via dotnet run file.cs. Answers questions grep can't: who calls this method, what implements this interface, where does untrusted data flow.

Two tiers — syntax-only (fast, no compilation) for assignment audits and pattern checks, semantic (MSBuildWorkspace) for callers, implementations, and data flow.

dotnet run scripts/my-analysis.cs -- <target-path>

See skills/roslyn-query/references/ for the API reference and script templates.

Details

Marketplace
NikiforovAll/claude-code-rules
Source
plugins/handbook-dotnet
Category
Development
Listed since
Apr 7, 2026

More from NikiforovAll/claude-code-rules

All 22

Similar to handbook-dotnet

More Developer Tools