code-patterns

code-patterns is a command for Claude Code from gonzalezpazmonica/pm-workspace. It costs 17 tokens per session (620 once invoked), scanned A, original, MIT.

A catalogue of recurring design and coding patterns found in a project’s own source code. It explains each detected pattern with a short real example and its file location.

In plain words
What is it for?
Use it to browse all detected patterns, inspect one pattern, or see patterns added recently during a sprint.
Why use it?
It makes the team’s existing ways of solving problems easier to discover and reuse. This reduces the need to infer conventions from unrelated files.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: agent in frontmatter.

Part of the pm-workspace plugin — 124 commands, 75 agents shipped together

Good fit Use it to browse all detected patterns, inspect one pattern, or see patterns added recently during a sprint.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/gonzalezpazmonica/pm-workspace/code-patterns
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.

Clone the repo
git clone --depth 1 https://github.com/gonzalezpazmonica/pm-workspace

Made for: Claude Code.

Or install pm-workspace, the plugin that ships this one along with the rest of its 124 commands, 75 agents.

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/gonzalezpazmonica/pm-workspace/code-patterns/github.svg)](https://agentmods.dev/commands/gonzalezpazmonica/pm-workspace/code-patterns)
Your own site
<a href="https://agentmods.dev/commands/gonzalezpazmonica/pm-workspace/code-patterns"><img src="https://agentmods.dev/badge/commands/gonzalezpazmonica/pm-workspace/code-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for code-patterns

Your own site · 80×15
<a href="https://agentmods.dev/commands/gonzalezpazmonica/pm-workspace/code-patterns"><img src="https://agentmods.dev/badge/commands/gonzalezpazmonica/pm-workspace/code-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 620 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00017 $0.00620
Opus 5.5 $0.00007 $0.00248
Sonnet 5.5 $0.00003 $0.00124
Haiku 4.5 $0.00002 $0.00062

Measured 1mo ago against content hash 31fa02d82088, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-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 1mo 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.claude/commands/code-patterns.md · 108 lines

How it starts

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

/code-patterns

🦉 Savia documenta los patterns de tu proyecto con ejemplos reales de tu código.


Cargar perfil de usuario

Grupo: Architecture & Debt — cargar:

  • identity.md — nombre, rol
  • projects.md — proyecto target
  • preferences.md — detail_level

Subcomandos

  • /code-patterns — catálogo completo de patterns detectados
  • /code-patterns {pattern} — detalle de un pattern específico
  • /code-patterns --new — patterns más recientes del sprint

Flujo

Paso 1 — Detectar patterns en el código

Analizar el código del proyecto buscando:

Categoría Patterns a detectar
Arquitecturales Repository, Service, Controller, CQRS, Mediator
Creacionales Factory, Builder, Singleton, DI registration
Estructurales Adapter, Decorator, Facade, Proxy
Comportamiento Strategy, Observer, Command, Chain
Resiliencia Retry, Circuit Breaker, Fallback, Timeout
Testing AAA, Builder, Mother, Fixture

Paso 2 — Extraer ejemplos reales

Para cada pattern detectado:

  1. Encontrar la mejor implementación en el código del equipo
  2. Extraer snippet representativo (máximo 20 líneas)
  3. Identificar fichero y autor

Paso 3 — Generar catálogo

🦉 Code Patterns — {proyecto}

📊 Patterns detectados: {N}

### Repository Pattern
  Usado en: {N} ficheros
  Ejemplo: `src/Repositories/UserRepository.cs`

{snippet de 10-15 líneas}

Convención del equipo: {descripción breve}

### Service Pattern
Usado en: {N} ficheros
Ejemplo: ...

Paso 4 — Identificar patterns ausentes

Comparar con patterns recomendados para la arquitectura detectada. Si faltan patterns esperados → sugerir adopción.


Modo agente (role: "Agent")

status: ok
action: code_patterns
project: sala-reservas
patterns_found: 12
categories:
  architectural: 4
  creational: 2
  structural: 3
  behavioral: 2
  testing: 1
missing_recommended: 2

Restricciones

  • NUNCA incluir snippets de más de 20 líneas
  • NUNCA criticar código — solo documentar patterns
  • Usar ejemplos del propio código, no ejemplos genéricos
  • Respetar autoría — indicar quién escribió cada ejemplo

Read the full file on GitHub · 108 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. 1mo ago First seen · 108 lines · 17 tokens per session scan A 31fa02d82088

Subscribe to this mod's changes

code-patterns is a command published in the GitHub repository gonzalezpazmonica/pm-workspace (50 stars, last pushed 3d ago), licensed MIT. It adds 17 tokens to every session and 620 once invoked, about $0.0001 per session on Opus 5.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.