{"id":"csharp-developer","name":"csharp-developer","summary":".NET 8+、ASP.NET Core API、またはBlazorのウェブアプリを使ってC#アプリケーションを構築する際に使います。","body":"# C# Developer\n\nSenior C# developer with mastery of .NET 8+ and Microsoft ecosystem. Specializes in high-performance web APIs, cloud-native solutions, and modern C# language features.\n\n## When to Use This Skill\n\n- Building ASP.NET Core APIs (Minimal or Controller-based)\n- Implementing Entity Framework Core data access\n- Creating Blazor web applications (Server/WASM)\n- Optimizing .NET performance with Span<T>, Memory<T>\n- Implementing CQRS with MediatR\n- Setting up authentication/authorization\n\n## Core Workflow\n\n1. **Analyze solution** — Review .csproj files, NuGet packages, architecture\n2. **Design models** — Create domain models, DTOs, validation\n3. **Implement** — Write endpoints, repositories, services with DI\n4. **Optimize** — Apply async patterns, caching, performance tuning\n5. **Test** — Write xUnit tests with TestServer; verify 80%+ coverage\n\n> **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 with `dotnet ef migrations remove` if needed.\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Modern C# | `references/modern-csharp.md` | Records, pattern matching, nullable types |\n| ASP.NET Core | `references/aspnet-core.md` | Minimal APIs, middleware, DI, routing |\n| Entity Framework | `references/entity-framework.md` | EF Core, migrations, query optimization |\n| Blazor | `references/blazor.md` | Components, state management, interop |\n| Performance | `references/performance.md` | Span<T>, async, memory optimization, AOT |\n\n## Constraints\n\n### MUST DO\n- Enable nullable reference types in all projects\n- Use file-scoped namespaces and primary constructors (C# 12)\n- Apply async/await for all I/O operations — always accept and forward `CancellationToken`:\n  ```csharp\n  // Correct\n  app.MapGet(\"/items/{id}\", async (int id, IItemService svc, CancellationToken ct) =>\n      await svc.GetByIdAsync(id, ct) is { } item ? Results.Ok(item) : Results.NotFound());\n  ```\n- Use dependency injection for all services\n- Include XML documentation for public APIs\n- Implement proper error handling with Result pattern:\n  ```csharp\n  public readonly record struct Result<T>(T? Value, string? Error, bool IsSuccess)\n  {\n      public static Result<T> Ok(T value) => new(value, null, true);\n      public static Result<T> Fail(string error) => new(default, error, false);\n  }\n  ```\n- Use strongly-typed configuration with `IOptions<T>`\n\n### MUST NOT DO\n- Use blocking calls (`.Result`, `.Wait()`) in async code:\n  ```csharp\n  // Wrong — blocks thread and risks deadlock\n  var data = service.GetDataAsync().Result;\n\n  // Correct\n  var data = await service.GetDataAsync(ct);\n  ```\n- Disable nullable warnings without proper justification\n- Skip cancellation token support in async methods\n- Expose EF Core entities directly in API responses — always map to DTOs\n- Use string-based configuration keys\n- Skip input validation\n- Ignore code analysis warnings\n\n## Output Templates\n\nWhen implementing .NET features, provide:\n1. Domain models and DTOs\n2. API endpoints (Minimal API or controllers)\n3. Repository/service implementations\n4. Configuration setup (Program.cs, appsettings.json)\n5. Brief explanation of architectural decisions\n\n## Example: Minimal API Endpoint\n\n```csharp\n// Program.cs (file-scoped, .NET 8 minimal API)\nvar builder = WebApplication.CreateBuilder(args);\nbuilder.Services.AddScoped<IProductService, ProductService>();\n\nvar app = builder.Build();\n\napp.MapGet(\"/products/{id:int}\", async (\n    int id,\n    IProductService service,\n    CancellationToken ct) =>\n{\n    var result = await service.GetByIdAsync(id, ct);\n    return result.IsSuccess ? Results.Ok(result.Value) : Results.NotFound(result.Error);\n})\n.WithName(\"GetProduct\")\n.Produces<ProductDto>()\n.ProducesProblem(404);\n\napp.Run();\n```\n\n## Knowledge Reference\n\nC# 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\n\n[Documentation](https://jeffallan.github.io/claude-skills/skills/language/csharp-developer/)","author":"@Jeffallan","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/Jeffallan/claude-skills/tree/main/skills/csharp-developer","license":"MIT","category":"writing","lang":"en","tokens":991,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[{"path":"references/aspnet-core.md","size":10739,"sha256":"35441bc36160f37fd8e81fc9dde3c49a45710534c24885612ce60dd2542d2c5b"},{"path":"references/blazor.md","size":12940,"sha256":"ad157f9d1c3c648ef8eedea60c1756374a0dbeff9a60b8efd25d4f88407ffb10"},{"path":"references/entity-framework.md","size":11717,"sha256":"4968dc8fa13438be577301f1a0ca144e505d245bda9f61f44d61e05b3fcdc4c3"},{"path":"references/modern-csharp.md","size":6219,"sha256":"ea6526a6932f07c45ef2bd02aba17ffff6801757c670b337c147505fa76240aa"},{"path":"references/performance.md","size":12454,"sha256":"185b571daa962f342133ad6bc9289b447bf24eda7217bb02f61b082029ce3c8d"}],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[{"code":"injection.preauthorise","kind":"injection","where":"SKILL.md:41","excerpt":"always accept","message":"pre-authorises approvals on the user’s behalf","severity":"warn"}],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":["api.example.com","jeffallan.github.io"]}}