type-design-performance

Guide .NET type and API design for performance efficiency.

1|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/bbsbot/mac-md-win --skill type-design-performance-bbsbot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-design-performance
Source: https://github.com/bbsbot/mac-md-win/tree/main/.claude/skills/dotnet/skills/csharp-type-design-performance
Command: npx skills add https://github.com/bbsbot/mac-md-win --skill type-design-performance-bbsbot

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses performance bottlenecks in .NET applications by guiding developers on how to design types and APIs for maximum efficiency.

Core Features & Use Cases

  • Type Optimization: Learn to use sealed classes, readonly structs, and static pure functions effectively.
  • Collection Efficiency: Understand when to defer enumeration and choose the right collection types.
  • Use Case: When building a high-throughput API, apply these principles to ensure your data structures and method calls minimize overhead and maximize processing speed.

Quick Start

Apply the type-design-performance skill to review the provided C# code for performance optimizations.

Frequently Asked Questions about type-design-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize .NET type design for performance?

To optimize .NET type design for performance, seal classes by default, prefer readonly structs for value types, and utilize static pure functions to minimize overhead in critical code paths.

What is the best way to choose collection return types in C# APIs?

The best way to choose collection return types in C# APIs is deferring enumeration and selecting appropriate collection types to maximize processing speed and reduce data structure overhead.

Why should I use sealed classes and readonly structs in .NET?

You should use sealed classes and readonly structs in .NET to prevent inheritance overhead and avoid defensive copying, which ensures maximum efficiency in performance-critical code paths.

Can I apply type design optimization principles to high-throughput C# APIs?

Yes, you can apply type design optimization principles to high-throughput C# APIs by using static pure functions and efficient data structures to minimize method call overhead and maximize speed.

When do I need to defer enumeration in .NET collections?

You need to defer enumeration in .NET collections when building high-throughput APIs, allowing you to choose the right collection types and ensure your method calls minimize processing overhead.