design-patterns

Select and implement design patterns for modern C# projects.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill design-patterns-faysilalshareef
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-patterns
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/core/design-patterns
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill design-patterns-faysilalshareef

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps developers and architects choose and apply the appropriate design pattern or modern C# language feature so solutions remain simple, testable, and idiomatic rather than over-engineered.

Core Features & Use Cases

  • Pattern selection guidance: Explains when to use creational, structural, or behavioral patterns versus modern C# alternatives like delegates, records, and DI.
  • Practical implementation advice: Provides examples and modern replacements (MediatR, DI delegates, record types) and when to prefer lightweight constructs.
  • Use cases: API design deciding between Factory or DI delegates, composing cross-cutting concerns with decorators or MediatR pipeline behaviors, and simplifying state machines with enums.

Quick Start

Ask the assistant to recommend and implement the most appropriate modern C# design pattern for a given scenario, for example: "Design a runtime-selectable notification sender using DI delegates or a factory."

Frequently Asked Questions about design-patterns

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

FAQPage Schema
When should I use modern C# language features instead of classical design patterns?

You should prefer modern C# language features over classical design patterns when a lightweight construct achieves the same goal. Use records, delegates, and dependency injection to keep solutions idiomatic and avoid over-engineering complex structural or behavioral implementations.

How do I choose the right creational, structural, or behavioral pattern for C# API design?

To choose the right C# design pattern for API design, evaluate whether a creational, structural, or behavioral pattern fits the integration scenario. Compare classical GoF patterns against modern alternatives like DI delegates and MediatR pipeline behaviors to ensure testable, simple architecture.

What is the best way to implement a runtime-selectable notification sender in C#?

The best way to implement a runtime-selectable notification sender is by using dependency injection delegates or a factory pattern. This approach allows dynamic selection of notification mechanisms while maintaining loose coupling and testability in modern C# projects.

Can I use MediatR pipeline behaviors to compose cross-cutting concerns instead of the decorator pattern?

Yes, you can use MediatR pipeline behaviors to compose cross-cutting concerns as a modern replacement for the decorator pattern. This approach simplifies system integration by handling logging, validation, and routing centrally without wrapping individual service classes manually.

Why use C# record types for refactoring instead of traditional builder or factory patterns?

Use C# record types during refactoring to replace traditional builder or factory patterns because they provide built-in immutability and value-based equality. This reduces boilerplate code and simplifies data transfer object creation without over-engineering.

Does refactoring state machines with enums simplify C# system integration?

Refactoring state machines with enums simplifies C# system integration by replacing complex behavioral pattern implementations. Enum-based state machines provide clear, lightweight state transitions that are easier to read and maintain than traditional state pattern classes.