DesignPatternsLibrary
A comprehensive design patterns library implemented in C#, which covers various design patterns from the most commonly used ones to the lesser-known ones. Get familiar with and learn design patterns through moderately realistic examples.
Install / Use
/learn @nemanjarogic/DesignPatternsLibraryREADME
What are Design Patterns?
In software engineering, a design pattern is a general, repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. In addition, design patterns allow developers to communicate using well-known, well-understood names for software interactions.
Know when to use a certain design pattern, and when not to. No design pattern is a 42 - the answer to life, the universe, and everything. There are situations in which every design pattern easily becomes an antipattern.
Design Pattern Types
Design patterns can be separated into three main categories:
- Creational
Creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation.
- Structural
Structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships among entities. Structural patterns are concerned with how classes and objects are composed to form larger structures.
- Behavioral
Behavioral patterns are concerned with algorithms and the assignment of responsibilities between objects. Behavioral patterns describe not just the patterns of objects or classes but also the patterns of communication between them.
What does this repository contain?
This repository contains a comprehensive design patterns library implemented in C#, which covers various design patterns from the most commonly used ones (Gang of Four) to the lesser-known ones. It enables you to get familiar with and learn design patterns through moderately realistic examples.
| Design Pattern | Type | Description | Introduction | | ------------- |:-------------:| -----|:-------------:| | Abstract Factory | Creational | Provides an interface for creating families of related or dependent objects without specifying their concrete classes.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Adapter | Structural | Allows objects with incompatible interfaces to collaborate.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Bridge | Structural | Lets you split a large class or a set of closely related classes into two separate hierarchies—abstraction and implementation—which can be developed independently of each other.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Builder | Creational | Lets you construct complex objects step by step. The pattern allows you to produce different types and representations of an object using the same construction code.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Chain Of Responsibility | Behavioral | Lets you pass requests along a chain of handlers. Upon receiving a request, each handler decides either to process the request or to pass it to the next handler in the chain.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Command | Behavioral | Turns a request into a stand-alone object that contains all information about the request. This transformation lets you parameterize methods with different requests, delay or queue a request’s execution, and support undoable operations.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Composite | Structural | Lets you compose objects into tree structures and then work with these structures as if they were individual objects. Treat individual objects and compositions of objects uniformly.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Decorator | Structural | Lets you attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors. Extend or alter the functionality of objects at runtime.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Facade | Structural | Provides a simplified interface to a library, a framework, or any other complex set of classes. This makes a complex body of code simpler to use and consume.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Factory Method | Creational | Provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Flyweight | Structural | Lets you fit more objects into the available amount of RAM by sharing common parts of state between multiple objects instead of keeping all of the data in each object. It reduces storage costs for a large number of objects.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Iterator | Behavioral | Lets you traverse elements of a collection without exposing its underlying representation (list, stack, tree, etc.)| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Mediator | Behavioral | Lets you reduce chaotic dependencies between objects. The pattern restricts direct communications between the objects and forces them to collaborate only via a mediator object.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Memento | Behavioral | Lets you save and restore the previous state of an object without revealing the details of its implementation.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Observer | Behavioral | Lets you define a subscription mechanism to notify multiple objects about any events that happen to the object they are observing.| <img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20"> | | Prototype | Creational | Lets you copy existing objects without making your code dependent on their classes.| [<img src="https://github.com/nemanjarogic/DesignPatternsLibrary/blob/main/assets/images/twitter.png" height="16" width="20">](https://t
Related Skills
claude-opus-4-5-migration
84.7kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
84.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Agent Development
84.7kThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
Command Development
84.7kThis skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
