csharp-dotnet
/csharp-dotnet
Use when building on .NET 8+ with C# 12. Covers nullable reference types, records, async/await correctness, minimal APIs, dependency injection, and EF Core query performance. Trigger on "async deadlock in my asp.net app", "turn on nullable reference types", "ef core is doing n+1 queries", "set up a minimal api in .net 8". Do not use for tuning the database itself — see the database-performance skill.
- Author
- nimadorostkar ↗
- Repository
- Claude-Skills-collection ↗
- Licence
- MIT
- Last repository change
- 24.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 24.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when building on .NET 8+ with C# 12. Covers nullable reference types, records, async/await correctness, minimal APIs, dependency injection, and EF Core query performance. Trigger on "async deadlock in my asp.net app", "turn on nullable reference types", "ef core is doing n+1 queries", "set up a minimal api in .net 8". Do not use for tuning the database itself — see the database-performance skill.
Triggers from the description
Original author description
Use when building on .NET 8+ with C# 12. Covers nullable reference types, records, async/await correctness, minimal APIs, dependency injection, and EF Core query performance. Trigger on "async deadlock in my asp.net app", "turn on nullable reference types", "ef core is doing n+1 queries", "set up a minimal api in .net 8". Do not use for tuning the database itself — see the database-performance skill.
How it works
- Purpose
- When to Use
- Capabilities
- Inputs
- Outputs
- Workflow
- Best Practices
- Examples
- Notes
SKILL.md preview
---
name: csharp-dotnet
description: Use when building on .NET 8+ with C# 12. Covers nullable reference types, records, async/await correctness, minimal APIs, dependency injection, and EF Core query performance. Trigger on "async deadlock in my asp.net app", "turn on nullable reference types", "ef core is doing n+1 queries", "set up a minimal api in .net 8". Do not use for tuning the database itself — see the database-performance skill.
metadata:
category: languages
version: 1.0.0
tags: [csharp, dotnet, async, efcore, minimal-api]
---
# C# and .NET
## Purpose
Build .NET applications that are null-safe by contract, correctly asynchronous end to end, and free of the ORM traps that quietly turn one query into a thousand.
## When to Use
- Writing or reviewing C# on .NET 8 or later.
- Enabling nullable reference types on an existing project.
- Designing minimal APIs or ASP.NET Core services.
- Diagnosing async deadlocks or thread-pool starvation.
- Fixing EF Core N+1 queries and tracking overhead.
## Capabilities
- Nullable reference types, records, pattern matching, required members.
- Async correctness: `ConfigureAwait`, cancellation tokens, `IAsyncEnumerable`.
- Minimal APIs, endpoint filters, model validation, problem details.
- Dependency injection lifetimes and scope correctness.
- EF Core: projections, split queries, no-tracking reads, compiled queries.
## Inputs
- Solution or project files and target framework.
- Whether the project is a library, web API, or worker service.
- Data-access layer and database engine.
## Outputs
- Code compiling with `<Nullable>enable</Nullable>` and `<TreatWarningsAsErrors>true</TreatWarningsAsErrors>`.
- Async paths that flow a `CancellationToken` from request to database.
- EF Core queries with explicit projection and tracking behavior.
## Workflow
1. **Enable the gates** — Nullable reference types and warnings-as-errors, project-wide.
2. **Model** — Records for immutable values; `required` members instead of constructor sprawl.
3. **Thread cancellation** — Every async method takes a `CancellationToken` and passes it down.
4. **Shape the queries** — Project to DTOs; never materialize entities you will not mutate.
5. **Gate** — Build with warnings as errors, run analyzers, run the test suite.
## Best Practices
- Never call `.Result` or `.Wait()` on a Task. That is how deadlocks and starvation happen — async all the way down.
- Use `ConfigureAwait(false)` in library code; it is unnecessary in ASP.NET Core application code.
- Register `DbContext` as scoped. Injecting it into a singleton is a correctness bug, not a style issue.
- Read-only queries use `AsNoTracking()`. Tracking every row you only intend to display wastes memory and time.
- Return `Results.Problem(...)` / RFC 7807 payloads rather than bare status codes.
- Validate at the endpoint, not in the domain. The domain should be able to assume its inputs are valid.
## Examples
**Minimal API endpoint with cancellation and projection:**
```csharp
app.MapGet("/orders/{id:guid}", async (
Guid id,
AppDbContext db,
CancellationToken ct) =>
{
var order = await db.Orders
.AsNoTracking()
.Where(o => o.Id == id)
.Select(o => new OrderSummary(
o.Id,
o.Customer.Name,
o.Lines.Count,
o.Lines.Sum(l => l.Price * l.Quantity)))
.SingleOrDefaultAsync(ct);
return order is null
? Results.Problem(statusCode: 404, title: "Order not found")
: Results.Ok(order);
});
```
## Notes
- `IAsyncEnumerable<T>` streams results without buffering the full set — use it for large exports.
- EF Core's split-query mode avoids the cartesian explosion of multiple `Include`s, at the cost of extra round trips. Measure both.
- Source generators (e.g. `System.Text.Json`) remove reflection at startup and matter a great deal for AOT and cold-start latency.
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · nimadorostkar/Claude-Skills-collection | 100 | MIT |
| ericrisco/rsc-harness | 100 | MIT |
| lynricsy/hyperskills | 100 | MIT |
| CamiloAndresGTRUniandes/lucy-ai | 100 | MIT |
Database snapshot: 13.11.2026 · package version 886d43455484 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100csharp-idioms
Modern C# (10+/.NET) coding idioms: nullable reference types, records, pattern matching, async/await with CancellationTokens, LINQ performance, and DI. Use when writing, modifying, or reviewing C# application code or domain models. Pair with dotnet-idioms for framework APIs. - 95lang-csharp
Use this skill when the user says 'C#', 'csharp', '.NET', 'dotnet', 'async await C#', 'LINQ', 'nullable reference types', 'Span<T>', 'records', 'pattern matching', 'IDisposable', 'xUnit', 'NuGet', 'dotnet CLI'. Writes and reviews modern C# on current .NET (LTS .NET 10): language… - 95csharp
C# 12 language features including records, pattern matching, nullable reference types, LINQ, async/await, and modern language patterns. USE WHEN: user mentions "C#", "C# records", "pattern matching", "LINQ", "async/await", "nullable reference types", "C# generics", "C# language… - 90csharp-conventions
Use when a ticket adds or changes C#/.NET code — ASP.NET Core services, libraries, workers — and it must follow the repo's C# conventions — the .NET coding conventions, nullable reference types on and honoured, async all the way with cancellation tokens, dependency injection… - 90writing-csharp
Idiomatic C# /.NET development. Use when writing C# code, changing `.csproj` or `.sln`, or working on ASP.NET Core apps, libraries, CLIs, workers, and xUnit/NUnit/MSTest suites. Emphasizes nullable references, async/await, boundary validation, focused `dotnet` feedback, and… - 100csharp-expert
Expert-level C# development with .NET 8+, ASP.NET Core, LINQ, async/await, and enterprise patterns. Use when the user mentions C#, .NET, ASP.NET, enterprise, or Microsoft platforms, or when the task involves Modern C#, Async/Await, LINQ, or ASP.NET Core.