aaronontheweb avatar

Type Design Performance

Here's a focused skill for writing performant .NET types, built by Aaron Stannard. It pushes you toward sealed classes, readonly structs for small immutable values, static pure functions, and deferred enumeration. The principles are opinionated but practical: seal unless you're designing for inheritance, return immutable collections at API boundaries, don't materialize enumerables until you need to. It's passed security audits from Gen Agent Trust Hub, Socket, and Snyk, and has picked up 314 installs with nearly 1,000 GitHub stars. If you're doing API design or code reviews in .NET and want to avoid common performance pitfalls, this gives you a solid checklist.

skills.sh installs
684
GitHub stars
1.3K
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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
}

Sponsors

Details

Repository
github.com/aaronontheweb/dotnet-skills
Categories
Debugging, Design & UI/UX, .NET & C#
First seen
Jun 3, 2026

More from aaronontheweb/dotnet-skills

All 34

Recommended

More Debugging
1aj-geddes avatarperformance-testingaj-geddes/useful-ai-promptsDesign and execute performance tests to measure response times, throughput, and resource utilization. Use for performance test, load test, JMeter, k6, benchmark609skills.sh installs
2jeremylongshore avatarperformance-lighthouse-runnerjeremylongshore/claude-code-plugins-plus-skillsManage performance lighthouse runner operations. Auto-activating skill for Frontend Development. Triggers on: performance lighthouse runner, performance lightho604skills.sh installs
3manaflow-ai avatarcmux-debug-windowsmanaflow-ai/cmuxManage cmux debug windows and related debug menu wiring for Sidebar Debug, Background Debug, and Menu Bar Extra Debug. Use this when the user asks to open/tune 604skills.sh installs
4secondsky avatarweb-performance-optimizationsecondsky/claude-skillsOptimizes web application performance through code splitting, lazy loading, caching strategies, and Core Web Vitals monitoring. Use when improving page load tim576skills.sh installs
5sickn33 avatarapi-fuzzing-bug-bountysickn33/antigravity-awesome-skillsapi fuzzing bug bounty570skills.sh installs
6aj-geddes avatarweb-performance-auditaj-geddes/useful-ai-promptsConduct comprehensive web performance audits. Measure page speed, identify bottlenecks, and recommend optimizations to improve user experience and SEO.548skills.sh installs