Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
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

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Design Patterns

ASecurity

Skeptical design-patterns reference catalog for modern Go and Python — keeps repository, adapter, strategy, decorator, observer, builder; flags the rest as anti-patterns. Consultative, not active: consult before introducing a pattern in code-design-refactor or improve-codebase-architecture, or when pushing back on a cargo-cult one. Not a refactoring rung itself.

2 stars
0 votes
0 copies
2 views
Added 9/23/2026
developmentpythongojavafastapirefactoringapi

Works with

api

Security Analysis

A100/100

Scanned 9/23/2026

Install to Claude Code

$npx -y skills add ralvarezdev/ralvaskills --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/ralvarezdev-design-patterns/badge)](https://www.skillsdirectory.com/skills/ralvarezdev-design-patterns)

More formats (shields.io, HTML) on the badges page.

Download with Pro
Files
SKILL.md
---
name: design-patterns
version: 1.0.1
description: Skeptical design-patterns reference catalog for modern Go and Python — keeps repository, adapter, strategy, decorator, observer, builder; flags the rest as anti-patterns. Consultative, not active: consult before introducing a pattern in code-design-refactor or improve-codebase-architecture, or when pushing back on a cargo-cult one. Not a refactoring rung itself.
---

# Design Patterns — Skeptical, Pragmatic Catalog

Most "design patterns" exist to work around missing language features. **Go and Python in 2026 don't need most of them.** This skill names what's still useful, what's covered by other skills, and what to actively avoid. Detail (code samples, anti-pattern rationale, language-specific smells) lives in [PATTERNS.md](PATTERNS.md). Companion to [ddd-architect](../../design/ddd-architect/SKILL.md), [hexagonal-arch](../../design/hexagonal-arch/SKILL.md), [logic-cleaner](../logic-cleaner/SKILL.md), [improve-codebase-architecture](../improve-codebase-architecture/SKILL.md).

## 1. The framing

Patterns aren't free. Each one:

- Adds a name a future reader has to learn.
- Adds at least one type or function whose only purpose is the pattern.
- Promises a benefit (testability, swappability, polymorphism) that may not pay back if the abstraction has one implementation forever.

**Never introduce a pattern speculatively.** Wait for the *third* place that wants the same behavior (rule of three, per [logic-cleaner §6](../logic-cleaner/SKILL.md#6-duplication-rule-of-three)). One repetition is fine; two might be coincidence; three is a pattern asking to be extracted.

The "Gang of Four" book is a museum piece. Most of its patterns were workarounds for Java's lack of first-class functions, sum types, and structural typing. Modern Go has interfaces-where-used; modern Python has Protocols, dataclasses, and `match`. Neither needs Visitor, Abstract Factory, or Singleton-as-language-feature.

## 2. Patterns still worth knowing — summary

| Pattern | Use when | Skip when |
|---|---|---|
| **Repository** | Domain has aggregates with identity that need persistence | No domain layer — just functions reading/writing rows |
| **Adapter** | Dependency has ≥2 real implementations and a small interface surface | One implementation, no plausible second |
| **Strategy** (as function value) | Behavior varies per caller/context/environment | Single strategy + config flag would do it |
| **Decorator / middleware** | Concern is genuinely cross-cutting | Only one wrapped function — inline the concern |
| **Observer / pub-sub** (as domain events) | Multiple unknown consumers care about a state change | Exactly one consumer — call it directly |
| **Builder** | Many optional params, validation, multi-step assembly | 4 args fit on one line |
| **Factory method** | Caller can't know concrete type at compile time | Caller knows — call constructor directly |
| **Iterator** | Use the language feature (`iter.Seq`, generators) | — never reach for a separate class |

Code samples + rationale in [PATTERNS §1](PATTERNS.md#1-patterns-worth-knowing--detail).

## 3. Patterns to avoid (or replace) — summary

| Pattern | Replace with |
|---|---|
| **Singleton** | Dependency injection — pass instances to constructors |
| **Abstract Factory** | Discriminated union + parse function |
| **Visitor** | Python `match`, Go type switch / interface dispatch |
| **Chain of Responsibility** | Middleware chain (`func(handler) handler`) |
| **Mediator** | Domain events or direct calls |
| **Template Method** (inheritance) | Composition + functions/strategies passed in |
| **Prototype / Memento** | Native cloning + serialization |

Detail + worked examples in [PATTERNS §2](PATTERNS.md#2-patterns-to-avoid-or-replace--detail).

## 4. Patterns deferred to other skills

These are real patterns; this skill names them once and points to their owner:

| Pattern | Owner skill |
|---|---|
| Repository | [ddd-architect](../../design/ddd-architect/SKILL.md) §5 |
| Aggregate | [ddd-architect](../../design/ddd-architect/SKILL.md) §3–4 |
| Value Object | [ddd-architect](../../design/ddd-architect/SKILL.md) §3 |
| Domain Event | [ddd-architect](../../design/ddd-architect/SKILL.md) §6 |
| Anticorruption Layer | [ddd-architect](../../design/ddd-architect/SKILL.md) §8 |
| Ports & Adapters | [hexagonal-arch](../../design/hexagonal-arch/SKILL.md) |
| Middleware chain | [nethttp-architect](../../frameworks/nethttp-architect/SKILL.md) §7, [gin-architect](../../frameworks/gin-architect/SKILL.md) §9, [fastapi-architect](../../frameworks/fastapi-architect/SKILL.md) §8 |
| Functional options (Go) | [go-architect](../../languages/go-architect/SKILL.md) §3 |
| Dependency injection | [go-architect](../../languages/go-architect/SKILL.md) §11, [python-architect](../../languages/python-architect/SKILL.md) §3 |
| Iterator / generator | [go-architect](../../languages/go-architect/SKILL.md) §6 |

Don't restate them here — load the owner skill when the topic comes up.

## 5. Decision rules

When asked "should we apply pattern X?":

1. **Is the problem actually there yet?** Has it appeared at least three times (rule of three)? If not — wait. Premature patterns are the most expensive kind of debt because they make existing code more confusing without solving a real problem.
2. **Would a simpler language feature do?** A function value usually beats Strategy. `match` beats Visitor. A goroutine + channel beats Producer-Consumer-with-buffer-class. Reach for patterns *after* you've exhausted what the language gives you for free.
3. **Will there be a second implementation?** Patterns that introduce interfaces (Adapter, Strategy, Repository) only pay back if at least two implementations exist. One adapter is a hypothetical seam — and hypothetical seams are pure cost.
4. **Does it make the code easier to delete?** Good patterns concentrate change — touch one place when the rule evolves. Bad patterns spread change — every variation needs N synchronized files updated.
5. **Does the name carry weight?** "It's a Repository" tells a future reader the persistence shape immediately. "It's a Manager" / "Helper" / "Service" tells them nothing. Use named patterns when the name is genuinely informative; invent ad-hoc structure when no standard name fits.

If the answer to (1) is "no" or to (3) is "no", **skip the pattern** and revisit when reality has caught up.

## 6. Code-smell → pattern map

Quick lookup; see [PATTERNS §3](PATTERNS.md#3-code-smell--pattern-map) for the full table.

The pattern is the *option*, not the answer. Always check the decision rules in §5 first.

## 7. Language-specific anti-patterns

Go and Python each have their own list of "looks like a pattern, is actually a smell" — see [PATTERNS §4](PATTERNS.md#4-language-specific-anti-patterns). Highlights:

- **Go:** `any` everywhere, empty struct receivers, returning interfaces from constructors.
- **Python:** `@staticmethod`-only classes, inheritance for reuse, metaclass magic, `*args/**kwargs` passthrough.

## 8. When a pattern hardens into a convention

If a pattern appears across many skills and projects in this repo (Repository everywhere, Middleware in every HTTP framework), it stops being a "design pattern" decision and becomes a **convention** encoded in the architect skill for that area. Read the architect skill first; this catalog is for when you're in genuinely new territory.

The architect skills already enforce the patterns we use universally. This skill exists for the edge cases where the architect skills don't pre-decide, and for pushing back when someone wants to add a pattern without a real reason.

Attribution

ralvarezdevralvarezdev
View sourceMore from ralvarezdev →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

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 DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

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.

284722 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.

2192 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 ...

9881 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →