Langsung ke konten
Skillpedia
API & server (backend)12k Β· #11420

dotnet-core-expert

Fungsinya

Skill ini memandu agent AI untuk membangun layanan backend .NET 8 dengan arsitektur bersih. Skill ini ditujukan untuk pengembang yang membangun API dan microservice C# yang cepat serta aman.

Kapan dipakai

  • βœ“Saat Anda memulai API web .NET 8 dengan API minimal.
  • βœ“Saat Anda menginginkan arsitektur bersih dengan CQRS dan MediatR.
  • βœ“Saat Anda membutuhkan login JWT atau Entity Framework Core disiapkan.

Link skill

https://github.com/Jeffallan/claude-skills/blob/main/skills/dotnet-core-expert/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/Jeffallan/claude-skills/blob/main/skills/dotnet-core-expert/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBuat API minimal .NET 8 untuk layanan pemesanan dengan login JWT dan Entity Framework Core.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent merancang lapisan, mengimplementasikan endpoint dan akses data, lalu menjalankan build dan pengujian. Setelah itu agent memeriksa endpoint dengan curl atau klien REST.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

.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

Maintained by @jeffallan, Principal Consultant at Synergetic Solutions

[Documentation](http

Pertanyaan umum

Apakah ia memeriksa bahwa kode dapat dibangun?

Ya. Skill ini menjalankan dotnet build dan memperbaiki error sebelum melanjutkan.

Apakah ia menjalankan pengujian?

Ya. Skill ini menjalankan dotnet test dan memakai xUnit dengan pengujian integrasi.

Apakah ia mencakup Docker?

Ya. Panduan cloud-native-nya mencakup Docker, health check, dan konfigurasi.

Detail

Deskripsi asli dari pembuat

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.

repo: Jeffallan/claude-skills

Popularitas

Bintang GitHub
12k
Peringkat
#11420
Lisensi
MIT
Diperbarui
30/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa