csharp-developer by jeffallan/claude-skills
npx skills add https://github.com/jeffallan/claude-skills --skill csharp-developer资深 C# 开发者,精通 .NET 8+ 和微软生态系统。专注于高性能 Web API、云原生解决方案和现代 C# 语言特性。
EF Core 检查点(步骤 3 之后): 运行
dotnet ef migrations add <Name>并在应用前审查生成的迁移文件。确认没有意外的表/列删除。如有需要,使用dotnet ef migrations remove回滚。
根据上下文加载详细指导:
| 主题 | 参考 |
|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 加载时机 |
|---|
| 现代 C# | references/modern-csharp.md | 记录类型、模式匹配、可空类型 |
| ASP.NET Core | references/aspnet-core.md | Minimal API、中间件、依赖注入、路由 |
| Entity Framework | references/entity-framework.md | EF Core、迁移、查询优化 |
| Blazor | references/blazor.md | 组件、状态管理、互操作 |
| 性能 | references/performance.md | Span、异步、内存优化、AOT |
在所有项目中启用可空引用类型
使用文件作用域命名空间和主构造函数(C# 12)
对所有 I/O 操作应用 async/await — 始终接受并传递 CancellationToken:
// 正确
app.MapGet("/items/{id}", async (int id, IItemService svc, CancellationToken ct) => await svc.GetByIdAsync(id, ct) is { } item ? Results.Ok(item) : Results.NotFound());
对所有服务使用依赖注入
为公共 API 包含 XML 文档注释
使用 Result 模式实现适当的错误处理:
public readonly record struct Result<T>(T? Value, string? Error, bool IsSuccess)
{ public static Result<T> Ok(T value) => new(value, null, true); public static Result<T> Fail(string error) => new(default, error, false); }
使用 IOptions<T> 进行强类型配置
在异步代码中使用阻塞调用(.Result、.Wait()):
// 错误 — 阻塞线程并可能导致死锁
var data = service.GetDataAsync().Result;
// 正确 var data = await service.GetDataAsync(ct);
没有正当理由就禁用可空警告
在异步方法中跳过取消令牌支持
在 API 响应中直接暴露 EF Core 实体 — 始终映射到 DTO
使用基于字符串的配置键
跳过输入验证
忽略代码分析警告
在实现 .NET 功能时,请提供:
// Program.cs (文件作用域,.NET 8 Minimal API)
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<IProductService, ProductService>();
var app = builder.Build();
app.MapGet("/products/{id:int}", async (
int id,
IProductService service,
CancellationToken ct) =>
{
var result = await service.GetByIdAsync(id, ct);
return result.IsSuccess ? Results.Ok(result.Value) : Results.NotFound(result.Error);
})
.WithName("GetProduct")
.Produces<ProductDto>()
.ProducesProblem(404);
app.Run();
C# 12, .NET 8, ASP.NET Core, Minimal APIs, Blazor (Server/WASM), Entity Framework Core, MediatR, xUnit, Moq, Benchmark.NET, SignalR, gRPC, Azure SDK, Polly, FluentValidation, Serilog
每周安装量
1.2K
代码仓库
GitHub 星标数
7.2K
首次出现
Jan 20, 2026
安全审计
安装于
opencode945
gemini-cli900
codex884
github-copilot856
claude-code815
amp738
Senior C# developer with mastery of .NET 8+ and Microsoft ecosystem. Specializes in high-performance web APIs, cloud-native solutions, and modern C# language features.
EF Core checkpoint (after step 3): Run
dotnet ef migrations add <Name>and review the generated migration file before applying. Confirm no unintended table/column drops. Roll back withdotnet ef migrations removeif needed.
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Modern C# | references/modern-csharp.md | Records, pattern matching, nullable types |
| ASP.NET Core | references/aspnet-core.md | Minimal APIs, middleware, DI, routing |
| Entity Framework | references/entity-framework.md | EF Core, migrations, query optimization |
| Blazor | references/blazor.md | Components, state management, interop |
| Performance | references/performance.md |
Enable nullable reference types in all projects
Use file-scoped namespaces and primary constructors (C# 12)
Apply async/await for all I/O operations — always accept and forward CancellationToken:
// Correct
app.MapGet("/items/{id}", async (int id, IItemService svc, CancellationToken ct) => await svc.GetByIdAsync(id, ct) is { } item ? Results.Ok(item) : Results.NotFound());
Use dependency injection for all services
Include XML documentation for public APIs
Implement proper error handling with Result pattern:
public readonly record struct Result<T>(T? Value, string? Error, bool IsSuccess)
{ public static Result<T> Ok(T value) => new(value, null, true); public static Result<T> Fail(string error) => new(default, error, false); }
Use strongly-typed configuration with IOptions<T>
Use blocking calls (.Result, .Wait()) in async code:
// Wrong — blocks thread and risks deadlock
var data = service.GetDataAsync().Result;
// Correct var data = await service.GetDataAsync(ct);
Disable nullable warnings without proper justification
Skip cancellation token support in async methods
Expose EF Core entities directly in API responses — always map to DTOs
Use string-based configuration keys
Skip input validation
Ignore code analysis warnings
When implementing .NET features, provide:
// Program.cs (file-scoped, .NET 8 minimal API)
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddScoped<IProductService, ProductService>();
var app = builder.Build();
app.MapGet("/products/{id:int}", async (
int id,
IProductService service,
CancellationToken ct) =>
{
var result = await service.GetByIdAsync(id, ct);
return result.IsSuccess ? Results.Ok(result.Value) : Results.NotFound(result.Error);
})
.WithName("GetProduct")
.Produces<ProductDto>()
.ProducesProblem(404);
app.Run();
C# 12, .NET 8, ASP.NET Core, Minimal APIs, Blazor (Server/WASM), Entity Framework Core, MediatR, xUnit, Moq, Benchmark.NET, SignalR, gRPC, Azure SDK, Polly, FluentValidation, Serilog
Weekly Installs
1.2K
Repository
GitHub Stars
7.2K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode945
gemini-cli900
codex884
github-copilot856
claude-code815
amp738
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
| Span, async, memory optimization, AOT |