Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Design Patterns

ASecurity

Selects, applies, and pushes back on the 23 Gang of Four design patterns. Covers intent, fit, trade-offs, and the cheaper alternative that usually wins. Use when choosing between patterns, naming an existing structure, or refactoring toward one — and when the user says "which pattern", "what pattern should I use", "design pattern", "GoF", "factory", "strategy", "observer", "decorator", "adapter", "singleton", "visitor", or describes a shape a pattern solves: swappable algorithms, notifying su...

2 stars
0 votes
0 copies
1 views
Added 9/19/2026
developmentgoreacttestingrefactoringapi

Works with

api

Security Analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned 9/19/2026

$npx -y skills add CasLubbers/code-design-skills --skill design-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Design Patterns?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Design Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/caslubbers-design-patterns/badge)](https://www.skillsdirectory.com/skills/caslubbers-design-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: design-patterns
description: Selects, applies, and pushes back on the 23 Gang of Four design patterns. Covers intent, fit, trade-offs, and the cheaper alternative that usually wins. Use when choosing between patterns, naming an existing structure, or refactoring toward one — and when the user says "which pattern", "what pattern should I use", "design pattern", "GoF", "factory", "strategy", "observer", "decorator", "adapter", "singleton", "visitor", or describes a shape a pattern solves: swappable algorithms, notifying subscribers, undo/redo, plugin systems, wrapping a third-party API, tree structures, or object creation that has grown unwieldy.
---

# Design patterns

Patterns are named solutions to recurring design problems. They are vocabulary first and structure second — the value is that "this is a Strategy" tells a reader more than 40 lines of code do.

## The gate: do you need one at all?

Apply before recommending any pattern. A pattern that fails the gate costs indirection and buys nothing.

1. **Two real cases now.** A pattern that generalises over one implementation is speculation. One payment provider does not need an Abstract Factory.
2. **Name the pressure.** Which change is hard today? If you cannot point at a concrete edit that hurts, there is no problem to solve.
3. **Try the cheap version first.** A function, a dict/map lookup, a parameter, or a plain `if` beats a class hierarchy until it visibly stops scaling.
4. **Language features come first.** First-class functions replace Strategy and Command. Generators replace Iterator. Decorators/higher-order functions replace the Decorator class. Modules replace Singleton. Reach for the classical structure only when the language idiom runs out.

If the gate fails, say so and propose the simpler design. Recommending a pattern is not the win condition.

## Choosing

Match the *pressure*, not the vocabulary:

| Pressure | Look at |
|---|---|
| Creating an object needs many optional args | Builder |
| Which class to instantiate depends on input | Factory Method, Abstract Factory |
| A family of interchangeable algorithms | Strategy |
| Behaviour changes as an object's state changes | State |
| Many objects must react to one change | Observer |
| An action must be queued, logged, or undone | Command |
| A third-party interface doesn't match yours | Adapter |
| Add responsibilities per instance, not per class | Decorator |
| A messy subsystem needs one entry point | Facade |
| Uniform treatment of leaves and containers | Composite |
| Control access, defer cost, or add caching | Proxy |
| An algorithm's skeleton is fixed, steps vary | Template Method |
| A new operation over a stable type hierarchy | Visitor |
| Several handlers may process a request | Chain of Responsibility |

Full catalog with intent, fit, and trade-offs: [references/PATTERNS.md](references/PATTERNS.md)

## Applying

1. State the pressure and the pattern in one sentence: "Payment methods vary per order, so `PaymentStrategy`."
2. Name types after the pattern (`RetryPolicy`, `OrderObserver`) — this is most of the benefit.
3. Introduce it by refactoring existing code, not by building the structure first and filling it in.
4. Keep the seam narrow: one interface, obvious implementations.
5. Write a test per implementation. If a pattern makes testing harder, it is the wrong pattern.

## Reviewing existing code

Name what is already there ("this is a hand-rolled Observer") before proposing change — often the fix is to make an accidental pattern explicit, not to add a new one.

Over-engineering smells, and the four patterns most often misapplied: [references/ANTIPATTERNS.md](references/ANTIPATTERNS.md)

Attribution

CasLubbersCasLubbers
View sourceSee grades on GitHubMore from CasLubbers →
SSkills Directory ProSkills Directory

Get any skill into Claude in one click.

Download any skill as a ZIP for Claude.ai, Claude Desktop, or .claude/skills. $9/mo.

See Pro

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills Directory ProSkills Directory

Get any skill into Claude in one click.

Download any skill as a ZIP for Claude.ai, Claude Desktop, or .claude/skills. $9/mo.

See Pro

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

285172 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

10311 votes
View all in development →