design-patterns
Skill7 starsChanged 15 days agoMITView on GitHub
Gang of Four (GoF) design patterns, with a reference and runnable examples per pattern. Use when a question names a pattern (singleton, factory, builder, observer, strategy, adapter...), describes a design problem a pattern might solve, compares patterns, or asks to review or refactor code using patterns.
33 other projects use a version of this.
Adopted by
Most recently taken up by
- thistleknot/skillstheir own version, first seen Nov 8, 2026
- gustaferiksson/skillstheir own version, first seen Nov 7, 2026
- alexandrecsp/skillstheir own version, first seen Nov 1, 2026
- decebals/claude-code-javatheir own version, first seen Nov 1, 2026
- ralvarez-ai/ralvaskillstheir own version, first seen Nov 1, 2026
- piomin/claude-ai-spring-boottheir own version, first seen Oct 25, 2026
Used with
Projects with it also use logging-patterns, tdd-rust and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
DIL8654Skilllogging-patterns
Keep logs structured, correlated, low-noise, and safe for production support. Use when adding operational logging, reviewing observability, or improving diagnostics in .NET services.
Also in 7 projects that use this
FlorianBruniauxSkilltdd-rust
Also in 3 projects that use this
nek1987Skillsolid-principles
SOLID object-oriented design principles for maintainable code
Also in 5 projects that use this
mstuder-slalomSkilljpa-patterns
JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.
Also in 6 projects that use this
ufodev-ioSkillsecurity-guardian
Comprehensive security layer for all interactions with Claude: audits code, dependencies, commands, configs, and AI-generated output for vulnerabilities. Protects against prompt injection, data leaks, unsafe advice, and social engineering. Works in Cursor, Claude Code, claude.ai, and API contexts. Use always as a background security protocol in any Claude-powered environment.
Also in 3 projects that use this
DIL8654Skillapi-contract-review
Review ASP.NET Core Web API contracts for HTTP semantics, versioning, backward compatibility, and response consistency. Use when the user asks to review an API, check endpoints, validate REST behavior, or before releasing contract changes.
Also in 3 projects that use this
Other versions33 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 33
- rtk-ai/rtk★ 86ksame name
- piomin/claude-ai-spring-boot★ 1.4ksame name
- decebals/claude-code-java★ 763same name
- waybarrios/opencode-power-pack★ 547same name
- FlorianBruniaux/ccboard★ 94same name
- nimadorostkar/Claude-Skills-collection★ 33same name
- DIL8654/claude-code-dotnet-template★ 8same name
- tstapler/dotfiles★ 8same name
- piomin/claude-ai-quarkus★ 7same name
- ralvarez-ai/ralvaskills★ 4same name
23 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository69 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- caching-strategiesSkill
- database-normalizationSkill
- object-oriented-programming-paradigmSkill
- aadc-complianceSkill
- app-store-complianceSkill
- ccpa-cpra-complianceSkill
- coppa-complianceSkill
- dpdp-complianceSkill
- eprivacy-complianceSkill
- eu-ai-act-complianceSkill
- eu-dsa-complianceSkill
- gdpr-complianceSkill
- hipaa-hds-complianceSkill
- lgpd-complianceSkill
- pci-dss-complianceSkill
- pipeda-law25-complianceSkill
- pipl-csl-complianceSkill
- psd2-sca-complianceSkill
- uk-gdpr-complianceSkill
- us-state-privacy-complianceSkill
- world-wide-complianceSkill
- aws-cli-docsSkill
- aws-dynamodb-docsSkill
- aws-ecs-docsSkill
- aws-eks-docsSkill
- aws-iam-docsSkill
- aws-lambda-docsSkill
- aws-s3-docsSkill
- bullmq-docsSkill
- cassandra-docsSkill
- django-docsSkill
- docker-docsSkill
- elasticsearch-docsSkill
- expressjs-docsSkill
- fastapi-docsSkill
- fastify-docsSkill
- firebase-docsSkill
- flask-docsSkill
- git-docsSkill
- github-actions-docsSkill
- gitlab-ci-docsSkill
- grafana-docsSkill
- graphql-docsSkill
- helm-docsSkill
- kafka-docsSkill
- kubernetes-docsSkill
- mongodb-docsSkill
- mysql-docsSkill
- nestjs-docsSkill
- nginx-docsSkill
- opensearch-docsSkill
- opentelemetry-docsSkill
- phoenix-docsSkill
- pinecone-docsSkill
- postgresql-16-docsSkill
- postgresql-17-docsSkill
- postgresql-18-docsSkill
- qdrant-docsSkill
- The first 60 shown.
The file
Files
Design Patterns
Ground every pattern answer in this skill's reference files, not in improvised definitions. A pattern is the answer to specific forces in a design problem: recommend one only when the user's problem shows the forces it resolves.
Workflow
For code reviews or refactoring, first read review and refactoring to trace callers, preserve contracts, and verify a concrete improvement.
- Identify the pattern(s) in the catalog below, by name or by the forces in the user's problem. Done when every pattern the question names or implies is listed, or when no pattern's forces are present; then answer with the plain function, data structure, or language feature that solves the problem.
- Read each identified reference at
references/<pattern>.mdin full. When comparing patterns, read every one compared and contrast their intent, not their structure. - Read the language example at
examples/<pattern>/<pattern>.<ext>for the user's language. For a language without an example, use the reference's Language Notes for the idiomatic form. - Answer with what the pattern does, the forces that call for it, the simpler alternative and when it wins, and code adapted to the user's domain (their own code, when refactoring). Write the language's idiomatic form rather than a literal GoF class diagram: closures for Strategy in JavaScript, enums for State in Rust,
sync.Oncefor Singleton in Go. Done when every identified pattern has all four parts.
Pattern Catalog
Creational
Patterns that abstract the instantiation process.
| Pattern | Intent | Reference |
| Abstract Factory | Create families of related objects without specifying concrete classes | references/abstract-factory.md |
| Builder | Construct complex objects step by step, separating construction from representation | references/builder.md |
| Factory Method | Let subclasses decide which class to instantiate | references/factory-method.md |
| Prototype | Create objects by cloning an existing instance | references/prototype.md |
| Singleton | Ensure a class has one instance with a global access point | references/singleton.md |
Structural
Patterns that compose classes and objects into larger structures.
| Pattern | Intent | Reference |
| Adapter | Convert one interface into another that clients expect | references/adapter.md |
| Bridge | Decouple an abstraction from its implementation so both can vary | references/bridge.md |
| Composite | Treat individual objects and compositions uniformly in tree structures | references/composite.md |
| Decorator | Attach responsibilities to objects dynamically without subclassing | references/decorator.md |
| Facade | Provide a simple unified interface to a complex subsystem | references/facade.md |
| Flyweight | Share fine-grained objects to support large numbers efficiently | references/flyweight.md |
| Proxy | Provide a surrogate that controls access to another object | references/proxy.md |
Behavioral
Patterns that assign responsibilities and manage communication between objects.
| Pattern | Intent | Reference |
| Chain of Responsibility | Pass a request along a chain of handlers until one handles it | references/chain-of-responsibility.md |
| Command | Encapsulate a request as an object, enabling queues and undo | references/command.md |
| Interpreter | Define a grammar and an interpreter for a small language | references/interpreter.md |
| Iterator | Access elements of a collection sequentially without exposing its internals | references/iterator.md |
| Mediator | Centralize complex communication between objects in one mediator | references/mediator.md |
| Memento | Capture and restore an object's internal state without breaking encapsulation | references/memento.md |
| Observer | Notify dependents automatically when an object's state changes | references/observer.md |
| State | Let an object change its behavior when its internal state changes | references/state.md |
| Strategy | Define interchangeable algorithms behind a common interface | references/strategy.md |
| Template Method | Define an algorithm's skeleton, deferring some steps to subclasses | references/template-method.md |
| Visitor | Add operations to an object structure without modifying its classes | references/visitor.md |
Examples
Examples are self-contained and runnable, in Python, C, C++, Java, C#, JavaScript, Rust, Go, PHP, and Swift. Each is written in its language's idiom: C emulates objects with structs and function pointers; Rust and Go use traits, interfaces, and composition in place of inheritance.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

