Skip to content
aaronontheweb avatar

Type Design Performance

Performance-focused .NET type design rules covering sealing, readonly structs, pure static functions, and collection choice.

CCM score
65 of 100
skills.sh installs
716
GitHub stars
1.3K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers sealing classes, readonly structs, static pure functions, deferred enumeration, and immutable collection return types
  • Includes code samples contrasting DO and DON'T patterns, plus ValueTask versus Task and Span/Memory guidance
  • Enforces sealed classes by default and warns that mutable structs cause defensive copies
  • Designed for .NET developers reviewing API design or performance issues in new types and collection-heavy code

Install

$ npx -y skills add aaronontheweb/dotnet-skills --skill type-design-performance -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Type Design for Performance

When to Use This Skill

Use this skill when:

  • Designing new types and APIs
  • Reviewing code for performance issues
  • Choosing between class, struct, and record
  • Working with collections and enumerables

Core Principles

  1. Seal your types - Unless explicitly designed for inheritance
  2. Prefer readonly structs - For small, immutable value types
  3. Prefer static pure functions - Better performance and testability
  4. Defer enumeration - Don't materialize until you need to
  5. Return immutable collections - From API boundaries

Seal Classes by Default

Sealing classes enables JIT devirtualization and communicates API intent.

// DO: Seal classes not designed for inheritance
public sealed class OrderProcessor
{
    public void Process(Order order) { }
}

// DO: Seal records (they're classes)
public sealed record OrderCreated(OrderId Id, CustomerId CustomerId);

// DON'T: Leave unsealed without reason
public class OrderProcessor  // Can be subclassed - intentional?
{
    public virtual void Process(Order order) { }  // Virtual = slower
}

Details

Repository
github.com/aaronontheweb/dotnet-skills
Categories
.NET & C#, Code Review & Quality
First seen
Jun 3, 2026

Questions

Where does the type-design-performance skill rank in the .NET & C# category?

The type-design-performance skill ranks in the top 100 of the .NET & C# category on Claude Marketplaces. It covers sealing classes, using readonly structs, preferring static pure functions, deferring enumeration and choosing collection return types for performance.

What does the type-design-performance skill help an agent do?

It helps an agent design .NET types for performance by sealing classes, using readonly structs and preferring static pure functions. It also guides avoiding premature enumeration, choosing the right collection types and returning immutable collections from APIs.

How do I install the type-design-performance skill?

Run npx -y skills add aaronontheweb/dotnet-skills --skill type-design-performance -y in a project to install it. Once installed, the agent can apply the skill when designing new types and APIs or reviewing code for performance issues.

When should I use the type-design-performance skill?

Use it when designing new types and APIs, choosing between class, struct and record, or working with collections and enumerables. It also suits reviewing .NET code for performance issues.

More from aaronontheweb/dotnet-skills

All 34

Similar to Type Design Performance

More .NET & C#