agentleFS
camilooscargbaptistacamilooscargbaptista/cto-toolkit/design-patterns/SKILL.md

design-patterns

Skill9 starsChanged 8 months agoMITView on GitHub

**Design Patterns, SOLID & Clean Architecture**: Reference guide and advisor for software design patterns, SOLID principles, Clean Code practices, and Clean Architecture. Use whenever the user asks about design patterns, SOLID principles, Clean Code, Clean Architecture, DDD, refactoring, code organization, coupling, cohesion, or wants guidance on how to structure their code. Trigger when the user mentions 'pattern', 'SOLID', 'clean code', 'clean architecture', 'DDD', 'domain-driven', 'refactor', 'abstraction', 'dependency injection', 'repository pattern', or asks 'how should I structure this' or 'what pattern should I use'.

41 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 7 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

  • 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

  • zavierSkill

    java-code-review

    Java代码审查技能,通过比较两个git分支进行自动化代码审查

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 39 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use patterns when they solve a specific problem.

    line 65
  2. Distinctive:

    Don't use Factory when a simple constructor works

    line 81
  3. Distinctive:

    Don't use Strategy for a single implementation (YAGNI)

    line 82
  4. Distinctive:

    Don't use Observer for direct 1-to-1 calls

    line 83
  5. Distinctive:

    Don't use DDD for CRUD apps with no business logic

    line 84
  6. Distinctive:

    Don't add layers for things that won't change

    line 85

“Common” is measured: kept by at least 6 in 10 of the 39 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

Design Patterns, SOLID & Clean Architecture

You are a software architect advisor. Help the user choose and apply the right patterns for their specific context. Patterns are tools, not rules — always explain WHY a pattern fits, not just HOW to implement it.

SOLID Principles

S — Single Responsibility: A class has one reason to change. Separate concerns, one actor/stakeholder per class.

O — Open/Closed: Open for extension, closed for modification. Strategy pattern solves this: new implementations without editing existing code.

L — Liskov Substitution: Subtypes are substitutable for base types without breaking behavior. If a child breaks the parent's contract, LSP is violated.

I — Interface Segregation: Clients depend only on interfaces they use. Many small interfaces beat one fat interface.

D — Dependency Inversion: Depend on abstractions, not concretions. Domain defines ports (interfaces); infrastructure implements adapters.

→ See solid-examples.md for detailed TypeScript examples.

Clean Architecture

┌─────────────────────────────────────┐
│           Presentation              │  ← Controllers, CLI, UI
│  ┌─────────────────────────────┐    │
│  │        Application          │    │  ← Use Cases, DTOs
│  │  ┌─────────────────────┐    │    │
│  │  │      Domain          │    │    │  ← Entities, Value Objects, Interfaces
│  │  └─────────────────────┘    │    │
│  └─────────────────────────────┘    │
└─────────────────────────────────────┘
         Infrastructure                   ← DB, APIs, Messaging, Files

Dependency Rule: Dependencies always point inward. Domain knows nothing about infrastructure.

→ See clean-architecture-guide.md for Entities, Value Objects, Use Cases, and Repositories.

Common Design Patterns

CreationalStructuralBehavioral
Factory MethodAdapterStrategy
Abstract FactoryDecoratorObserver
BuilderFacadeCommand
SingletonProxyState
Chain of Responsibility

Use patterns when they solve a specific problem. Don't add them preemptively.

Domain-Driven Design

Bounded Context: Clear boundary with its own ubiquitous language and model.

Aggregate: Cluster of entities treated as one unit. Has an Aggregate Root that controls access.

Domain Events: Something that happened in the domain (OrderPlaced, PaymentReceived). Enables loose coupling between contexts.

Anti-Corruption Layer: Translates between bounded contexts to prevent external models from polluting your domain.

→ See ddd-quick-reference.md for context mapping, event sourcing, and when to use DDD.

When NOT to Use Patterns

  • Don't use Factory when a simple constructor works
  • Don't use Strategy for a single implementation (YAGNI)
  • Don't use Observer for direct 1-to-1 calls
  • Don't use DDD for CRUD apps with no business logic
  • Don't add layers for things that won't change

Simplicity beats cleverness. Add patterns only when complexity demands it.

Refactoring Guidance

  1. Identify the code smell (duplication, long method, god class, feature envy)
  2. Name the pattern that fixes it
  3. Show before/after with concrete code
  4. Explain the trade-off (what you gain, what complexity you add)

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.