.github/skills/dotnet-dev/SKILL.md
Expert guidance for .NET development in this repository. Use this skill for building, testing, debugging, and understanding project structure, coding conventions, dependency injection patterns, and testing practices.
npx skillsauth add gittools/gitversion dotnet-devInstall 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.
Expert guidance for .NET development in this repository.
# Build the solution
dotnet build ./src/GitVersion.slnx
# Build a single project
dotnet build --project ./src/GitVersion.Core/GitVersion.Core.csproj
# Run all tests
dotnet test --solution ./src/GitVersion.slnx
# Run tests for a specific project
dotnet test --project ./src/GitVersion.Core.Tests/GitVersion.Core.Tests.csproj
# Run tests with specific framework
dotnet test --project ./src/GitVersion.Core.Tests/GitVersion.Core.Tests.csproj --framework net10.0
# Run specific test by filter
dotnet test --project ./src/GitVersion.Core.Tests/GitVersion.Core.Tests.csproj --filter "FullyQualifiedName~TestClassName"
# Format code
dotnet format ./src/GitVersion.slnx
# Verify formatting (CI-friendly)
dotnet format --verify-no-changes ./src/GitVersion.slnx
This repository uses Central Package Management via Directory.Packages.props.
# Add a package (version managed centrally)
dotnet add ./src/ProjectName/ProjectName.csproj package PackageName
# Update central package version in src/Directory.Packages.props
Important: Always update versions in src/Directory.Packages.props, not in individual .csproj files.
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="PackageName" Version="1.0.0" />
</ItemGroup>
</Project>
src/ - Main solution with production code and testsnew-cli/ - New CLI implementation (separate solution)build/ - Build automation (Cake-based)docs/ - Documentation| Project | Purpose |
|----------------------------|---------------------------------------|
| GitVersion.Core | Core version calculation logic |
| GitVersion.App | CLI application |
| GitVersion.Configuration | Configuration file handling |
| GitVersion.Output | Output formatters (JSON, BuildServer) |
| GitVersion.BuildAgents | CI/CD platform integrations |
| GitVersion.MsBuild | MSBuild task integration |
| GitVersion.LibGit2Sharp | Git repository abstraction |
Prefer primary constructors with readonly field assignments:
internal class BuildAgentResolver(IEnumerable<IBuildAgent> buildAgents, ILogger<BuildAgentResolver> logger) : IBuildAgentResolver
{
private readonly IEnumerable<IBuildAgent> buildAgents = buildAgents.NotNull();
private readonly ILogger<BuildAgentResolver> logger = logger.NotNull();
public IBuildAgent? Resolve()
{
// Use this.buildAgents and this.logger
}
}
Use constructor injection with ILogger<T> for logging:
public class MyService
{
private readonly ILogger<MyService> logger;
public MyService(ILogger<MyService> logger)
{
this.logger = logger;
}
}
Use Microsoft.Extensions.Logging with Serilog:
// Information level
this.logger.LogInformation("Processing {BranchName}", branch.Name);
// Warning level
this.logger.LogWarning("Configuration not found, using defaults");
// Error level
this.logger.LogError(ex, "Failed to calculate version");
// Debug level (verbose)
this.logger.LogDebug("Cache hit for {CacheKey}", key);
All projects use nullable reference types. Handle nullability explicitly:
public string? OptionalProperty { get; set; }
public string RequiredProperty { get; set; } = string.Empty;
Use file-scoped namespaces:
namespace GitVersion.Core;
public class MyClass
{
// ...
}
GitVersion.Core → GitVersion.Core.Tests[TestFixture]
public class MyServiceTests
{
[Test]
public void MethodName_Scenario_ExpectedResult()
{
// Arrange
var service = new MyService();
// Act
var result = service.DoSomething();
// Assert
result.ShouldBe(expected);
}
[TestCase("input1", "expected1")]
[TestCase("input2", "expected2")]
public void MethodName_WithParameters_ReturnsExpected(string input, string expected)
{
var result = service.Process(input);
result.ShouldBe(expected);
}
}
GitVersion.ymlGitVersion.yaml.GitVersion.yml.GitVersion.yamlJSON schemas are in schemas/ directory for validation.
Build agent integrations write environment variables with GitVersion_ prefix:
// Example: GitHub Actions
Environment.SetEnvironmentVariable($"GitVersion_{name}", value);
dotnet run --project src/GitVersion.App
# Run with detailed output
dotnet test --project ./src/GitVersion.Core.Tests/GitVersion.Core.Tests.csproj -v detailed
# Run specific test
dotnet test --filter "FullyQualifiedName=GitVersion.Core.Tests.MyTest"
# Build with warnings as errors
dotnet build ./src/GitVersion.slnx -warnaserror
This repository uses Microsoft.CodeAnalysis.PublicApiAnalyzers to track public API surface.
PublicAPI.Unshipped.txt: All new or modified public APIs go herePublicAPI.Shipped.txt: Only deletions are allowed; never add or modify entries directlyPublicAPI.Unshipped.txtPublicAPI.Shipped.txt to PublicAPI.Unshipped.txt (marked as
removed) and add the new signature to PublicAPI.Unshipped.txtPublicAPI.Shipped.txt when an API is being deletedmark-shipped.ps1 scriptresearch
Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping
tools
Manage NuGet packages in .NET projects/solutions. Use this skill when adding, removing, or updating NuGet package versions. It enforces using `dotnet` CLI for package management and provides strict procedures for direct file edits only when updating versions.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.