Software design patterns including GoF patterns with modern implementations, when to use each pattern, anti-patterns to avoid, and language-specific idioms across creational, structural, and behavioral categories.
A skill is a written procedure a bot loads when a job calls for it. This one is a single file, SKILL.md, and the whole file is on this page.
You are an expert in software design patterns. Apply patterns to solve recurring design problems, not to demonstrate knowledge. Every pattern introduces complexity; use one only when the problem it solves is present. Prefer the simplest solution that works.
Pattern Selection Framework
Before applying a pattern, answer:
What problem am I solving? Name the specific design tension.
Software design patterns including GoF patterns with modern implementations, when to use each pattern, anti-patterns to avoid, and language-specific idioms across creational, structural, and behavioral categories.
How much does it cost?+
Nothing. It ships with Murage, which is open source. Your bots run on the AI plan you already have.
Can I change it?+
Yes. Open it in Settings → Skills to read, edit or duplicate it. Skill Guard scans it again after every edit.
Give your first job to Murage.
Download the app, connect the AI you already pay for, and tell your Chief of Staff what needs doing. Plan on about ten minutes from install to a working team.
What it teaches a bot, what it covers, and the whole file to read.
The principle
“
You are an expert in software design patterns. Apply patterns to solve recurring design problems, not to demonstrate knowledge. Every pattern introduces complexity; use one only when the problem it solves is present. Prefer the simplest solution that works.
Intent: Ensure a class has only one instance and provide a global point of access.
Use when: Exactly one instance is needed (database connection pool, configuration, logger).
Modern approach: Use dependency injection instead. Singletons create hidden coupling and make testing difficult.
typescript
// Prefer: dependency injection
class App {
constructor(private db: Database, private logger: Logger) {}
}
// If you must: module-level instance (JavaScript/TypeScript)
// The module system ensures single instantiation
const db = new Database(config);
export { db };
When NOT to use: Almost always. Singletons are a code smell. Use DI containers or module-level instances instead.
Abstract Factory
Intent: Create families of related objects without specifying concrete classes.
Use when: System needs to work with multiple families of products (e.g., UI themes, database backends, OS-specific components).
Structural Patterns
Adapter
Intent: Convert the interface of a class into another interface clients expect.
Use when: Integrating with a third-party library, legacy system, or any component whose interface does not match yours.
Intent: Pass a request along a chain of handlers. Each handler either processes it or passes it along.
Use when: Multiple objects can handle a request, and the handler is determined at runtime. Middleware pipelines.
Anti-Patterns to Avoid
Pattern Overuse
Symptom: Every class has an interface, factory, and strategy even when there is only one implementation.
Fix: Apply YAGNI. Add patterns when a second use case appears, not before.
God Object
Symptom: One class that knows and does everything.
Fix: Extract responsibilities into focused classes.
Spaghetti Code
Symptom: No discernible structure. Control flow jumps everywhere.
Fix: Apply Extract Method, then organize into modules.
Golden Hammer
Symptom: Using the same pattern/tool for every problem.
Fix: Learn multiple patterns and choose based on the problem.
Premature Abstraction
Symptom: Creating complex hierarchies before understanding the domain.
Fix: Wait until you have 3+ concrete cases before abstracting. Rule of Three.
Lava Flow
Symptom: Dead code and obsolete patterns left in because nobody understands them.
Fix: Delete dead code. Version control remembers.
Pattern Selection by Problem
Problem
Pattern
Need to create objects without specifying class
Factory Method
Object has many optional configuration options
Builder
Need families of related objects
Abstract Factory
Integrate incompatible interfaces
Adapter
Add behavior without modifying class
Decorator
Simplify complex subsystem
Facade
Control access to an object
Proxy
Choose algorithm at runtime
Strategy
Decouple event producers from consumers
Observer
Need undo/redo
Command
Multiple handlers for a request
Chain of Responsibility
Traverse a collection without exposing internals
Iterator
Define a skeleton algorithm with customizable steps
Template Method
Manage complex state transitions
State
Modern Alternatives
Many GoF patterns exist because of language limitations in 1994. Modern languages offer simpler alternatives:
Pattern
Modern Alternative
Strategy
First-class functions, lambdas
Observer
Reactive streams (RxJS), event emitters
Command
Closures, first-class functions
Template Method
Higher-order functions
Iterator
Language-native iterators, generators
Singleton
Module-scoped instances, DI containers
Factory
Constructor functions, DI containers
Visitor
Pattern matching (Rust, Kotlin, Scala)
Prefer the modern alternative when available in your language. Use the classic pattern when the language lacks the feature or when the pattern provides additional structure needed at scale.
When to Use
Use this skill when:
Designing or implementing design patterns solutions
Reviewing or improving existing design patterns approaches
Making architectural or implementation decisions about design patterns
Learning design patterns patterns and best practices
Troubleshooting design patterns-related issues
Do NOT use this skill when:
The question is about a fundamentally different technology domain
A more specific sibling skill covers the exact topic needed
The user needs a complete hands-on tutorial rather than expert guidance
Output Format
markdown
# Design Patterns Analysis
## Context Assessment
[Situation summary and constraints]
## Recommended Approach
[Primary recommendation with rationale]
## Implementation Steps
1. [Step with specific details]
2. [Step with specific details]
3. [Step with specific details]
## Trade-offs and Considerations
- [Key trade-off 1]
- [Key trade-off 2]
## Next Steps
- [Immediate action item]
- [Follow-up action item]
Example
Input: "Help me implement design patterns for a medium-scale production application"
Output: A structured analysis covering current state assessment, recommended design patterns approach with specific patterns, implementation roadmap with milestones, and risk mitigation strategies tailored to the application scale and constraints.
Edge Cases
Legacy system integration: When design patterns must coexist with legacy approaches, provide a gradual migration path rather than a complete rewrite
Scale mismatch: When the solution complexity exceeds the project scale, recommend a simpler approach and note when to revisit
Team skill gaps: When the team lacks experience with the recommended approach, include learning resources and simpler alternatives
Conflicting requirements: When constraints conflict (e.g., performance vs. maintainability), explicitly state the trade-off and recommend based on stated priorities