csharp-pro

Guides writing modern C# 12/13 and .NET 8/9/10 code with performance and concurrency patterns.

Updated Aug 19, 2026
One-click install
npx skills add https://github.com/nperepichka/Antigravity --skill csharp-pro-nperepichka
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: csharp-pro
Source: https://github.com/nperepichka/Antigravity/tree/main/config/skills/csharp-pro
Command: npx skills add https://github.com/nperepichka/Antigravity --skill csharp-pro-nperepichka

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing modern .NET code requires keeping up with rapidly evolving C# language features and avoiding common production pitfalls like deadlocks, memory pressure, and leaked tasks. This Skill provides concrete patterns and anti-pattern guidance so generated C# code is idiomatic, performant, and safe. ## Core Features & Use Cases - Modern Language Idioms: Primary constructors, immutable records, collection expressions, and exhaustive pattern matching for C# 12/13. - High-Performance Patterns: Zero-allocation parsing with Span<T> and ReadOnlySpan<char>, ArrayPool buffer renting, and ValueTask usage in hot paths. - Concurrency & Reliability: System.Threading.Channels for producer-consumer queues, CancellationToken forwarding, and defensive async practices. - Use Case: When refactoring a legacy .NET service, use this Skill to rewrite synchronous blocking calls into end-to-end async code with proper cancellation support and pooled buffers. ## Quick Start Use the csharp-pro skill to review and modernize my OrderService class with primary constructors, pattern matching, and proper CancellationToken forwarding.

Frequently Asked Questions about csharp-pro

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

FAQPage Schema
How do I write high-performance C# code with Span and ArrayPool?▼

Use ReadOnlySpan<char> for zero-allocation string parsing and rent buffers from ArrayPool<byte>.Shared for batch stream processing. Always return rented buffers in a finally block to avoid pool exhaustion.

How to implement a producer-consumer queue in .NET?▼

Use System.Threading.Channels with Channel.CreateBounded to build a thread-safe queue. Configure BoundedChannelOptions with FullMode, SingleReader, and SingleWriter settings, then expose WriteAsync and ReadAllAsync for producers and consumers.

What are primary constructors in C# 12?▼

Primary constructors let you declare constructor parameters directly on the class or record declaration, enabling concise dependency injection and immutable type definitions. They work with records, classes, and structs in C# 12 and later.

Why does sync-over-async cause deadlocks in .NET?▼

Calling .Result or .Wait() on a Task blocks the thread and can starve the thread pool or deadlock when continuations need the blocked context. The fix is to use await end-to-end and never block on asynchronous code.

When should I use async Task instead of async void?▼

Always use async Task except for event handlers, which require async void. Exceptions in async void methods cannot be caught by callers and crash the process, while async Task allows proper exception propagation and awaiting.

How do I avoid Large Object Heap fragmentation in .NET?▼

Avoid allocating byte arrays larger than 85,000 bytes repeatedly, since they go to the LOH and cause fragmentation. Rent buffers from ArrayPool<byte>.Shared or use RecyclableMemoryStream for large stream operations.