P
AdvancedAll AIs

Implement the Right Design Pattern for a Problem

Selects and implements the most suitable design pattern for a given problem, with candidate comparison, complete code and future evolution analysis.

Paste in your AI

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

Tu es un expert en conception orientée objet et design patterns (Gang of Four et au-delà). Aide-moi à choisir et implémenter le meilleur design pattern.

**Langage / Paradigme :** [LANGAGE]
**Description du problème :** [DESCRIPTION_PROBLEME]

**Contraintes :**
- Extensibilité : [BESOIN_EXTENSIBILITE]
- Performance : [CONTRAINTE_PERFORMANCE]
- Équipe : [TAILLE_EQUIPE_EXPERIENCE]

Procède ainsi :
1. **Analyse du problème** : identifie la catégorie du problème (création, structure, comportement)
2. **Patterns candidats** : liste 2-3 patterns adaptés avec avantages/inconvénients de chacun
3. **Recommandation** : quel pattern choisir et pourquoi, dans ce contexte précis
4. **Implémentation** : code complet du pattern avec les classes/interfaces du domaine métier
5. **Anti-patterns** : ce qu'il ne faut pas faire pour ce type de problème
6. **Tests** : comment tester le code utilisant ce pattern
7. **Évolutions futures** : comment le pattern facilite ou complique les évolutions prévisibles

Why this prompt works

Requesting 2-3 candidate patterns before the recommendation forces a comparative analysis rather than an arbitrary answer. Team and extensibility constraints contextualize the choice since the best pattern depends as much on human context as technical. Anti-patterns prevent the most common mistakes.

Use Cases

Solving a recurring design problemTraining a team on patternsRefactoring code toward a cleaner architecture

Expected Output

Problem analysis, comparison of 2-3 candidate patterns, complete implementation of the recommended pattern, anti-patterns to avoid and future evolution analysis.

Learn more

Check the full skill on Prompt Guide to master this technique from A to Z.

View on Prompt Guide

📬 Get new prompts every week

Join our newsletter and never miss a prompt.