csharp-patterns

csharp-patterns is a skill for Claude Code from softspark/ai-toolkit. It costs 61 tokens per session (3,518 once invoked), scanned A, original, Apache-2.0.

A collection of recommended patterns for building C# and .NET applications, including ASP.NET Core services, dependency injection, database access, and asynchronous code. It also describes how to organize application and test projects.

In plain words
What is it for?
Use it when designing or extending .NET application structure, ASP.NET Core services, EF Core data access, LINQ queries, or dependency-injection setups.
Why use it?
It helps keep larger .NET codebases understandable as they grow. The patterns provide consistent ways to separate business logic, infrastructure, web endpoints, and tests.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the ai-toolkit plugin — 113 skills, 44 agents, 14 hooks shipped together

Good fit Use it when designing or extending .NET application structure, ASP.NET Core services, EF Core data access, LINQ queries, or dependency-injection setups.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/softspark/ai-toolkit/csharp-patterns
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.

Any agent
npx skills add softspark/ai-toolkit --skill csharp-patterns
Clone the repo
git clone --depth 1 https://github.com/softspark/ai-toolkit

Made for: Claude Code.

Or install ai-toolkit, the plugin that ships this one along with the rest of its 113 skills, 44 agents, 14 hooks.

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 csharp-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/softspark/ai-toolkit/csharp-patterns.svg)](https://agentmods.dev/skills/softspark/ai-toolkit/csharp-patterns)
Your own site
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/csharp-patterns"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/csharp-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,518 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00061 $0.03518
Opus 5 $0.00030 $0.01759
Sonnet 5 $0.00012 $0.00704
Haiku 4.5 $0.00006 $0.00352

Measured 3d ago against content hash 9d03b236c1a9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

csharp-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 3d 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.

app/skills/csharp-patterns/SKILL.md · 452 lines

How it starts

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

C# / .NET Patterns

Project Structure

Solution Layout

MyApp.sln
Directory.Build.props              # Shared build properties
Directory.Packages.props           # Central package management
src/
  MyApp.Api/                       # ASP.NET Core host (Controllers, Middleware, Program.cs)
  MyApp.Application/               # Use cases, MediatR handlers, Behaviors
  MyApp.Domain/                    # Entities, value objects, domain events
  MyApp.Infrastructure/            # EF Core, external services
tests/
  MyApp.UnitTests/
  MyApp.IntegrationTests/

Directory.Build.props

<Project>
  <PropertyGroup>
    <TargetFramework>net9.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
    <AnalysisLevel>latest-recommended</AnalysisLevel>
  </PropertyGroup>
</Project>

Central Package Management (Directory.Packages.props)

<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>
  <ItemGroup>
    <PackageVersion Include="MediatR" Version="12.4.1" />
    <PackageVersion Include="FluentValidation" Version="11.11.0" />
    <PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
  </ItemGroup>
</Project>

Idioms / Code Style

Nullable Reference Types

public class Order
{
    public required string Id { get; init; }
    public string? Notes { get; set; }               // explicitly nullable
    public required Customer Customer { get; init; }  // never null
    public string Summary => $"Order {Id}: {Notes ?? "no notes"}";
}

Records

public record Money(decimal Amount, string Currency)
{
    public Money Add(Money other) => Currency != other.Currency
        ? throw new InvalidOperationException("Currency mismatch")
        : this with { Amount = Amount + other.Amount };
}

public record CreateOrderRequest(string CustomerId, List<OrderLineDto> Lines);
public record OrderLineDto(string ProductId, int Quantity);

Read the full file on GitHub · 452 lines

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. 3d ago First seen · 452 lines · 61 tokens per session scan A 9d03b236c1a9

Subscribe to this mod's changes

csharp-patterns is a skill published in the GitHub repository softspark/ai-toolkit (170 stars, last pushed 2d ago), licensed Apache-2.0. It adds 61 tokens to every session and 3,518 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-09-03.

Related

Other skills, from other repositories

dotnet-csharp-advisor

Développement .NET/C# avec ASP.NET Core, EF Core et patterns modernes. Se déclenche avec ".NET", "C#", "ASP.NET", "EF Core", "Entity Framework", "Minimal API", "Blazor", "LINQ", "NuGet", "dotnet". Also triggers on "C# best practices", "EF Core query".

khalilbenaz/claude-skills-collection · 80 tokens

software-csharp-backend

Applies C# and .NET backend standards. Use when shaping API boundaries, data access, resilience, observability, or security defaults.

vasilyu1983/AI-Agents-public · 34 tokens

csharp-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.

personamanagmentlayer/pcl · 70 tokens

aspnet-core

ASP.NET Core 8+ with controllers, services, DI, configuration, and middleware pipeline. Covers Program.cs setup and enterprise patterns. USE WHEN: user mentions "ASP.NET Core", "Web API", ".NET controllers", "Program.cs", "dependency injection", ".NET DI", ".NET configuration", "appsettings" DO NOT USE FOR: Minimal…

claude-dev-suite/claude-dev-suite · 111 tokens

aspnet-middleware

ASP.NET Core custom middleware, pipeline order, exception handling middleware, and request/response manipulation. USE WHEN: user mentions "middleware", "request pipeline", "exception middleware", "ASP.NET middleware", "UseMiddleware", "pipeline order" DO NOT USE FOR: Express middleware - use express, NestJS middleware…

claude-dev-suite/claude-dev-suite · 73 tokens

aspnet-signalr

ASP.NET Core SignalR for real-time hubs, clients, groups, and streaming. Covers strongly-typed hubs and hub filters. USE WHEN: user mentions "SignalR", "real-time", "WebSocket", "hubs", "real-time notifications", ".NET WebSocket", "push notifications" DO NOT USE FOR: Spring WebSocket - use spring-websocket, Socket.IO…

claude-dev-suite/claude-dev-suite · 94 tokens