Design Patterns Implementation

Design Patterns Implementation

Applies design patterns such as Singleton, Factory, Observer, Strategy and Repository to solve architecture problems and follow SOLID principles.

Skill files10 files

references/

scripts/

templates/

SKILL.md98 lines
1
---
2
name: design-patterns-implementation
3
description: >
4
Apply appropriate design patterns (Singleton, Factory, Observer, Strategy,
5
etc.) to solve architectural problems. Use when refactoring code architecture,
6
implementing extensible systems, or following SOLID principles.
7
---
8
9
# Design Patterns Implementation
10
11
## Table of Contents
12
13
- [Overview](#overview)
14
- [When to Use](#when-to-use)
15
- [Quick Start](#quick-start)
16
- [Reference Guides](#reference-guides)
17
- [Best Practices](#best-practices)
18
19
## Overview
20
21
Apply proven design patterns to create maintainable, extensible, and testable code architectures.
22
23
## When to Use
24
25
- Solving common architectural problems
26
- Making code more maintainable and testable
27
- Implementing extensible plugin systems
28
- Decoupling components
29
- Following SOLID principles
30
- Code reviews identifying architectural issues
31
32
## Quick Start
33
34
Minimal working example:
35
36
```typescript
37
class DatabaseConnection {
38
private static instance: DatabaseConnection;
39
private connection: any;
40
41
private constructor() {
42
this.connection = this.createConnection();
43
}
44
45
public static getInstance(): DatabaseConnection {
46
if (!DatabaseConnection.instance) {
47
DatabaseConnection.instance = new DatabaseConnection();
48
}
49
return DatabaseConnection.instance;
50
}
51
52
private createConnection() {
53
return {
54
/* connection logic */
55
};
56
}
57
}
58
59
// Usage
60
const db1 = DatabaseConnection.getInstance();
61
const db2 = DatabaseConnection.getInstance();
62
// ... (see reference guides for full implementation)
63
```
64
65
## Reference Guides
66
67
Detailed implementations in the `references/` directory:
68
69
| Guide | Contents |
70
|---|---|
71
| [Singleton Pattern](references/singleton-pattern.md) | Singleton Pattern |
72
| [Factory Pattern](references/factory-pattern.md) | Factory Pattern |
73
| [Observer Pattern](references/observer-pattern.md) | Observer Pattern |
74
| [Strategy Pattern](references/strategy-pattern.md) | Strategy Pattern |
75
| [Decorator Pattern](references/decorator-pattern.md) | Decorator Pattern |
76
| [Repository Pattern](references/repository-pattern.md) | Repository Pattern |
77
| [Dependency Injection](references/dependency-injection.md) | Dependency Injection |
78
79
## Best Practices
80
81
### ✅ DO
82
83
- Choose patterns that solve actual problems
84
- Keep patterns simple and understandable
85
- Document why patterns were chosen
86
- Consider testability
87
- Follow SOLID principles
88
- Use dependency injection
89
- Prefer composition over inheritance
90
91
### ❌ DON'T
92
93
- Apply patterns without understanding them
94
- Over-engineer simple solutions
95
- Force patterns where they don't fit
96
- Create unnecessary abstraction layers
97
- Ignore team familiarity with patterns
98

© AJ Geddes · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 11,580 prompts

More by @OpenSourceBuffGuy

See all
TDD Green Phase - Make Tests Pass Quickly prompt image

TDD Green Phase - Make Tests Pass Quickly

Makes the agent write only the minimal code needed to turn failing tests green and satisfy a GitHub issue, without over-engineering.

sub-agent, test-driven-development, code-generation, github, for-developers, guardrails, checklist, coding, testing, unit-testing, best-practices, plan-then-execute, clean-code, tool-use, concise

Brand Storytelling Expert prompt image

Brand Storytelling Expert

Turns the AI into a brand storytelling strategist that builds an emotional brand narrative, messaging pillars and channel adaptations for a business.

system-prompt, act-as, branding, brand-voice, storytelling, content-marketing, marketing, copywriting, social-media, persuasive, xml-tags, structured-output, for-marketers, for-small-business-owners, for-founders, guardrails, formal, long-form, business-strategy, content-creation

Black and White Side-Profile Couple Portrait prompt image

Black and White Side-Profile Couple Portrait

Draws a minimalist black and white editorial portrait of two people in side profile against black, lit by dramatic rim light.

image-prompt, nano-banana, photorealistic, black-and-white, portrait, couple, cinematic, minimalist, dramatic-lighting, editorial, film-grain, symmetry, close-up, moody, fashion, for-photographers, for-artists, quick

Reviews

Loading reviews…

Discussion

Loading comments…