dotnet-dev

0
0
Source

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.

Install

mkdir -p .claude/skills/dotnet-dev && curl -L -o skill.zip "https://mcp.directory/api/skills/download/7253" && unzip -o skill.zip -d .claude/skills/dotnet-dev && rm skill.zip

Installs to .claude/skills/dotnet-dev

About this skill

.NET Development Skills

Expert guidance for .NET development in this repository.

Build & Test Commands

# 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

Package Management

This repository uses Central Package Management via Directory.Packages.props.

Adding/Updating Packages

# 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.

Directory.Packages.props Structure


<Project>
    <PropertyGroup>
        <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
    </PropertyGroup>
    <ItemGroup>
        <PackageVersion Include="PackageName" Version="1.0.0" />
    </ItemGroup>
</Project>

Project Structure

  • src/ - Main solution with production code and tests
  • new-cli/ - New CLI implementation (separate solution)
  • build/ - Build automation (Cake-based)
  • docs/ - Documentation

Key Projects

ProjectPurpose
GitVersion.CoreCore version calculation logic
GitVersion.AppCLI application
GitVersion.ConfigurationConfiguration file handling
GitVersion.OutputOutput formatters (JSON, BuildServer)
GitVersion.BuildAgentsCI/CD platform integrations
GitVersion.MsBuildMSBuild task integration
GitVersion.LibGit2SharpGit repository abstraction

Coding Conventions

Primary Constructors

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
    }
}

Dependency Injection

Use constructor injection with ILogger<T> for logging:

public class MyService
{
    private readonly ILogger<MyService> logger;

    public MyService(ILogger<MyService> logger)
    {
        this.logger = logger;
    }
}

Logging

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);

Nullable Reference Types

All projects use nullable reference types. Handle nullability explicitly:

public string? OptionalProperty { get; set; }

public string RequiredProperty { get; set; } = string.Empty;

File-Scoped Namespaces

Use file-scoped namespaces:

namespace GitVersion.Core;

public class MyClass
{
    // ...
}

Testing

Test Project Naming

  • Test projects mirror source projects: GitVersion.CoreGitVersion.Core.Tests

Test Frameworks

  • NUnit - Primary test framework
  • NSubstitute - Mocking framework
  • Shouldly - Assertion library

Test Patterns

[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);
    }
}

Configuration Files

Supported Names

  • GitVersion.yml
  • GitVersion.yaml
  • .GitVersion.yml
  • .GitVersion.yaml

Schema Location

JSON schemas are in schemas/ directory for validation.

Build Agents

Build agent integrations write environment variables with GitVersion_ prefix:

// Example: GitHub Actions
Environment.SetEnvironmentVariable($"GitVersion_{name}", value);

Common Tasks

Running the CLI Locally

dotnet run --project src/GitVersion.App

Debugging Tests

# 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"

Checking for Errors

# Build with warnings as errors
dotnet build ./src/GitVersion.slnx -warnaserror

Public API Management

This repository uses Microsoft.CodeAnalysis.PublicApiAnalyzers to track public API surface.

Rules

  • PublicAPI.Unshipped.txt: All new or modified public APIs go here
  • PublicAPI.Shipped.txt: Only deletions are allowed; never add or modify entries directly

Workflow

  1. When adding new public APIs, they automatically get flagged and should be added to PublicAPI.Unshipped.txt
  2. When modifying existing APIs, move the old entry from PublicAPI.Shipped.txt to PublicAPI.Unshipped.txt (marked as removed) and add the new signature to PublicAPI.Unshipped.txt
  3. Only remove entries from PublicAPI.Shipped.txt when an API is being deleted
  4. During release, unshipped APIs get moved to shipped via the mark-shipped.ps1 script

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

9521,094

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

846846

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

571699

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

548492

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

673466

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

514280

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.