csharp-api-design

Guide extend-only public API design for C# libraries and NuGet packages.

3|Updated Jan 24, 2024
One-click install
npx skills add https://github.com/akoken/dotfiles --skill csharp-api-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: csharp-api-design
Source: https://github.com/akoken/dotfiles/tree/main/config/.copilot/skills/csharp-api-design
Command: npx skills add https://github.com/akoken/dotfiles --skill csharp-api-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams design stable, forward-compatible public APIs for C# libraries by applying extend-only design principles. It guides API compatibility, wire compatibility, and versioning to minimize breaking changes in NuGet packages and distributed systems.

Core Features & Use Cases

  • Extend-only design to prevent breaking changes while enabling new functionality
  • API compatibility guidance across releases (API/Source, Binary, and Wire)
  • Versioning strategies and deprecation patterns for smooth migrations
  • Wire-compatibility planning for distributed components and serialized data
  • PR review prompts to enforce non-breaking changes and migration paths
  • Use Case: adding a new feature via overloads or new types without removing existing APIs

Quick Start

Ask: Outline a non-breaking API change for a hypothetical C# library, including how to add new overloads and deprecate old members.

Frequently Asked Questions about csharp-api-design

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

FAQPage Schema
How do I prevent breaking changes when evolving a C# NuGet package?

Extend-only design prevents breaking changes in C# NuGet packages by adding new overloads or new types instead of modifying existing public APIs. This maintains backward and forward compatibility while introducing new features and deprecation paths.

What is extend-only design in C# API development?

Extend-only design in C# API development is a principle where public APIs are only extended, never modified or removed. It enables stable library evolution by introducing new functionality via new overloads and types while keeping existing members intact.

How do I plan wire compatibility for distributed C# components?

Plan wire compatibility for distributed C# components by applying versioning strategies that keep serialized data formats stable across releases. This Skill guides wire-compatibility planning to ensure distributed systems handle schema evolution without breaking communication.

Does this approach support both binary and source compatibility for C# libraries?

Yes, extend-only design supports binary, source, and API compatibility for C# libraries. By avoiding removal or modification of public members, it ensures consumers can update packages without recompilation failures or runtime breaks across different releases.

What is the best way to deprecate old members in a C# public API?

The best way to deprecate old members in a C# public API is to use migration-ready versioning strategies that mark old members as obsolete while introducing new overloads. This enforces non-breaking changes and provides smooth migration paths for consumers.

How do I enforce non-breaking API changes during PR reviews?

Enforce non-breaking API changes during PR reviews by applying extend-only design prompts that verify new features are added via overloads or new types. This ensures migration paths are documented and existing public APIs remain stable for library consumers.