Agent skill

Modern Csharp Coding Standards

by sketch7 in sketch7/FluentlyHttpClient

Write modern, high-performance C code using records, pattern matching, value objects, async/await, Span<T/Memory<T, and best-practice API design patterns.

MITAuto-check passedDevelopment

Install Modern Csharp Coding Standards

skills CLI
$ npx skills add sketch7/FluentlyHttpClient --skill modern-csharp-coding-standards -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install sketch7/FluentlyHttpClient modern-csharp-coding-standards --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/sketch7/FluentlyHttpClient.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/modern-csharp-coding-standards .claude/skills/modern-csharp-coding-standards && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
modern-csharp-coding-standards
GitHub stars
121
Used in
3 other repos
Token cost
~2.7k tokens
SKILL.md length
606 words
Files
5
Skills in repo
4
Repo updated
First seen
Licence
MIT

At a glance

Write modern, high-performance C code using records, pattern matching, value objects, async/await, Span<T/Memory<T, and best-practice API design patterns.

  • Works in 8 steps: Immutability by Default - Use record… → Type Safety - Leverage nullable… → Modern Pattern Matching - Use switch… → …
  • Tasks that involve Code quality
  • SKILL.md covers When to Use This Skill, Reference Files, Core Principles and Language Patterns, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Modern Csharp Coding Standards is an agent skill from sketch7/FluentlyHttpClient. Write modern, high-performance C code using records, pattern matching, value objects, async/await, Span<T/Memory<T, and best-practice API design patterns. Emphasizes functional-style programming with C 12+ features.

Its SKILL.md is about 2.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files (for example `anti-patterns-and-reflection.md`, `composition-and-error-handling.md` and `performance-and-api-design.md`).

It sits in Development, covering Code quality, Async programming and API design. It works with C#. The repository describes itself as: Http Client for .NET Standard with fluent APIs which are intuitive, easy to use and also highly extensible. The licence is MIT.

When your agent uses it

  • Tasks that involve Code quality
  • Tasks that involve Async programming
  • Tasks that involve API design

Example prompts

  • “/modern-csharp-coding-standards”

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. Immutability by Default - Use record types and init-only properties
  2. Type Safety - Leverage nullable reference types and value objects
  3. Modern Pattern Matching - Use switch expressions and patterns extensively
  4. Async Everywhere - Prefer async APIs with proper cancellation support
  5. Zero-Allocation Patterns - Use Span and Memory for performance-critical code
  6. API Design - Accept abstractions, return appropriately specific types
  7. Composition Over Inheritance - Avoid abstract base classes, prefer composition
  8. Value Objects as Structs - Use readonly record struct for value objects

What it can do on your machine

Read from SKILL.md and the folder at commit 397ee9b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are csharp).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • learn.microsoft.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Modern Csharp Coding Standards loads about 2.7k tokens when it runs. Until then it costs about 63 tokens; SKILL.md has 606 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~63
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from sketch7/FluentlyHttpClient at commit 397ee9b, republished under its MIT licence (© sketch7). 606 words, ~2,664 tokens.

Download SKILL.mdSave it as .claude/skills/modern-csharp-coding-standards/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
modern-csharp-coding-standards
description
Write modern, high-performance C# code using records, pattern matching, value objects, async/await, Span<T>/Memory<T>, and best-practice API design patterns. Emphasizes functional-style programming with C# 12+ features.
invocable
false

Modern C# Coding Standards

When to Use This Skill

Use this skill when:

  • Writing new C# code or refactoring existing code
  • Designing public APIs for libraries or services
  • Optimizing performance-critical code paths
  • Implementing domain models with strong typing
  • Building async/await-heavy applications
  • Working with binary data, buffers, or high-throughput scenarios

Reference Files

Core Principles

  1. Immutability by Default - Use record types and init-only properties
  2. Type Safety - Leverage nullable reference types and value objects
  3. Modern Pattern Matching - Use switch expressions and patterns extensively
  4. Async Everywhere - Prefer async APIs with proper cancellation support
  5. Zero-Allocation Patterns - Use Span<T> and Memory<T> for performance-critical code
  6. API Design - Accept abstractions, return appropriately specific types
  7. Composition Over Inheritance - Avoid abstract base classes, prefer composition
  8. Value Objects as Structs - Use readonly record struct for value objects

Language Patterns

