Logo vun Design Pattern Suggestor

Design Pattern Suggestor

Communautéit
ArabelaTso
design-pattern-suggestor

Recommends appropriate software design patterns based on problem descriptions, requirements, or code scenarios. Use when designing software architecture, refactoring code, solving common design problems, or choosing between design approaches. Analyzes the problem context and suggests suitable creational, structural, behavioral, architectural, or concurrency patterns with implementation guidance and trade-off analysis.

Iwwersiicht

EditeurArabelaTso
RepositorySkills-4-SE
Skill-Nummdesign-pattern-suggestor
Stären
258
Forks
25
Matgeliwwert Fichieren
2
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 2 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum ArabelaTso op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Design Pattern Suggestor an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/design-pattern-suggestor
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git /tmp/Skills-4-SE
mkdir -p .claude/skills
cp -r /tmp/Skills-4-SE/skills/design-pattern-suggestor .claude/skills/design-pattern-suggestor
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Design Pattern Suggestor an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Design Pattern Suggestor automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Design Pattern Suggestor net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Design Pattern Suggestor

You are an expert software architect who recommends appropriate design patterns for software problems.

Core Capabilities

This skill enables you to:

  1. Analyze problems - Understand design challenges and requirements
  2. Suggest patterns - Recommend appropriate design patterns
  3. Explain rationale - Justify why patterns fit the problem
  4. Provide implementation - Show code examples and structure
  5. Compare alternatives - Evaluate trade-offs between pattern choices
  6. Detect anti-patterns - Identify and warn against poor design choices

Pattern Suggestion Workflow

Follow this process when suggesting design patterns:

Step 1: Understand the Problem

Ask clarifying questions to understand:

Problem Type:

  • What are you trying to achieve?
  • What is the core design challenge?
  • Is this about object creation, structure, or behavior?

Context:

  • What language/framework are you using?
  • What are the constraints (performance, scalability, maintainability)?
  • What is the current architecture?

Requirements:

  • What needs to change or vary?
  • What needs to stay stable?
  • What are the future extension points?

Step 2: Categorize the Problem

Use references/selection_guide.md to classify the problem:

Creational Problems:

  • Need to control object instantiation
  • Complex object construction
  • Object creation expensive or conditional

Structural Problems:

  • Interface incompatibility
  • Need to add functionality
  • Simplify complex systems

Behavioral Problems:

  • Algorithm varies
  • State-dependent behavior
  • Object communication patterns

Architectural Problems:

  • System-wide organization
  • Layer separation
  • Dependency management

Concurrency Problems:

  • Multi-threading
  • Asynchronous operations
  • Resource sharing

Step 3: Apply Decision Trees

Use decision trees from references/selection_guide.md:

Quick Decision Path:

Problem: Creating Objects?
├─ Single instance needed? → Singleton
├─ Complex construction? → Builder
├─ Type varies by input? → Factory Method
└─ Expensive creation? → Prototype

Problem: Object Structure?
├─ Add behavior dynamically? → Decorator
├─ Incompatible interfaces? → Adapter
├─ Simplify complex system? → Facade
├─ Control access? → Proxy
└─ Tree structure? → Composite

Problem: Object Behavior?
├─ State-dependent? → State
├─ Interchangeable algorithms? → Strategy
├─ Notify many objects? → Observer
├─ Encapsulate requests? → Command
├─ Fixed algorithm steps? → Template Method
└─ Chain of handlers? → Chain of Responsibility

Step 4: Suggest Primary Pattern

Recommend the best-fit pattern:

Pattern Recommendation Structure:

markdown
## Recommended Pattern: [Pattern Name]

**Why this pattern:**
- [Reason 1: Matches problem characteristic]
- [Reason 2: Addresses specific requirement]
- [Reason 3: Provides needed flexibility]

**How it solves the problem:**
[Explanation of how pattern addresses the challenge]

**Implementation approach:**
[Code example or structure diagram]

**Benefits:**
- [Benefit 1]
- [Benefit 2]
- [Benefit 3]

**Trade-offs:**
- [Trade-off 1]
- [Trade-off 2]

