design-patterns

Recommends GoF and Python-idiomatic design patterns for new code or reviews existing code for pattern smells.

Updated Jun 14, 2026
One-click install
npx skills add https://github.com/AdamKrysztopa/architectural-decisions --skill design-patterns-adamkrysztopa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design-patterns
Source: https://github.com/AdamKrysztopa/architectural-decisions/tree/main/skills/design-patterns
Command: npx skills add https://github.com/AdamKrysztopa/architectural-decisions --skill design-patterns-adamkrysztopa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Choosing the right design pattern is hard in both directions: code that needed a pattern gets tangled, and code that didn't need one gets buried under GoF ceremony. This Skill decides which object-level pattern fits a design problem, or reviews existing code to map smells to the pattern (or Python language feature) that resolves them. ## Core Features & Use Cases - Greenfield pattern selection: A short decision-tree interview (create, structure, vary behavior, resource/idiom, application/concurrency) returns one primary pattern plus its Pythonic form, such as a dict of callables instead of a Strategy class. - Refactoring review: Maps code smells (construction conditionals, hand-rolled singletons, getter/setter pairs, inlined SQL) to the pattern or language feature that fixes them, favoring the smallest change. - Disambiguation and principles: Settles commonly confused pairs (Strategy vs State vs Command, Adapter vs Facade vs Proxy) with one distinguishing question, and names the SOLID/GRASP principle behind each finding. - Use Case: Ask how to make a set of pricing algorithms swappable, and get a recommendation for Strategy implemented as a dict of callables, with guidance on when the full pattern is unnecessary. ## Quick Start Ask the design-patterns skill which pattern fits your class design problem, or point it at a file and request a pattern review.

Frequently Asked Questions about design-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose the right design pattern for my Python code?

Start from what you are trying to do: create an object, structure objects, vary behavior, manage a resource, or handle application/concurrency concerns. A shallow decision tree routes each goal to one pattern, then checks whether a plain Python feature like a function, dataclass, or dict already solves it.

How do I review existing code for design pattern problems?

Read the code and name the smells, such as big construction conditionals, subclass explosions, or manual resource cleanup. Map each smell to the pattern that resolves it, then decide whether the fix is the pattern itself or a Python feature like with, singledispatch, or a module that replaces it.

What is the difference between Strategy, State, and Command patterns?

The distinguishing question is what varies. Strategy swaps an interchangeable algorithm chosen from outside, State changes behavior based on the object's own internal state and transitions, and Command reifies an action so it can be queued, logged, or undone.

When should I avoid using a GoF design pattern in Python?

Avoid the pattern when the language already solves the problem: a module replaces Singleton, a dataclass often replaces Builder, with replaces manual cleanup, and singledispatch replaces Visitor. A pattern earns its ceremony only when the plain-Python version genuinely falls short.

Can a code review conclude that no pattern is needed?

Yes. An already-idiomatic verdict is a valid and often ideal outcome. The review also reports plain duplication or import-time side effects that map to no pattern at all, where the fix is simply extracting a shared function or moving imports.