dotnet-techne-qa-pipel…
Use when the user asks to verify a story or ticket implementation against its spec - per-AC verdicts, code reuse and design…
Use when writing or refactoring modern C# with maintainability and performance standards. Keywords: coding standards, C# best practices, refactor C#, records, pattern matching, async best practices.
Claude Code
$ npx -y skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-csharp-coding-standards --agent claude-code
Codex
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-csharp-coding-standards -a codex -y
Cursor
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-csharp-coding-standards -a cursor -y
Gemini CLI
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-csharp-coding-standards -a gemini-cli -y
GitHub Copilot
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-csharp-coding-standards -a github-copilot -y
OpenCode
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-csharp-coding-standards -a opencode -y
Windsurf
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-csharp-coding-standards -a windsurf -y
name: dotnet-techne-csharp-coding-standards
description: "Use when writing or refactoring modern C# with maintainability and performance standards. Keywords: coding standards, C# best practices, refactor C#, records, pattern matching, async best practices."
disable-model-invocation: false
user-invocable: true
metadata:
author: Metalnib
version: "1.0.0"
trigger_keywords:
- coding standards
- c# best practices
- refactor c#
- records
- pattern matching
- async best practicesUse this skill when:
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
---
Use `record` types for DTOs, messages, events, and domain entities.
// 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`:**
Value objects should **always be `readonly record struct`** for performance and value semantics. Use explicit conversions, never implicit operators.
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](value-objects-and-patterns.md) for complete examples including multi-value objects, factory patterns, and the no-implicit-conversion rule.
Use switch expressions, property patterns, relational patterns, and list patterns for cleaner code.
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](value-objects-and-patterns.md) for full pattern matching examples.
---
Enable nullable reference types in your project and handle nulls explicitly.
// 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);
}---
**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](composition-and-error-handling.md) for full examples.
---
// 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 cancellatiDotNet Episteme Skills - a curated, manual-first .NET AI skills library rooted in systematic knowledge (episteme) and shaped by disciplined craft (techne), designed for engineers who prioritise precision over hype.
Use when the user asks to verify a story or ticket implementation against its spec - per-AC verdicts, code reuse and design…
Use when the user asks for a phase-gated refactoring or redesign loop - session-blind workers map and trace the area, empirical…
Use when the user asks for a multi-agent .NET code review - five parallel reviewers (correctness, performance,…
Use when reviewing PRs/diffs/branches/documents for .NET quality, correctness, performance, security, data access, messaging, and…
Use when you need CRAP score and coverage risk analysis to find high-risk code before refactoring or release. Keywords: CRAP…
Use when reviewing a .NET pull request for breaking changes that may affect other microservice repositories. Detects cross-repo…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.