adopt-pattern

adopt-pattern is a skill for Claude Code, Codex from Totoro-jam/battle-tested-patterns. It costs 151 tokens per session (4,544 once invoked), scanned A, original, MIT.

A guide for choosing and adding low-level software design patterns from a catalogue of 46 established patterns. A design pattern is a reusable way to structure code for a recurring problem.

In plain words
What is it for?
Use it when adding patterns such as a ring buffer, circuit breaker, actor model, cache, rate limiter, trie, or bloom filter to an existing codebase.
Why use it?
It helps prevent choosing a familiar-sounding pattern that does not fit the actual problem. It also requires a regression test, which checks that the pattern’s key behaviour remains correct after later changes.

Skill for Claude CodeCodex

Part of the pattern-skills plugin — 2 skills 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 skills/totoro-jam/battle-tested-patterns/adopt-pattern
Any agent
npx skills add Totoro-jam/battle-tested-patterns --skill adopt-pattern
Clone the repo
git clone --depth 1 https://github.com/Totoro-jam/battle-tested-patterns

Made for: Claude Code, Codex.

Or install pattern-skills, the plugin that ships this one along with the rest of its 2 skills.

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 adopt-pattern

README.md
[![agentmods](https://agentmods.dev/badge/skills/totoro-jam/battle-tested-patterns/adopt-pattern.svg)](https://agentmods.dev/skills/totoro-jam/battle-tested-patterns/adopt-pattern)
Your own site
<a href="https://agentmods.dev/skills/totoro-jam/battle-tested-patterns/adopt-pattern"><img src="https://agentmods.dev/badge/skills/totoro-jam/battle-tested-patterns/adopt-pattern.svg" alt="Measured on agentmods" height="20"></a>
Per session 151 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,544 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.00151 $0.04544
Opus 5 $0.00076 $0.02272
Sonnet 5 $0.00030 $0.00909
Haiku 4.5 $0.00015 $0.00454

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

Security

Grade A, and why

adopt-pattern 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.

plugins/pattern-skills/skills/adopt-pattern/SKILL.md · 205 lines

How it starts

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

Adopt a Pattern

Overview

The Battle-Tested Patterns catalog documents 46 patterns, each in a GitHub source doc (URLs in the catalog below) with a When to Use / When NOT to Use / Related Patterns decision guide, a Production Proof table of real source links, and a multi-language Implementation. Those doc pages are the source of truth — fetch the relevant one rather than relying on memory. This skill routes a developer's problem to the right pattern and then drives a disciplined adoption into their codebase; it does not reproduce the pattern content here.

Two principles do the work:

  1. A pattern is only worth adopting if it fits — the common failure is reaching for a named pattern that doesn't match the problem; the fit-gate catches that before any code is written.
  2. A pattern adopted without a durable test for its invariant is not done — a correct-looking implementation that leaves no regression test lets the invariant rot on the next edit. The verify step leaves that test behind.

When to use

  • A developer names a pattern and wants it in their code.
  • A developer describes a problem (see the catalog cues) without naming a pattern.
  • A developer asks "which pattern fits?" or "X vs Y — which?".

When NOT to use: general feature work with no pattern in play, or a problem no catalog entry matches (say so plainly rather than forcing a fit).

Workflow

Work the four steps in order. Do not skip the fit-gate.

1. Match

Map the problem to candidate patterns using the catalog below. If the developer named a pattern, still confirm it against the cue. If a problem matches several (e.g. "throttle requests" → Rate Limiter, Semaphore, Backpressure), keep 2–3 candidates for the fit-gate.

2. Fit-gate

Fetch only the candidate patterns' doc pages (the Doc URL in the catalog) and focus on When to Use, When NOT to Use, and Related Patterns.

  • If the pattern fits, continue to step 3.
  • If When NOT to Use describes the developer's situation, stop and steer to the better-fit pattern named in Related Patterns. Explain why in one or two sentences.
  • If nothing fits, say so. Do not adopt a pattern to satisfy the request.

Read the full file on GitHub · 205 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 · 205 lines · 151 tokens per session scan A 5b78bea4ecad

Subscribe to this mod's changes

adopt-pattern is a skill published in the GitHub repository Totoro-jam/battle-tested-patterns (340 stars, last pushed today), licensed MIT. It adds 151 tokens to every session and 4,544 once invoked, about $0.0008 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-30.

Related

Other skills, from other repositories

golang

Idiomatic Golang design patterns — functional options, constructors, error flow and cascading, resource management and lifecycle, graceful shutdown, resilience, architecture, dependency injection, data handling, streaming, and more. Apply when explicitly choosing between architectural patterns, implementing functional…

FilippoDeSilva/skills · 80 tokens

oh-my-posh

Install, configure, or troubleshoot Oh My Posh/ohmyposh: shell init, themes, segments, Nerd Font icons, and prompt setup on PowerShell, zsh, bash, or fish.

JanDeDobbeleer/oh-my-posh · 47 tokens

ax-go-gen

Use when writing Go code with github.com/ax-llm/ax/packages/go for AxGen programs, forward calls, indexed multi-sampling, result pickers, streaming, tools, assertions, traces, usage, and output parsing.

ax-llm/ax · 54 tokens

ax-go-llm

Use when writing Go code with github.com/ax-llm/ax/packages/go for using the generated Ax package, factory functions, package docs, examples, and API reference.

ax-llm/ax · 44 tokens

ax-go-audio

Use when writing Go code with github.com/ax-llm/ax/packages/go for audio input/output, OpenAI Responses audio mapping, realtime event folding, and generated package audio examples.

ax-llm/ax · 45 tokens

golang-gomlx

Machine learning models training and inference using GoMLX for Go. It provides an abstraction to create vectorized computation graphs, that can then be JIT-compiled (Just-In-Time) and executed very fast, with backends using XLA (for CPU/CUDA/TPU), Go and others. Includes a reach set of vector (tensors) operations on…

gomlx/gomlx · 143 tokens