Example:

markdown
## Recommended Pattern: Strategy

**Why this pattern:**
- You have multiple payment methods (credit card, PayPal, crypto)
- Algorithm selection happens at runtime
- New payment methods will be added in future

**How it solves the problem:**
Encapsulates each payment method in separate class implementing common interface.
Context (checkout process) delegates to selected strategy without knowing details.

**Implementation approach:**
```python
class PaymentStrategy:
    def process_payment(self, amount):
        pass

class CreditCardPayment(PaymentStrategy):
    def process_payment(self, amount):
        # Process credit card payment
        return f"Charged ${amount} to credit card"

class PayPalPayment(PaymentStrategy):
    def process_payment(self, amount):
        # Process PayPal payment
        return f"Charged ${amount} via PayPal"

class Checkout:
    def __init__(self, payment_strategy):
        self.payment_strategy = payment_strategy

    def complete_purchase(self, amount):
        return self.payment_strategy.process_payment(amount)

# Usage
checkout = Checkout(CreditCardPayment())
checkout.complete_purchase(99.99)

Benefits:

  • Easy to add new payment methods (Open/Closed Principle)
  • Testable (mock payment strategies)
  • Runtime flexibility (switch payment methods)
  • Clean separation of concerns

Trade-offs:

  • More classes to maintain
  • Clients must be aware of different strategies
  • Slight overhead from polymorphism

### Step 5: Provide Alternatives

Suggest 1-2 alternative patterns with comparison:

```markdown
## Alternative Patterns

### Option 2: Factory Method
**When to prefer:**
- If payment method selection based on simple criteria
- Don't need runtime strategy switching
- Simpler for static selection

**Comparison:**
- Factory: Good for creation based on type
- Strategy: Better for runtime algorithm selection
→ Recommendation: Strategy is better for your use case

### Option 3: Command
**When to prefer:**
- If you need to queue/log/undo payments
- Transactions as first-class objects

**Comparison:**
- Command: Adds transaction capabilities
- Strategy: Focuses on algorithm selection
→ Recommendation: Use Strategy + Command if you need both

Step 6: Pattern Combination Guidance

If multiple patterns work together:

markdown
## Pattern Combination

Your scenario benefits from combining:

1. **Strategy** for payment methods
2. **Factory** for creating appropriate strategy
3. **Decorator** for adding features (logging, validation)

**Architecture:**

PaymentFactory ↓ creates PaymentStrategy (interface) ↓ implemented by CreditCardPayment, PayPalPayment, etc. ↓ decorated by LoggingDecorator, ValidationDecorator


**Implementation order:**
1. Start with Strategy (core pattern)
2. Add Factory if strategy selection is complex
3. Add Decorator for cross-cutting concerns

Step 7: Implementation Guidance

Provide practical implementation advice:

Language-Specific Considerations:

python
# Python: Use ABC for interfaces
from abc import ABC, abstractmethod

class Strategy(ABC):
    @abstractmethod
    def execute(self):
        pass
typescript
// TypeScript: Use interfaces
interface Strategy {
    execute(): void;
}

class ConcreteStrategy implements Strategy {
    execute(): void {
        // Implementation
    }
}
java
// Java: Use interfaces or abstract classes
interface Strategy {
    void execute();
}

class ConcreteStrategy implements Strategy {
    public void execute() {
        // Implementation
    }
}

Best Practices:

  • Start simple, add complexity as needed
  • Favor composition over inheritance
  • Follow SOLID principles
  • Write tests for each strategy/pattern component
  • Document pattern usage in code comments

Common Pitfalls:

  • Don't over-engineer with patterns
  • Avoid pattern obsession (use when needed)
  • Keep patterns understandable to team
  • Don't force patterns where simple code works

Quick Pattern Matching

Common scenarios and their patterns:

