generate-patterns

generate-patterns is a command for coding agents from dykyi-roman/awesome-claude-code. It costs 127 tokens per session (4,460 once invoked), scanned A, original, MIT.

A generator for PHP implementations of common design patterns, including resilience patterns such as retries and circuit breakers, with tests and dependency-injection configuration.

In plain words
What is it for?
Use it to generate patterns such as retries, rate limiting, caching, strategies, builders, factories, sagas, and circuit breakers for PHP 8.4.
Why use it?
It reduces the effort of creating repeatable structures for handling failures, organizing behavior, and composing application components.

Command

Part of the acc plugin — 101 skills, 26 commands, 68 agents, 1 hook shipped together

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/dykyi-roman/awesome-claude-code/generate-patterns
Clone the repo
git clone --depth 1 https://github.com/dykyi-roman/awesome-claude-code

Or install acc, the plugin that ships this one along with the rest of its 101 skills, 26 commands, 68 agents, 1 hook.

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 generate-patterns

README.md
[![agentmods](https://agentmods.dev/badge/commands/dykyi-roman/awesome-claude-code/generate-patterns.svg)](https://agentmods.dev/commands/dykyi-roman/awesome-claude-code/generate-patterns)
Your own site
<a href="https://agentmods.dev/commands/dykyi-roman/awesome-claude-code/generate-patterns"><img src="https://agentmods.dev/badge/commands/dykyi-roman/awesome-claude-code/generate-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 127 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,460 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.00127 $0.04460
Opus 5 $0.00063 $0.02230
Sonnet 5 $0.00025 $0.00892
Haiku 4.5 $0.00013 $0.00446

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

Security

Grade A, and why

generate-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 yesterday.

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.

commands/generate-patterns.md · 707 lines

How it starts

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

Generate Design Patterns

Generate design pattern implementations for PHP 8.4 with tests and DI configuration.

Input Parsing

Parse $ARGUMENTS to extract pattern name, component name, and optional meta-instructions:

Format: <pattern-name> <ComponentName> [-- <meta-instructions>]

Examples:
- /acc:generate-patterns circuit-breaker PaymentGateway
- /acc:generate-patterns strategy PaymentProcessor
- /acc:generate-patterns saga CheckoutWorkflow
- /acc:generate-patterns builder UserProfile -- with validation

Parsing rules:

  1. First part = pattern name (required, see list below)
  2. Second part = component/context name (required)
  3. After -- = meta-instructions (optional customizations)

Supported Patterns

Stability Patterns (Resilience)

Pattern Alias Use Case
circuit-breaker cb Fail-fast for failing external services
retry retry-pattern Transient failure handling with backoff
rate-limiter throttle Request throttling, token bucket
bulkhead isolation Resource isolation, prevent cascade
cache-aside cache Cache-Aside with stampede protection
timeout time-limit Execution time limits with fallback

Behavioral Patterns (Algorithms)

Pattern Alias Use Case
strategy - Interchangeable algorithms
state state-machine State transitions, FSM
chain-of-responsibility chain, middleware Handler pipelines
decorator wrapper Dynamic behavior extension
null-object null Null check elimination
template-method template Algorithm skeleton with hooks
visitor - Operations without class modification
iterator collection Sequential access to collections
memento snapshot, undo State saving/restoration, undo/redo

Structural Patterns (GoF)

Pattern Alias Use Case
adapter wrapper Incompatible interface integration
facade - Simplified subsystem interface
proxy lazy-proxy, caching-proxy Access control, lazy loading, caching
composite tree Tree structures, uniform treatment
bridge - Abstraction-implementation decoupling
flyweight - Memory optimization via shared state

Read the full file on GitHub · 707 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. yesterday First seen · 707 lines · 127 tokens per session scan A eb85f7d82bb0

Subscribe to this mod's changes

generate-patterns is a command published in the GitHub repository dykyi-roman/awesome-claude-code (96 stars, last pushed 19d ago), licensed MIT. It adds 127 tokens to every session and 4,460 once invoked, about $0.0006 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-09-03.