Recommends appropriate design patterns for code problems. Asks qualifying questions, classifies needs (creational/structural/behavioral/architectural), proposes candidates with decision criteria, and provides before/after implementations.
Ships in claude-skills-collection. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
if/switch ? besoin d'extension sans modification ?| Symptôme du code | Famille | Patterns à considérer |
|---|---|---|
new ConcreteClass() éparpillé | Création | Factory Method, Abstract Factory, Builder |
| Une seule instance globale nécessaire | Création | Singleton (avec précaution), Monostate |
| Interfaces incompatibles | Structure | Adapter, Facade |
| Ajout de comportement sans héritage | Structure | Decorator, Proxy |
| Plusieurs algorithmes interchangeables | Comportement | Strategy, Command |
| Couplage fort entre producteur/consommateur | Comportement | Observer, Mediator, Event Bus |
| État interne qui change le comportement | Comportement | State |
| Pipeline de transformations | Comportement | Chain of Responsibility, Pipeline |
| Logique métier + UI mélangées | Architectural | MVC, MVP, MVVM, Clean Architecture |
| Lecture/écriture asymétriques | Architectural | CQRS, Repository |
Avant (if/switch ingérable) :
// Ajout d'une méthode = modifier cette classe
public decimal CalculateFee(string type, decimal amount) {
if (type == "standard") return amount * 0.02m;
else if (type == "premium") return amount * 0.01m;
else if (type == "corporate") return amount * 0.005m;
throw new ArgumentException();
}
Après (Strategy) :
public interface IFeeStrategy { decimal Calculate(decimal amount); }
public class StandardFee : IFeeStrategy { public decimal Calculate(decimal amount) => amount * 0.02m; }
public class PremiumFee : IFeeStrategy { public decimal Calculate(decimal amount) => amount * 0.01m; }
public class CorporateFee: IFeeStrategy { public decimal Calculate(decimal amount) => amount * 0.005m; }
public class FeeCalculator(IFeeStrategy strategy) {
public decimal Calculate(decimal amount) => strategy.Calculate(amount);
}
// Extension = nouvelle classe, zéro modification existante (OCP)
// Implémentation légère sans dépendance externe
type Handler<T> = (payload: T) => void;
class EventBus<T> {
private handlers: Handler<T>[] = [];
subscribe(h: Handler<T>) { this.handlers.push(h); }
publish(payload: T) { this.handlers.forEach(h => h(payload)); }
}
const orderBus = new EventBus<{ orderId: string; amount: number }>();
orderBus.subscribe(({ orderId }) => console.log(`Email confirmation ${orderId}`));
orderBus.subscribe(({ amount }) => updateStats(amount));
orderBus.publish({ orderId: "123", amount: 500 });
from functools import wraps
def retry(max_attempts=3):
def decorator(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
for attempt in range(max_attempts):
try:
return fn(*args, **kwargs)
except Exception as e:
if attempt == max_attempts - 1:
raise
return wrapper
return decorator
@retry(max_attempts=3)
def call_external_api(url: str) -> dict:
... # logique inchangée
// Contexte : création de parsers selon le format de fichier
public interface DocumentParser { Document parse(InputStream in); }
public class ParserFactory {
public static DocumentParser create(String contentType) {
return switch (contentType) {
case "application/pdf" -> new PdfParser();
case "text/csv" -> new CsvParser();
case "application/json" -> new JsonParser();
default -> throw new UnsupportedFormatException(contentType);
};
}
}
// Ajout d'un format = nouvelle classe + 1 ligne dans le switch
public interface IOrderRepository {
Task<Order?> FindById(Guid id);
Task<IEnumerable<Order>> FindByStatus(OrderStatus status);
Task Save(Order order);
}
// Implémentation swappable : EF Core, Dapper, mock pour tests
public class EfOrderRepository(AppDbContext ctx) : IOrderRepository {
public async Task<Order?> FindById(Guid id) => await ctx.Orders.FindAsync(id);
public async Task Save(Order order) { ctx.Orders.Add(order); await ctx.SaveChangesAsync(); }
// ...
}
if/else avec 2 branches ne justifie pas un Strategy. Le pattern doit réduire la complexité, pas l'augmenter.unsubscribe/Dispose) — sinon fuites mémoire.GET/POST/PUT/DELETE sans règle métier, un simple DAO ou l'ORM direct suffit.| Principe | Patterns qui l'expriment directement |
|---|---|
| S — Single Responsibility | Facade, Command, Repository |
| O — Open/Closed | Strategy, Decorator, Factory Method |
| L — Liskov Substitution | Template Method, Strategy |
| I — Interface Segregation | Adapter, Proxy |
| D — Dependency Inversion | Factory, Abstract Factory, Repository, tous les patterns à base d'interface |
dotnet test --no-build # .NET
npx jest --runInBand # Node/TS
pytest -x # Python
What SKILL.md sets; muted values are Claude Code's defaults
/claude-skills-collection:dev-design-patterns-advisorfrom claude-skills-collection
npx claudepluginhub vantaflow/claude-skills-collection --plugin claude-skills-collection348 skills in this plugin
/agent-a2a-protocol-guideGuide du protocole Agent-to-Agent (A2A) de Google pour l'interopérabilité entre agents IA — découverte, communication et collaboration inter-agents, avec exemples de code, critères de décision et pièges à éviter. Se déclenche avec "A2A", "agent-to-agent", "protocole A2A", "Google A2A", "interopérabilité agents". Also triggers on "agent-to-agent protocol", "agent interoperability", "connect two agents"./agent-agent-observabilityInstrumentation technique d'un agent IA — tracing distribué des appels LLM et outils, spans, métriques custom, corrélation de logs et dashboards de supervision. Pour les alertes et garde-fous de production, voir agent-monitoring-setup. Se déclenche avec "observabilité agent", "tracing agent", "LangSmith", "Langfuse", "OpenTelemetry agent", "spans LLM", "corréler les logs agent". Also triggers on "trace my agent", "LLM tracing", "agent spans"./agent-api-caller-subagentSous-agent spécialisé dans les appels API REST/GraphQL avec retry, auth et transformation de données. Se déclenche avec "sous-agent API", "API caller agent", "agent qui appelle une API", "REST agent", "HTTP agent", "API integration subagent", "external API agent". Also triggers on "subagent that calls an API", "API calling agent", "agent HTTP requests".Other plugins' skills for the same job