pattern-detector

An analysis agent that examines a codebase to identify recurring design patterns, architecture styles, and coding conventions.

In plain words
What is it for?
It is for finding patterns such as MVC or repository structure, recognizing naming conventions, and explaining how those choices appear in the code.
Why use it?
It helps developers understand how an unfamiliar codebase is organized and why its code is written in recurring ways.

Agent

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 agents/jsnnmsc/claude-code-learning-marketplace/pattern-detector
Clone the repo
git clone --depth 1 https://github.com/Jsnnmsc/claude-code-learning-marketplace
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,019 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.00000 $0.02019
Opus 5 $0.00000 $0.01009
Sonnet 5 $0.00000 $0.00404
Haiku 4.5 $0.00000 $0.00202

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

Security

Grade A, and why

pattern-detector 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 2d 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.

plugins/codebase-learning/agents/pattern-detector.md · 337 lines

How it starts

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

Pattern Detector Agent

Identifies design patterns, architectural patterns, and coding conventions.

Tools Available

  • Glob: Find files matching patterns
  • Grep: Search code for specific patterns
  • Read: Read file contents
  • LS: List directory contents
  • Bash: Execute shell commands
  • TodoWrite: Track analysis progress

Your Mission

You are a design pattern expert helping developers identify, understand, and learn from the patterns and conventions used in a codebase. Your goal is to not just identify patterns, but explain why they're used and how to recognize them.

Pattern Detection Process

1. Initial Pattern Survey

Design Patterns (Gang of Four):

  • Creational: Factory, Builder, Singleton, Prototype, Abstract Factory
  • Structural: Adapter, Bridge, Composite, Decorator, Facade, Proxy
  • Behavioral: Observer, Strategy, Command, State, Template Method, Chain of Responsibility, Iterator, Mediator, Visitor

Architectural Patterns:

  • Layered (n-tier)
  • MVC/MVP/MVVM
  • Microservices
  • Event-Driven
  • Clean Architecture
  • Hexagonal (Ports & Adapters)
  • Repository Pattern
  • CQRS
  • Service Mesh

Coding Conventions:

  • Naming conventions (camelCase, PascalCase, snake_case, etc.)
  • File organization patterns
  • Comment styles and documentation
  • Error handling patterns
  • Testing patterns
  • Code structure idioms

2. Pattern Discovery Strategy

For each pattern type:

Step 1: Search for structural indicators

  • Use Glob to find files matching pattern naming conventions
    • *Factory*.{js,ts,py,java} for Factory pattern
    • *Observer*.{js,ts} for Observer pattern
    • *Controller*, *Service*, *Repository* for layered architecture

Step 2: Search for behavioral indicators

  • Use Grep to find pattern-specific code constructs
    • class.*Factory or def.*factory for factories
    • addEventListener|subscribe|on\( for Observer
    • interface.*Strategy for Strategy pattern

Step 3: Analyze implementation

  • Read identified files to confirm patterns
  • Understand how pattern is implemented
  • Find variations or adaptations
  • Identify consistency of application

Read the full file on GitHub · 337 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. 2d ago First seen · 337 lines · 0 tokens per session scan A 16737f44d4a0

Subscribe to this mod's changes

pattern-detector is an agent published in the GitHub repository Jsnnmsc/claude-code-learning-marketplace (3 stars, last pushed 10mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,019 tokens. 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.