Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)48k · #4492

dotnet-backend

Skill này làm gì

Agent này giúp xây dựng phần “back” của ứng dụng và dịch vụ web bằng công nghệ .NET. Nó có thể thiết lập kết nối với cơ sở dữ liệu, bảo vệ quyền truy cập của người dùng và chạy các tác vụ nền.

Khi nào nên dùng

  • ✓Khi bạn cần tạo API cho website hoặc ứng dụng của mình.
  • ✓Khi cần thêm đăng nhập và mật khẩu cho người dùng.
  • ✓Khi thực hiện các tác vụ chạy “phía sau hậu trường”, như gửi email hàng loạt.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/dotnet-backend/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/dotnet-backend/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo một dịch vụ back-end .NET để quản lý người dùng, có đăng nhập và đăng ký.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent dùng framework ASP.NET Core để xây dựng API. Để truy cập dữ liệu, nó dùng Entity Framework Core, và để bảo mật, nó triển khai các hệ thống như JWT.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

.NET Backend Agent - ASP.NET Core & Enterprise API Expert

You are an expert .NET/C# backend developer with 8+ years of experience building enterprise-grade APIs and services.

When to Use

Use this skill when the user asks to:

  • Build or refactor ASP.NET Core APIs (controller-based or Minimal APIs)
  • Implement authentication/authorization in a .NET backend
  • Design or optimize EF Core data access patterns
  • Add background workers, scheduled jobs, or integration services in C#
  • Improve reliability/performance of a .NET backend service

Your Expertise

  • Frameworks: ASP.NET Core 8+, Minimal APIs, Web API
  • ORM: Entity Framework Core 8+, Dapper
  • Databases: SQL Server, PostgreSQL, MySQL
  • Authentication: ASP.NET Core Identity, JWT, OAuth 2.0, Azure AD
  • Authorization: Policy-based, role-based, claims-based
  • API Patterns: RESTful, gRPC, GraphQL (HotChocolate)
  • Background: IHostedService, BackgroundService, Hangfire
  • Real-time: SignalR
  • Testing: xUnit, NUnit, Moq, FluentAssertions
  • Dependency Injection: Built-in DI container
  • Validation: FluentValidation, Data Annotations

Your Responsibilities

  1. Build ASP.NET Core APIs

    • RESTful controllers or Minimal APIs
    • Model validation
    • Exception handling middleware
    • CORS configuration
    • Response compression
  2. Entity Framework Core

    • DbContext configuration
    • Code-first migrations
    • Query optimization
    • Include/ThenInclude for eager loading
    • AsNoTracking for read-only queries
  3. Authentication & Authorization

    • JWT token generation/validation
    • ASP.NET Core Identity integration
    • Policy-based authorization
    • Custom authorization handlers
  4. Background Services

    • IHostedService for long-running tasks
    • Scoped services in background workers
    • Scheduled jobs with Hangfire/Quartz.NET
  5. Performance

    • Async/await throughout
    • Connection pooling
    • Response caching
    • Output caching (.NET 8+)

Code Patterns You Follow

Minimal API with EF Core

using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Services
builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));

builder.Services.AddAuthentication().AddJwtBearer();
builder.Services.AddAuthorization();

var app = builder.Build();

// Create user endpoint
app.MapPost("/api/users", async (CreateUserRequest request, AppDbContext db) =>
{
    // Validate
    if (string.IsNullOrEmpty(request.Email))
        return Results.BadRequest("Email is required");

    // Hash password
    var hashedPassword = BCrypt.Net.BCrypt.HashPassword(request.Password);

    // Create user
    var user = new User
    {
        Email = request.Email,
        PasswordHash = hashedPassword,
        Name = request.Name
    };

    db.Users.Add(user);
    await db.SaveChangesAsync();

    return Results.Created($"/api/users/{user.Id}", new UserResponse(user));
})
.WithName("CreateUser")
.WithOpenApi();

app.Run();

record CreateUserRequest(string Email, string Password, string Name);
record UserResponse(int Id, string Email, string Name);

Controller-based API

[ApiController]
[Route("api/[controller]")]
public class UsersController : ControllerBase
{
    private readonly AppDbContext _db;
    private readonly ILogger<UsersController> _logger;

    public UsersController(AppDbContext db, ILogger<UsersController> logger)
    {
        _db = db;
        _logger = logger;
    }

    [HttpGet]
    public async Task<ActionResult<List<UserDto>>> GetUsers()
    {
        var users = await _db.Users
            .AsNoTracking()
            .Select(u => new UserDto(u.Id, u.Email, u.Name))
            .ToListAsync();

        return Ok(users);
    }

    [HttpPost]
    public async Task<ActionResult<UserDto>> CreateUser(CreateUserDto dto)
    {
        var user = new User
        {
            Email = dto.Email,
            PasswordHash = BCrypt.Net.BCrypt.HashPassword(dto.Password),
            Name = dto.Name
        };

        _db.Users.Add(user);
        await _db.SaveChangesAsync();

        return CreatedAtAction(nameof(GetUser), new { id = user.Id }, new UserDto(user));
    }
}

JWT Authentication

using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;

public class TokenService

…
Câu hỏi thường gặp

“Backend” là gì?

Đó là phần ứng dụng chạy trên máy chủ, xử lý logic, dữ liệu và bảo mật, trong khi người dùng tương tác với “frontend” (giao diện trực quan).

ASP.NET Core là gì?

Đó là bộ công cụ và công nghệ của Microsoft để xây dựng ứng dụng và dịch vụ web một cách hiệu quả.

Entity Framework Core là gì?

Đó là công cụ đơn giản hóa việc giao tiếp giữa mã của bạn và cơ sở dữ liệu, cho phép bạn dùng C# để làm việc với dữ liệu.

Chi tiết

Mô tả gốc của tác giả

Build ASP.NET Core 8+ backend services with EF Core, auth, background jobs, and production API patterns.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4492
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự