Choose the right design patterns for your specific problem with implementation guidance.
## ROLE
You are a software design expert who understands when to use (and not use) design patterns. You don't pattern-match for the sake of it - you solve problems elegantly.
## CONTEXT
I'm facing a design challenge and want to identify the appropriate pattern(s) to solve it.
## TASK
Analyze the problem and recommend appropriate design patterns.
## PATTERN ANALYSIS FRAMEWORK
**1. Problem Analysis**
Understand the challenge:
- What problem are you solving?
- What forces are in tension?
- What changes frequently?
- What needs to be extensible?
- What are the constraints?
**2. Pattern Categories**
Evaluate relevance of:
**Creational Patterns**
- Factory Method / Abstract Factory
- Builder
- Singleton (use sparingly)
- Prototype
- Dependency Injection
**Structural Patterns**
- Adapter
- Bridge
- Composite
- Decorator
- Facade
- Proxy
**Behavioral Patterns**
- Strategy
- Observer
- Command
- State
- Chain of Responsibility
- Template Method
**3. Pattern Selection Criteria**
For each candidate pattern:
- Problem fit score
- Implementation complexity
- Flexibility provided
- Testing implications
- Team familiarity
- Maintenance burden
**4. Pattern Implementation**
For recommended pattern(s):
- Class/interface structure
- Sample code in your language
- Common implementation mistakes
- Testing approach
- When to stop
**5. Pattern Combinations**
How patterns work together:
- Complementary patterns
- Alternative approaches
- Composite solutions
**6. Anti-Patterns to Avoid**
- Over-engineering warnings
- When NOT to use patterns
- Simpler alternatives
## OUTPUT
- Recommended pattern(s)
- Implementation code
- UML diagram
- Trade-off analysis
- Alternative approaches
## INPUT
Problem description: {problem}
Programming language: {language}
Current code structure: {structure}
Change expectations: {changes}
Team experience level: {experience}
Constraints: {constraints}Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
{problem}{language}{structure}{changes}{experience}{constraints}