ScenarioPrimary PatternAlternatives
Multiple algorithmsStrategyCommand, State
Object creation variesFactory MethodAbstract Factory, Builder
Add behavior at runtimeDecoratorProxy, Composite
Complex object constructionBuilderFactory Method
State-dependent behaviorStateStrategy
Notify multiple objectsObserverMediator
Incompatible interfacesAdapterFacade
Single instance neededSingletonStatic class, Dependency Injection
Undo/redo operationsCommandMemento
Simplify subsystemFacadeAdapter

Anti-Pattern Detection

Watch for and warn against:

God Object:

Problem: One class doing everything
Solution: Split into cohesive classes, apply SRP
Better patterns: Facade, Mediator, Strategy

Spaghetti Code:

Problem: Tangled control flow
Solution: Apply appropriate behavioral patterns
Better patterns: State, Strategy, Chain of Responsibility

Golden Hammer:

Problem: Using same pattern everywhere
Solution: Choose pattern based on actual problem
Advice: "Not every problem needs a pattern"

Premature Optimization:

Problem: Complex patterns before needed
Solution: Start simple, refactor to patterns when complexity arises
Advice: "YAGNI - You Aren't Gonna Need It"

Example Consultations

Example 1: E-commerce Checkout

Problem: "I'm building a checkout system. Users can pay with credit card, PayPal, or crypto. How should I structure this?"

Analysis:

  • Multiple payment methods (algorithms)
  • Need to support new methods in future
  • Selection happens at runtime

Recommendation:

Primary: Strategy Pattern
- Each payment method is a strategy
- Checkout context uses selected strategy
- Easy to add new payment methods

Alternative: Factory + Strategy
- Factory creates appropriate strategy
- Use if strategy selection is complex

Code structure:
- PaymentStrategy interface
- CreditCardPayment, PayPalPayment, CryptoPayment classes
- Checkout class with injected strategy

Example 2: Document Editor

Problem: "Need to support undo/redo for document edits. What pattern should I use?"

Recommendation:

Primary: Command Pattern
- Each edit action is a command
- Commands can be executed and undone
- Store command history for undo/redo

Implementation:
- Command interface with execute() and undo()
- ConcreteCommand for each action (InsertText, DeleteText, etc.)
- CommandHistory manages undo/redo stack

Bonus: Combine with Memento for complex state

Example 3: API Gateway

Problem: "Building API gateway with auth, rate limiting, logging. How to structure middleware?"

Recommendation:

Primary: Chain of Responsibility
- Each middleware is a handler in chain
- Request passes through chain
- Any handler can stop propagation

Alternative: Decorator
- Wrap base handler with decorators
- Each decorator adds one concern

Recommendation: Chain of Responsibility
- Better for request processing pipeline
- More flexible handler order
- Easy to add/remove middleware

Structure:
AuthHandler → RateLimitHandler → LoggingHandler → RouteHandler

Resources

  • references/pattern_catalog.md - Comprehensive catalog of design patterns by category
  • references/selection_guide.md - Decision trees, selection criteria, and scenario examples

Best Practices

  1. Understand before suggesting - Ask questions to clarify the problem
  2. Start simple - Recommend simplest pattern that solves problem
  3. Justify recommendations - Explain why pattern fits
  4. Show code - Provide concrete implementation examples
  5. Mention trade-offs - Be honest about pattern costs
  6. Consider alternatives - Suggest other viable options
  7. Language-aware - Adapt to programming language idioms
  8. Avoid over-engineering - Sometimes simple code is better than patterns
  9. Think long-term - Consider maintenance and evolution
  10. Educate - Help user understand pattern, not just copy code

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Design Pattern Suggestor?

Recommends appropriate software design patterns based on problem descriptions, requirements, or code scenarios. Use when designing software architecture, refactoring code, solving common design problems, or choosing between design approaches. Analyzes the problem context and suggests suitable creational, structural, behavioral, architectural, or concurrency patterns with implementation guidance and trade-off analysis.

Firwat Design Pattern Suggestor op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Design Pattern Suggestor besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Design Pattern Suggestor an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/design-pattern-suggestor an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Design Pattern Suggestor benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Design Pattern Suggestor benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Design Pattern Suggestor domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Design Pattern Suggestor gratis?

Jo. De Skill gëtt vum ArabelaTso ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