design-patterns

design-patterns is a command for Claude Code from spideynolove/claude-dotfiles. It costs 10 tokens per session (1,140 once invoked), scanned A, original, MIT.

A command that examines code for reusable design patterns, design-principle violations, and anti-patterns. Design patterns are common ways to organise software; SOLID is a set of principles for maintainable object-oriented code.

In plain words
What is it for?
Use it to suggest or analyse patterns, check SOLID compliance, find anti-patterns, and produce refactoring proposals for a project or selected file.
Why use it?
It helps explain why code may be difficult to extend and suggests established structures that could address the problem.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/spideynolove/claude-dotfiles/design-patterns
Clone the repo
git clone --depth 1 https://github.com/spideynolove/claude-dotfiles

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for design-patterns

README.md
[![agentmods](https://agentmods.dev/badge/commands/spideynolove/claude-dotfiles/design-patterns.svg)](https://agentmods.dev/commands/spideynolove/claude-dotfiles/design-patterns)
Your own site
<a href="https://agentmods.dev/commands/spideynolove/claude-dotfiles/design-patterns"><img src="https://agentmods.dev/badge/commands/spideynolove/claude-dotfiles/design-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,140 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00010 $0.01140
Opus 5 $0.00005 $0.00570
Sonnet 5 $0.00002 $0.00228
Haiku 4.5 $0.00001 $0.00114

Measured 5d ago against content hash ee4ba3055245, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

design-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude-global-backup/commands/design-patterns.md · 192 lines

How it starts

The opening of the file, as written. The whole thing — 192 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Design Patterns

Suggests design patterns for your code and checks if it follows SOLID principles.

Usage

/design-patterns [analysis_target] [options]

Options

  • --suggest: Suggest applicable patterns (default)
  • --analyze: Analyze existing pattern usage
  • --refactor: Generate refactoring proposals
  • --solid: Check compliance with SOLID principles
  • --anti-patterns: Detect anti-patterns

Basic Examples

# Analyze patterns for entire project
/design-patterns

# Suggest patterns for specific file
/design-patterns src/services/user.js --suggest

# Check SOLID principles
/design-patterns --solid

# Detect anti-patterns
/design-patterns --anti-patterns

Pattern Categories

1. Creational Patterns
  • Factory Pattern: Abstracts object creation
  • Builder Pattern: Step-by-step construction of complex objects
  • Singleton Pattern: Ensures only one instance exists
  • Prototype Pattern: Creates object clones
2. Structural Patterns
  • Adapter Pattern: Converts interfaces
  • Decorator Pattern: Dynamically adds functionality
  • Facade Pattern: Simplifies complex subsystems
  • Proxy Pattern: Controls access to objects
3. Behavioral Patterns
  • Observer Pattern: Implements event notifications
  • Strategy Pattern: Switches algorithms
  • Command Pattern: Encapsulates operations
  • Iterator Pattern: Traverses collections

SOLID Principles We Check

S - Single Responsibility (one class, one job)
O - Open/Closed (open for extension, closed for modification)
L - Liskov Substitution (subtypes should be replaceable)
I - Interface Segregation (don't force unused methods)
D - Dependency Inversion (depend on abstractions, not details)

Output Example

Design Pattern Analysis Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Currently Used Patterns
├─ Observer Pattern: EventEmitter (12 instances)
├─ Factory Pattern: UserFactory (3 instances)
├─ Singleton Pattern: DatabaseConnection (1 instance)
└─ Strategy Pattern: PaymentProcessor (5 instances)

Recommended Patterns
├─ [HIGH] Repository Pattern
│  └─ Where: src/models/*.js
│  └─ Why: Separate data access from business logic
│  └─ Example:
│      class UserRepository {
│        async findById(id) { ... }
│        async save(user) { ... }
│      }
│
├─ [MED] Command Pattern
│  └─ Where: src/api/handlers/*.js
│  └─ Why: Standardize how requests are handled
│
└─ [LOW] Decorator Pattern
   └─ Where: src/middleware/*.js
   └─ Why: Better way to combine features

SOLID Violations Found
├─ [S] UserService: Does too much (auth AND authorization)
├─ [O] PaymentGateway: Must change code to add payment types
├─ [D] EmailService: Depends on specific classes, not interfaces
└─ [I] IDataStore: Has methods nobody uses

How to Fix
1. Split UserService into AuthService and AuthorizationService
2. Add a PaymentStrategy interface for new payment types
3. Create an EmailService interface
4. Break up IDataStore into smaller interfaces

Read the full file on GitHub · 192 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 192 lines · 10 tokens per session scan A ee4ba3055245

Subscribe to this mod's changes

design-patterns is a command published in the GitHub repository spideynolove/claude-dotfiles (2 stars, last pushed 3mo ago), licensed MIT. It adds 10 tokens to every session and 1,140 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.