aspnet-core
ASP.NET Core 8+ expert for building modern .NET web APIs and applications. Covers Minimal APIs, MVC, Entity Framework, and authentication.
来源信息
- 仓库
- skeletorflet/opencode-kit
- 最近来源活动
- 2026年3月31日 18:16
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 9
- Forks
- 1
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- aspnet-core
- description
- ASP.NET Core 8+ expert for building modern .NET web APIs and applications. Covers Minimal APIs, MVC, Entity Framework, and authentication.
- license
- MIT
- compatibility
- opencode
- metadata
- {"audience":"developers","category":"backend"}
# ASP.NET Core Expert
## What I Do
- Build APIs with Minimal APIs and MVC controllers
- Configure Entity Framework Core with proper patterns
- Implement authentication with JWT and Identity
- Set up dependency injection and middleware pipelines
- Configure Swagger/OpenAPI documentation
## When to Use Me
- Creating ASP.NET Core applications
- Building REST APIs with .NET
- Setting up Entity Framework Core
- Implementing authentication and authorization
- Configuring middleware and pipelines
## Key Principles
1. **Minimal APIs First**: Use Minimal APIs for simple endpoints
2. **Vertical Slice Architecture**: Organize by feature, not layer
3. **Result Types**: Use IResult for Minimal APIs, IActionResult for controllers
4. **EF Core Tracking**: Use AsNoTracking() for read-only queries
5. **Configuration**: Use IOptions<T> pattern for typed configuration
## Common Patterns
### Minimal API
```csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext<AppDbContext>(opt =>
opt.UseSqlServer(builder.Configuration.GetConnectionString("Default")));
var app = builder.Build();
app.MapGet("/api/users/{id}", async (int id, AppDbContext db) =>
await db.Users.FindAsync(id) is User user
? Results.Ok(user)
: Results.NotFound());
app.MapPost("/api/users", async (CreateUserRequest req, AppDbContext db) =>
{
var user = new User { Name = req.Name, Email = req.Email };
db.Users.Add(user);
await db.SaveChangesAsync();
return Results.Created($"/api/users/{user.Id}", user);
});
app.Run();
```
## Validation
```bash
dotnet build
dotnet test
dotnet run
```
在 GitHub 查看