agentleFS
AndyTechnologiesAndyTechnologies/my-own-skills/skills/design-patterns/SKILL.md

design-patterns

Skill0 starsChanged 38 days agoApache-2.0View on GitHub

Trigger: design patterns, patrones de diseño, pattern selection, architecture, arquitectura, technical design, diseño técnico, GoF, factory, strategy, singleton, anti-pattern. Select GoF + system patterns when forces are present; avoid spamming.

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use logging-patterns, tdd-rust and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • DIL8654Skill

    logging-patterns

    Keep logs structured, correlated, low-noise, and safe for production support. Use when adding operational logging, reviewing observability, or improving diagnostics in .NET services.

    Also in 7 projects that use this

  • FlorianBruniauxSkill

    tdd-rust

    Also in 3 projects that use this

  • nek1987Skill

    solid-principles

    SOLID object-oriented design principles for maintainable code

    Also in 5 projects that use this

  • mstuder-slalomSkill

    jpa-patterns

    JPA/Hibernate patterns for entity design, relationships, query optimization, transactions, auditing, indexing, pagination, and pooling in Spring Boot.

    Also in 6 projects that use this

  • ufodev-ioSkill

    security-guardian

    Comprehensive security layer for all interactions with Claude: audits code, dependencies, commands, configs, and AI-generated output for vulnerabilities. Protects against prompt injection, data leaks, unsafe advice, and social engineering. Works in Cursor, Claude Code, claude.ai, and API contexts. Use always as a background security protocol in any Claude-powered environment.

    Also in 3 projects that use this

  • DIL8654Skill

    api-contract-review

    Review ASP.NET Core Web API contracts for HTTP semantics, versioning, backward compatibility, and response consistency. Use when the user asks to review an API, check endpoints, validate REST behavior, or before releasing contract changes.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 32 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No pattern spamming / Golden Hammer: never apply a familiar pattern to everything.

    line 17
  2. Distinctive:

    Lightest route first: check the lightweight alternative (closures, optionals, direct calls, inheritance, plain functions) BEFORE adding …

    line 18
  3. Distinctive:

    Singleton is the last resort: prefer dependency injection (container-scoped single instance).

    line 19
  4. Distinctive:

    Every pattern adds complexity (classes, indirection, layers) — complexity is the cost you pay, so state the benefit explicitly in the …

    line 22
  5. Distinctive:

    Check the lightweight alternative table column first.

    line 55
  6. Distinctive:

    When a pattern survives, choose the minimal one that covers the forces — not the most elaborate family.

    line 56
  7. Very specific:

    Check the anti-pattern list in references/patterns-decision-guide.md — reject any candidate that degenerates into one.

    line 58
  8. Distinctive:

    If a second pattern would cover the same forces, prefer the one with lower total complexity.

    line 59
  9. Distinctive:

    When a pattern is selected or rejected, record in the artifact: pattern name, forces present, lightweight alternative considered (and why …

    line 63

“Common” is measured: kept by at least 6 in 10 of the 32 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Activation Contract

Load when selecting, applying, or reviewing a design pattern — creational, structural, behavioral, or system architecture (microservices, saga, CQRS, EDA). Applies to design work, architecture review, and implementation that adds abstractions. Read references/patterns-decision-guide.md for the full condensed tables before deciding.

Hard Rules

  • Forces first: apply a pattern ONLY when the forces that motivate it are present. No pattern is correct for every problem.
  • No pattern spamming / Golden Hammer: never apply a familiar pattern to everything. A "perfect, future-flexible" design you cannot justify today is over-design.
  • Lightest route first: check the lightweight alternative (closures, optionals, direct calls, inheritance, plain functions) BEFORE adding indirection, extra classes, or a new abstraction layer.
  • Singleton is the last resort: prefer dependency injection (container-scoped single instance). Global state breaks tests, hides dependencies, couples clients.
  • Visitor is high-risk: it breaks encapsulation and every element-change ripples into all visitors. Use only for stable object structures (e.g. AST walks).
  • Never design an anti-pattern intentionally: God Object, Spaghetti Code, Distributed Monolith, Shared Database, God Gateway, Chatty Communication are failure modes, not trade-offs.
  • Every pattern adds complexity (classes, indirection, layers) — complexity is the cost you pay, so state the benefit explicitly in the artifact.

Decision Gates

Force presentPattern to consider
Create objects, client decoupled from concrete classFactory Method
Family of related products, platform variantsAbstract Factory
Object with many optional params / telescoping constructorBuilder (or named/optional params)
Expensive object creation, need copiesPrototype (or Factory Method)
One shared resource instanceDI container (NOT Singleton)
Incompatible interfaces must coexistAdapter
Add behavior dynamically, transparentlyDecorator (or plain inheritance if static)
Access control / lazy / remote to an objectProxy
Simplify a complex subsystem's surfaceFacade (keep it thin!)
Abstraction and implementation vary independentlyBridge (only for long-lived complex systems)
Trees of uniform parts/wholesComposite
Many small objects, memory-criticalFlyweight
Family of interchangeable algorithmsStrategy (or closures/callbacks)
Behavior changes with internal stateState (or explicit FSM / switch for simple cases)
One-to-many change notificationObserver (unsubscribe or leak!)
Queue / undo / log operationsCommand
Algorithm skeleton with overridable stepsTemplate Method (or callbacks/composition)
Many objects, centralize interactionMediator (watch the god-Mediator)
New operations on a stable object structureVisitor (only stable structures)
Multi-service business transactionSaga (orchestration simple / choreography resilient)
Read/write models differ, query-heavyCQRS (only when justified; never for simple CRUD)
Propagating failure isolationCircuit Breaker / Bulkhead
Small autonomous deployable unitsOnly after Modular Monolith proves the need

Execution Steps

  1. State the concrete problem and the forces present (variation axis, coupling to break, shared state, performance, scale).
  2. Check the lightweight alternative table column first; if it suffices, stop and use it.
  3. When a pattern survives, choose the minimal one that covers the forces — not the most elaborate family.
  4. State the costs explicitly in the design artifact: extra classes/indirection/complexity, and why they pay off.
  5. Check the anti-pattern list in references/patterns-decision-guide.md — reject any candidate that degenerates into one.
  6. If a second pattern would cover the same forces, prefer the one with lower total complexity.

Output Contract

When a pattern is selected or rejected, record in the artifact: pattern name, forces present, lightweight alternative considered (and why rejected), costs added, and the anti-pattern(s) avoided. A rejection is a valid outcome — "no pattern" is a design decision.

References

  • references/patterns-decision-guide.md — condensed tables: full problems, risks, and lightweight alternatives for each GoF + system architecture pattern; explicit anti-pattern catalog.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.