Records for Immutable Data (C# 9+)

Use record types for DTOs, messages, events, and domain entities.

csharp
// Simple immutable DTO
public record CustomerDto(string Id, string Name, string Email);

// Record with validation in constructor
public record EmailAddress
{
    public string Value { get; init; }

    public EmailAddress(string value)
    {
        if (string.IsNullOrWhiteSpace(value) || !value.Contains('@'))
            throw new ArgumentException("Invalid email address", nameof(value));

        Value = value;
    }
}

// Records with collections - use IReadOnlyList
public record ShoppingCart(
    string CartId,
    string CustomerId,
    IReadOnlyList<CartItem> Items
)
{
    public decimal Total => Items.Sum(item => item.Price * item.Quantity);
}

When to use record class vs record struct:

  • record class (default): Reference types, use for entities, aggregates, DTOs with multiple properties
  • record struct: Value types, use for value objects (see next section)
Value Objects as readonly record struct

Value objects should always be readonly record struct for performance and value semantics. Use explicit conversions, never implicit operators.

csharp
public readonly record struct OrderId(string Value)
{
    public OrderId(string value) : this(
        !string.IsNullOrWhiteSpace(value)
            ? value
            : throw new ArgumentException("OrderId cannot be empty", nameof(value)))
    { }
    public override string ToString() => Value;
}

public readonly record struct Money(decimal Amount, string Currency);
public readonly record struct CustomerId(Guid Value)
{
    public static CustomerId New() => new(Guid.NewGuid());
}

See value-objects-and-patterns.md for complete examples including multi-value objects, factory patterns, and the no-implicit-conversion rule.

Pattern Matching (C# 8-12)

Use switch expressions, property patterns, relational patterns, and list patterns for cleaner code.

csharp
public decimal CalculateDiscount(Order order) => order switch
{
    { Total: > 1000m } => order.Total * 0.15m,
    { Total: > 500m } => order.Total * 0.10m,
    { Total: > 100m } => order.Total * 0.05m,
    _ => 0m
};

See value-objects-and-patterns.md for full pattern matching examples.


Nullable Reference Types (C# 8+)

Enable nullable reference types in your project and handle nulls explicitly.

csharp
// In .csproj
<PropertyGroup>
    <Nullable>enable</Nullable>
</PropertyGroup>

// Explicit nullability
public string? FindUserName(string userId)
{
    var user = _repository.Find(userId);
    return user?.Name;
}

// Pattern matching with null checks
public decimal GetDiscount(Customer? customer) => customer switch
{
    null => 0m,
    { IsVip: true } => 0.20m,
    { OrderCount: > 10 } => 0.10m,
    _ => 0.05m
};

// Guard clauses with ArgumentNullException.ThrowIfNull (C# 11+)
public void ProcessOrder(Order? order)
{
    ArgumentNullException.ThrowIfNull(order);
    // order is now non-nullable in this scope
    Console.WriteLine(order.Id);
}

Composition Over Inheritance

Avoid abstract base classes. Use interfaces + composition. Use static helpers for shared logic. Use records with factory methods for variants.

See composition-and-error-handling.md for full examples.


Performance Patterns

Async/Await Best Practices
csharp
// Async all the way - always accept CancellationToken
public async Task<Order> GetOrderAsync(string orderId, CancellationToken cancellationToken)
{
    var order = await _repository.GetAsync(orderId, cancellationToken);
    return order;
}

// ValueTask for frequently-called, often-synchronous methods
public ValueTask<Order?> GetCachedOrderAsync(string orderId, CancellationToken cancellationToken)
{
    if (_cache.TryGetValue(orderId, out var order))
        return ValueTask.FromResult<Order?>(order);
    return GetFromDatabaseAsync(orderId, cancellationToken);
}

// IAsyncEnumerable for streaming
public async IAsyncEnumerable<Order> StreamOrdersAsync(
    string customerId,
    [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
    await foreach (var order in _repository.StreamAllAsync(cancellationToken))
    {
        if (order.CustomerId == customerId)
            yield return order;
    }
}

Key rules:

  • Always accept CancellationToken with = default
  • Use ConfigureAwait(false) in library code
  • Never block on async code (no .Result or .Wait())
  • Use linked CancellationTokenSource for timeouts
Show full SKILL.md (254 more words)Show less
Span<T> and Memory<T>

Use Span<T> for synchronous zero-allocation operations, Memory<T> for async, and ArrayPool<T> for large temporary buffers.

See performance-and-api-design.md for complete Span/Memory examples and the API design section.


Error Handling: Result Type

For expected errors, use Result<T, TError> instead of exceptions. Use exceptions only for unexpected/system errors.

See composition-and-error-handling.md for the full Result type implementation and usage examples.


Avoid Reflection-Based Metaprogramming

Banned: AutoMapper, Mapster, ExpressMapper. Use explicit mapping extension methods instead. Use UnsafeAccessorAttribute (.NET 8+) when you genuinely need private member access.

See anti-patterns-and-reflection.md for full guidance.


Code Organization

csharp
// File: Domain/Orders/Order.cs

namespace MyApp.Domain.Orders;

// 1. Primary domain type
public record Order(
    OrderId Id,
    CustomerId CustomerId,
    Money Total,
    OrderStatus Status,
    IReadOnlyList<OrderItem> Items
)
{
    public bool IsCompleted => Status is OrderStatus.Completed;

    public Result<Order, OrderError> AddItem(OrderItem item)
    {
        if (Status is not OrderStatus.Draft)
            return Result<Order, OrderError>.Failure(
                new OrderError("ORDER_NOT_DRAFT", "Can only add items to draft orders"));

        var newItems = Items.Append(item).ToList();
        var newTotal = new Money(
            Items.Sum(i => i.Total.Amount) + item.Total.Amount,
            Total.Currency);

        return Result<Order, OrderError>.Success(
            this with { Items = newItems, Total = newTotal });
    }
}

// 2. Enums for state
public enum OrderStatus { Draft, Submitted, Processing, Completed, Cancelled }

// 3. Related types
public record OrderItem(ProductId ProductId, Quantity Quantity, Money UnitPrice)
{
    public Money Total => new(UnitPrice.Amount * Quantity.Value, UnitPrice.Currency);
}

// 4. Value objects
public readonly record struct OrderId(Guid Value)
{
    public static OrderId New() => new(Guid.NewGuid());
}

// 5. Errors
public readonly record struct OrderError(string Code, string Message);

Best Practices Summary

DO's
  • Use record for DTOs, messages, and domain entities
  • Use readonly record struct for value objects
  • Leverage pattern matching with switch expressions
  • Enable and respect nullable reference types
  • Use async/await for all I/O operations
  • Accept CancellationToken in all async methods
  • Use Span<T> and Memory<T> for high-performance scenarios
  • Accept abstractions (IEnumerable<T>, IReadOnlyList<T>)
  • Use Result<T, TError> for expected errors
  • Pool buffers with ArrayPool<T> for large allocations
  • Prefer composition over inheritance
DON'Ts
  • Don't use mutable classes when records work
  • Don't use classes for value objects (use readonly record struct)
  • Don't create deep inheritance hierarchies
  • Don't ignore nullable reference type warnings
  • Don't block on async code (.Result, .Wait())
  • Don't use byte[] when Span<byte> suffices
  • Don't forget CancellationToken parameters
  • Don't return mutable collections from APIs
  • Don't throw exceptions for expected business errors
  • Don't allocate large arrays repeatedly (use ArrayPool)

See anti-patterns-and-reflection.md for detailed anti-pattern examples.


Additional Resources

© sketch7, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files in .agents/skills/modern-csharp-coding-standards of sketch7/FluentlyHttpClient.

  • SKILL.md
  • anti-patterns-and-reflection.md
  • composition-and-error-handling.md
  • performance-and-api-design.md
  • value-objects-and-patterns.md

Open the folder on GitHubat commit 397ee9b

Used in 3 other repositories

We found 3 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 3 other GitHub owners. This page covers the copy in sketch7/FluentlyHttpClient, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Modern Csharp Coding Standards next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Modern Csharp Coding Standards compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Modern Csharp Coding Standards this skillsketch7/FluentlyHttpClient1213 repos~2.7kAutomated safety check: PassMIT
Dotnet Csharpnovotnyllc/dotnet-artisan233—~1.7kAutomated safety check: PassMIT
Akka.NET Best PracticesAaronontheweb/dotnet-skills1.2k1 repos~3.3kAutomated safety check: PassMIT
Review Automation OrchestratorTencentCloudBase/CloudBase-AI-Toolkit1.1k—~1.2kAutomated safety check: PassMIT
.NET API Compatibility DesignAaronontheweb/dotnet-skills1.2k2 repos~2.7kAutomated safety check: PassMIT
Code Qualitypiomin/claude-ai-spring-boot1.3k—~2.2kAutomated safety check: PassApache-2.0

Similar skills

  • Dotnet Csharp

    novotnyllc/dotnet-artisan

    Baseline C skill loaded for every .NET code path. An agent skill from novotnyllc/dotnet-artisan.

    233 GitHub stars~1.7k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Akka.NET Best Practices

    Aaronontheweb/dotnet-skills

    Guidance for Akka.NET actor systems covering EventStream versus DistributedPubSub, supervision, Props versus DependencyResolver, work distribution and testable cluster code.

    1.2k GitHub starsUsed in 1 repo~3.3k tokens
    DevelopmentAuto-check passed
  • Review Automation Orchestrator

    TencentCloudBase/CloudBase-AI-Toolkit

    A skill your agent uses when running or scheduling periodic repository review cycles that must dispatch the correct reviewer, aggregate findings, and escalate outcomes into reports, issues, or…

    1.1k GitHub stars~1.2k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • .NET API Compatibility Design

    Aaronontheweb/dotnet-skills

    Applies extend-only design rules to NuGet packages and distributed systems, covering source, binary and wire compatibility and how to deprecate members safely.

    1.2k GitHub starsUsed in 2 repos~2.7k tokens
    Backend & APIsAuto-check passed
  • Code Quality

    piomin/claude-ai-spring-boot

    Comprehensive code review for Java - clean code principles, API contracts, null safety, exception handling, and performance.

    1.3k GitHub stars~2.2k tokensUpdated 5 mo ago
    DevelopmentAuto-check passed
  • Dynamo Dotnet Expert

    DynamoDS/Dynamo

    Write and review C/.NET code in Dynamo following Dynamo coding standards, modern C patterns, and repo conventions.

    2k GitHub stars~909 tokensUpdated today
    DevelopmentAuto-check passed

More from sketch7/FluentlyHttpClient

  • Csharp Async Patterns

    sketch7/FluentlyHttpClient

    A skill your agent uses when C async/await patterns including Task, ValueTask, async streams, and cancellation.

    121 GitHub starsUsed in 1 repo~5.9k tokens
    Auto-check: notes
  • Dotnet 10 Csharp 14

    sketch7/FluentlyHttpClient

    A skill your agent uses when building .NET 10 or C 14 applications; when using minimal APIs, modular monolith patterns, or feature folders; when implementing HTTP resilience, Options pattern…

    121 GitHub stars~2.2k tokensUpdated 19 days ago
    Auto-check passed
  • Csharp Nullable Types

    sketch7/FluentlyHttpClient

    A skill your agent uses when C nullable reference types, null safety patterns, and migration strategies.

    121 GitHub starsUsed in 1 repo~5.7k tokens
    Auto-check: notes

Works with

Questions about Modern Csharp Coding Standards

What does Modern Csharp Coding Standards do?

Write modern, high-performance C code using records, pattern matching, value objects, async/await, Span<T/Memory<T, and best-practice API design patterns. Modern Csharp Coding Standards is an agent skill from sketch7/FluentlyHttpClient. Write modern, high-performance C code using records, pattern matching, value objects, async/await, Span<T/Memory<T, and best-practice API design patterns.

When should I use Modern Csharp Coding Standards?

Modern Csharp Coding Standards fits situations like: tasks that involve Code quality; tasks that involve Async programming; tasks that involve API design.

How do I install Modern Csharp Coding Standards in Claude Code?

Run `npx skills add sketch7/FluentlyHttpClient --skill modern-csharp-coding-standards -a claude-code`. Or copy the skill folder (.agents/skills/modern-csharp-coding-standards in sketch7/FluentlyHttpClient) into .claude/skills/modern-csharp-coding-standards in your project. Claude Code loads it when a task matches its description.

How do I install Modern Csharp Coding Standards in Codex?

Run `npx skills add sketch7/FluentlyHttpClient --skill modern-csharp-coding-standards -a codex`. Or copy the skill folder (.agents/skills/modern-csharp-coding-standards in sketch7/FluentlyHttpClient) into .agents/skills/modern-csharp-coding-standards in your project. Codex loads it when a task matches its description.

Can I use Modern Csharp Coding Standards in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sketch7/FluentlyHttpClient --skill modern-csharp-coding-standards -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/modern-csharp-coding-standards, .gemini/skills/modern-csharp-coding-standards, .github/skills/modern-csharp-coding-standards and .opencode/skills/modern-csharp-coding-standards in your project.

What does Modern Csharp Coding Standards need to run?

SKILL.md names no scripts, command-line tools or credentials: Modern Csharp Coding Standards is instructions for the agent only.

Does Modern Csharp Coding Standards access the network?

SKILL.md names 1 domain. As links in the text: learn.microsoft.com. This is read from the text; nothing was executed.

Is Modern Csharp Coding Standards safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Modern Csharp Coding Standards use?

Modern Csharp Coding Standards is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Modern Csharp Coding Standards use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Modern Csharp Coding Standards?

Skills that share tags, products or a category with Modern Csharp Coding Standards: Dotnet Csharp (novotnyllc/dotnet-artisan, 233 stars), Akka.NET Best Practices (Aaronontheweb/dotnet-skills, 1.2k stars), Review Automation Orchestrator (TencentCloudBase/CloudBase-AI-Toolkit, 1.1k stars) and .NET API Compatibility Design (Aaronontheweb/dotnet-skills, 1.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Modern Csharp Coding Standards?

sketch7 (a GitHub organization) maintains it in sketch7/FluentlyHttpClient, which has 121 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on September 18, 2026.

Source: sketch7/FluentlyHttpClient on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.