Agent SkillsJeffallan/claude-skills › dotnet-core-expert

dotnet-core-expert

GitHub

.NET 8 专家技能,涵盖 Minimal API、Clean Architecture、EF Core、JWT 及云原生微服务开发。指导代码实现、架构设计及测试验证。

skills/dotnet-core-expert/SKILL.md Jeffallan/claude-skills

Trigger Scenarios

构建 .NET 8 应用程序 设计 Clean Architecture 或 CQRS 配置 EF Core 和 JWT 认证 优化云原生微服务

Install

npx skills add Jeffallan/claude-skills --skill dotnet-core-expert -g -y
More Options

Use without installing

npx skills use Jeffallan/claude-skills@dotnet-core-expert

指定 Agent (Claude Code)

npx skills add Jeffallan/claude-skills --skill dotnet-core-expert -a claude-code -g -y

安装 repo 全部 skill

npx skills add Jeffallan/claude-skills --all -g -y

预览 repo 内 skill

npx skills add Jeffallan/claude-skills --list

SKILL.md

Frontmatter
{
    "name": "dotnet-core-expert",
    "license": "MIT",
    "metadata": {
        "role": "specialist",
        "scope": "implementation",
        "author": "https:\/\/github.com\/Jeffallan",
        "domain": "backend",
        "version": "1.1.0",
        "triggers": ".NET Core, .NET 8, ASP.NET Core, C# 12, minimal API, Entity Framework Core, microservices .NET, CQRS, MediatR",
        "output-format": "code",
        "related-skills": "fullstack-guardian, microservices-architect, cloud-architect, test-master"
    },
    "description": "Use when building .NET 8 applications with minimal APIs, clean architecture, or cloud-native microservices. Invoke for Entity Framework Core, CQRS with MediatR, JWT authentication, AOT compilation."
}

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

Topic Reference Load When
Minimal APIs references/minimal-apis.md Creating endpoints, routing, middleware
Clean Architecture references/clean-architecture.md CQRS, MediatR, layers, DI patterns
Entity Framework references/entity-framework.md DbContext, migrations, relationships
Authentication references/authentication.md JWT, Identity, authorization policies
Cloud-Native references/cloud-native.md Docker, 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

Version History

  • 882ef55 Current 2026-08-20 09:03

Same Skill Collection

skills/angular-architect/SKILL.md
skills/api-designer/SKILL.md
skills/atlassian-mcp/SKILL.md
skills/chaos-engineer/SKILL.md
skills/cli-developer/SKILL.md
skills/cloud-architect/SKILL.md
skills/code-documenter/SKILL.md
skills/cpp-pro/SKILL.md
skills/csharp-developer/SKILL.md
skills/database-optimizer/SKILL.md
skills/debugging-wizard/SKILL.md
skills/django-expert/SKILL.md
skills/embedded-systems/SKILL.md
skills/fastapi-expert/SKILL.md
skills/feature-forge/SKILL.md
skills/flutter-expert/SKILL.md
skills/golang-pro/SKILL.md
skills/graphql-architect/SKILL.md
skills/java-architect/SKILL.md
skills/javascript-pro/SKILL.md
skills/kotlin-specialist/SKILL.md
skills/kubernetes-specialist/SKILL.md
skills/laravel-specialist/SKILL.md
skills/legacy-modernizer/SKILL.md
skills/mcp-developer/SKILL.md
skills/microservices-architect/SKILL.md
skills/nextjs-developer/SKILL.md
skills/pandas-pro/SKILL.md
skills/php-pro/SKILL.md
skills/playwright-expert/SKILL.md
skills/postgres-pro/SKILL.md
skills/python-pro/SKILL.md
skills/rag-architect/SKILL.md
skills/react-expert/SKILL.md
skills/react-native-expert/SKILL.md
skills/salesforce-developer/SKILL.md
skills/security-reviewer/SKILL.md
skills/spark-engineer/SKILL.md
skills/spring-boot-engineer/SKILL.md
skills/sre-engineer/SKILL.md
skills/swift-expert/SKILL.md
skills/terraform-engineer/SKILL.md
skills/the-fool/SKILL.md
skills/typescript-pro/SKILL.md
skills/vue-expert/SKILL.md
skills/websocket-engineer/SKILL.md
skills/architecture-designer/SKILL.md
skills/code-reviewer/SKILL.md
skills/devops-engineer/SKILL.md

Metadata

Files
0
Version
882ef55
Hash
25901e10
Indexed
2026-08-20 09:03

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 11:12
浙ICP备14020137号-1 $방문자$