Back to prompts
Implement the following design pattern in the specified language: Design pattern: [e.g. Observer / Strategy / Factory / Singleton / Decorator / Repository / Command / Builder] Language: [e.g. TypeScript / Python / Go / Java / C#] Use case: [a real, specific scenario where this pattern solves a problem — not just a toy example] Provide: 1. Brief explanation: what problem this pattern solves and when to use it (and when NOT to) 2. UML diagram description: describe the class/interface structure in plain text 3. Full implementation: clean, working code with the pattern applied to the use case 4. Usage example: show how client code uses the pattern 5. Benefits in this context: what specifically does this pattern give you here? 6. Trade-offs: what complexity or overhead does it add? 7. Common mistake: the most frequent way developers misapply this pattern Write production-quality code with appropriate typing, error handling, and naming.
How to use this prompt
- 1Copy the prompt using the button above.
- 2Open your AI tool (ChatGPT, Claude, Midjourney, etc.)
- 3Paste and customize any variables in the prompt.
- 4Generate your result.