New to Claude Skills? Learn how to install them →

jeffallan on GitHub

.NET Core Expert

Free

Build .NET 8 applications with best practices.

Get this skill

Free · Opens the source repo

What .NET Core Expert does

The .NET Core Expert skill is designed for developers building applications using .NET 8, focusing on minimal APIs, clean architecture, and cloud-native microservices. This skill guides you through the entire development process, from analyzing requirements and designing solutions to implementing high-performance code and ensuring security. It emphasizes the use of modern C# features and best practices, enabling you to create robust applications efficiently.

When utilizing this skill, you will follow a structured workflow that includes analyzing the architectural patterns and data models, designing clean architecture layers, and implementing solutions with a focus on performance and security. The skill mandates the use of .NET 8 and C# 12 features, ensuring that your applications are up-to-date with the latest advancements in the framework. Additionally, it provides detailed guidance on essential topics such as Entity Framework Core, JWT authentication, and cloud-native practices.

The skill also emphasizes testing and validation, encouraging you to write comprehensive tests using xUnit and to verify your endpoints with tools like curl or REST clients. By following the provided constraints and guidelines, you will avoid common pitfalls, such as using synchronous I/O operations or exposing entities directly in API responses. This skill is particularly useful for developers who want to adhere to clean architecture principles while leveraging the full capabilities of .NET 8.

Overall, the .NET Core Expert skill is an essential resource for developers looking to enhance their .NET application development skills, ensuring that they build secure, high-performance applications that are maintainable and scalable.

When to use it

Use this skill when developing .NET 8 applications, especially those utilizing minimal APIs and clean architecture.

When not to use it

This skill may not be suitable for projects using older versions of .NET or those that do not require modern architectural practices.

What you can build with it

Building a Microservice

Leverage this skill to create a cloud-native microservice using minimal APIs and Entity Framework Core.

Implementing Authentication

Use the skill to add JWT authentication and authorization policies to secure your .NET application.

Testing and Validation

Follow the testing guidelines within the skill to ensure your application is robust and all endpoints function correctly.

How to install .NET Core Expert

View source

1. Install with the skills CLI

npx skills add jeffallan/claude-skills/dotnet-core-expert --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by jeffallan

.NET Core Expert

Core Workflow

  1. Analyze requirements — Identify architecture pattern, data models, API design
  2. Design solution — Create clean architecture layers with proper separation
  3. Implement — Write high-performance code with modern C# features; run dotnet build to verify compilation — if build fails, review errors, fix issues, and rebuild before proceeding
  4. Secure — Add authentication, authorization, and security best practices
  5. Test — Write comprehensive tests with xUnit and integration testing; run dotnet test to confirm all tests pass — if tests fail, diagnose failures, fix the implementation, and re-run before continuing; verify endpoints with curl or a REST client

Reference Guide

Load detailed guidance based on context:

TopicReferenceLoad When
Minimal APIsreferences/minimal-apis.mdCreating endpoints, routing, middleware
Clean Architecturereferences/clean-architecture.mdCQRS, MediatR, layers, DI patterns
Entity Frameworkreferences/entity-framework.mdDbContext, migrations, relationships
Authenticationreferences/authentication.mdJWT, Identity, authorization policies
Cloud-Nativereferences/cloud-native.mdDocker, health checks, configuration

Constraints

MUST DO

  • Use .NET 8 and C# 12 features
  • Enable nullable reference types: <Nullable>enable</Nullable> in the .csproj
  • Use async/await for all I/O operations — e.g., await dbContext.Users.ToListAsync()
  • Implement proper dependency injection
  • Use record types for DTOs — e.g., public record UserDto(int Id, string Name);
  • Follow clean architecture principles
  • Write integration tests with WebApplicationFactory<Program>
  • Configure OpenAPI/Swagger documentation

MUST NOT DO

  • Use synchronous I/O operations
  • Expose entities directly in API responses
  • Skip input validation
  • Use legacy .NET Framework patterns
  • Mix concerns across architectural layers
  • Use deprecated EF Core patterns

Code Examples

Minimal API Endpoint

// Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(typeof(Program).Assembly));

var app = builder.Build();
app.UseSwagger();
app.UseSwaggerUI();

app.MapGet("/users/{id}", async (int id, ISender sender, CancellationToken ct) =>
{
    var result = await sender.Send(new GetUserQuery(id), ct);
    return result is null ? Results.NotFound() : Results.Ok(result);
})
.WithName("GetUser")
.Produces<UserDto>()
.ProducesProblem(404);

app.Run();

MediatR Query Handler

// Application/Users/GetUserQuery.cs
public record GetUserQuery(int Id) : IRequest<UserDto?>;

public sealed class GetUserQueryHandler : IRequestHandler<GetUserQuery, UserDto?>
{
    private readonly AppDbContext _db;

    public GetUserQueryHandler(AppDbContext db) => _db = db;

    public async Task<UserDto?> Handle(GetUserQuery request, CancellationToken ct) =>
        await _db.Users
            .AsNoTracking()
            .Where(u => u.Id == request.Id)
            .Select(u => new UserDto(u.Id, u.Name))
            .FirstOrDefaultAsync(ct);
}

EF Core DbContext with Async Query

// Infrastructure/AppDbContext.cs
public sealed class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(options)
{
    public DbSet<User> Users => Set<User>();

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly);
    }
}

// Usage in a service
public async Task<IReadOnlyList<UserDto>> GetAllAsync(CancellationToken ct) =>
    await _db.Users
        .AsNoTracking()
        .Select(u => new UserDto(u.Id, u.Name))
        .ToListAsync(ct);

DTO with Record Type

public record UserDto(int Id, string Name);
public record CreateUserRequest(string Name, string Email);

Output Templates

When implementing .NET features, provide:

  1. Project structure (solution/project files)
  2. Domain models and DTOs
  3. API endpoints or service implementations
  4. Database context and migrations if applicable
  5. Brief explanation of architectural decisions

Documentation

Frequently asked questions about .NET Core Expert

Similar skills