dotnet-backend-patterns

dotnet-backend-patterns is a skill for Claude Code from tranhieutt/software_development_department. It costs 60 tokens per session (851 once invoked), scanned A, original, MIT.

A collection of C# and .NET patterns for REST APIs, ASP.NET Core, Entity Framework, dependency injection, and middleware.

In plain words
What is it for?
Use it when working on C# files or .NET projects, including API structure, database access, service registration, and request-processing components.
Why use it?
It gives developers ready reference examples when building or reviewing .NET backend code.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tranhieutt/software_development_department/dotnet-backend-patterns
Any agent
npx skills add tranhieutt/software_development_department --skill dotnet-backend-patterns
Clone the repo
git clone --depth 1 https://github.com/tranhieutt/software_development_department

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dotnet-backend-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/tranhieutt/software_development_department/dotnet-backend-patterns.svg)](https://agentmods.dev/skills/tranhieutt/software_development_department/dotnet-backend-patterns)
Your own site
<a href="https://agentmods.dev/skills/tranhieutt/software_development_department/dotnet-backend-patterns"><img src="https://agentmods.dev/badge/skills/tranhieutt/software_development_department/dotnet-backend-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 851 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00060 $0.00851
Opus 5 $0.00030 $0.00426
Sonnet 5 $0.00012 $0.00170
Haiku 4.5 $0.00006 $0.00085

Measured 6d ago against content hash f3e4b38daaca, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

dotnet-backend-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/dotnet-backend-patterns/SKILL.md · 117 lines

How it starts

The opening of the file, as written. The whole thing — 117 lines — stays where its author put it; the contents beside it link to each section on GitHub.

.NET Backend Development Patterns

C#/.NET patterns for production-grade APIs, MCP servers, and enterprise backends.

API Structure (Minimal API + Controllers)

```csharp // Program.cs - Minimal API var builder = WebApplication.CreateBuilder(args); builder.Services.AddDbContext(o => o.UseNpgsql(connStr)); builder.Services.AddScoped<IOrderService, OrderService>();

var app = builder.Build(); app.MapGet("/orders/{id}", async (int id, IOrderService svc) => await svc.GetByIdAsync(id) is { } order ? Results.Ok(order) : Results.NotFound()); ```

Dependency Injection Patterns

```csharp // Register services builder.Services.AddScoped<IPaymentService, StripePaymentService>(); builder.Services.AddSingleton<ICacheService, RedisCacheService>(); builder.Services.AddHttpClient<IApiClient, ExternalApiClient>(client => { client.BaseAddress = new Uri("https://api.external.com"); }); ```

Lifetime guide: Singleton (stateless/cache), Scoped (per-request), Transient (stateless utility).

Entity Framework Core

```csharp // DbContext with conventions public class AppDbContext : DbContext { public DbSet Orders => Set(); protected override void OnModelCreating(ModelBuilder builder) { builder.Entity().HasIndex(o => o.UserId); builder.Entity().Property(o => o.Total).HasPrecision(18, 2); } } ```

Performance tips:

  • Use .AsNoTracking() for read-only queries
  • Avoid N+1 with .Include() or projection
  • Use compiled queries for hot paths

Middleware Pipeline

```csharp app.UseMiddleware(); app.UseAuthentication(); app.UseAuthorization(); app.UseRateLimiter(); app.MapControllers(); ```

Error Handling

```csharp // Global exception handler app.UseExceptionHandler(err => err.Run(async context => { var exception = context.Features.Get()?.Error; var (status, message) = exception switch { NotFoundException => (404, exception.Message), UnauthorizedAccessException => (403, "Forbidden"), _ => (500, "Internal server error") }; context.Response.StatusCode = status; await context.Response.WriteAsJsonAsync(new { error = message }); })); ```

Read the full file on GitHub · 117 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 117 lines · 60 tokens per session scan A f3e4b38daaca

Subscribe to this mod's changes

dotnet-backend-patterns is a skill published in the GitHub repository tranhieutt/software_development_department (72 stars, last pushed 3mo ago), licensed MIT. It adds 60 tokens to every session and 851 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

csharp-developer

Use when building C# applications with .NET 8+, ASP.NET Core APIs, or Blazor web apps. Builds REST APIs using minimal or controller-based routing, configures database access with Entity Framework Core, implements async patterns and cancellation, structures applications with CQRS via MediatR, and scaffolds Blazor…

Jeffallan/claude-skills · 102 tokens

dotnet-core-expert

Use when building .NET 8 applications with minimal APIs, clean architecture, or cloud-native microservices. Invoke for Entity Framework Core, CQRS with MediatR, JWT authentication, AOT compilation.

Jeffallan/claude-skills · 47 tokens

dotnet-architect

Expert .NET backend architect specializing in C#, ASP.NET Core, Entity Framework, Dapper, and enterprise application patterns. Masters async/await, dependency injection, caching strategies, and performance optimization. Use PROACTIVELY for .NET API development, code review, or architecture decisions.

rmyndharis/antigravity-skills · 62 tokens

csharp-pro

Write modern C# code with advanced features like records, pattern matching, and async/await. Optimizes .NET applications, implements enterprise patterns, and ensures comprehensive testing. Use PROACTIVELY for C# refactoring, performance optimization, or complex .NET solutions.

rmyndharis/antigravity-skills · 58 tokens

dotnet-backend-patterns

Master C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.

rmyndharis/antigravity-skills · 70 tokens

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.

nimadorostkar/Claude-Skills-collection · 44 tokens