new-pattern

new-pattern is a skill for Claude Code from Totoro-jam/battle-tested-patterns. It costs 39 tokens per session (1,504 once invoked), scanned A, original, MIT.

A guided process for adding a new code pattern to the battle-tested-patterns project. A code pattern is a reusable technique for solving a programming problem.

In plain words
What is it for?
Use it to validate a topic, verify examples in public projects, write documentation and exercises, add challenge questions, and prepare bilingual material.
Why use it?
It prevents unsupported or duplicate patterns from being added and requires checking real production code before documenting an example.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/totoro-jam/battle-tested-patterns/new-pattern.svg)](https://agentmods.dev/skills/totoro-jam/battle-tested-patterns/new-pattern)
Your own site
<a href="https://agentmods.dev/skills/totoro-jam/battle-tested-patterns/new-pattern"><img src="https://agentmods.dev/badge/skills/totoro-jam/battle-tested-patterns/new-pattern.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,504 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.1 $0.00039 $0.01504
Opus 5 $0.00019 $0.00752
Sonnet 5 $0.00008 $0.00301
Haiku 4.5 $0.00004 $0.00150

Measured 6d ago against content hash 2a63544ca241, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

new-pattern scanned grade A with 1 finding 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 6d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

3. Verify with `curl -sI <url> | head -1` — must return HTTP 200
.claude/skills/new-pattern/SKILL.md · 135 lines

How it starts

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

Create a New Pattern

You are creating a new pattern for battle-tested-patterns. Follow each step in order. Do NOT skip source verification. Reference SOP 01 for the full checklist.

Step 1: Topic Validation

Ask these questions before proceeding:

  1. What is the pattern name?
  2. Can you name ≥ 2 production projects that use it (with source links)?
  3. Is it cross-language (not specific to one language/framework)?
  4. Is it a code-level technique (not purely architectural)?
  5. Does it NOT duplicate an existing pattern in docs/patterns/?

If any answer is "no", stop and explain why this pattern doesn't fit.

Step 2: Source Code Location

For each production project:

  1. Search the project repo for the exact usage
  2. Get the GitHub URL with line numbers: https://github.com/{org}/{repo}/blob/main/{path}#L{start}-L{end}
  3. Verify with curl -sI <url> | head -1 — must return HTTP 200
  4. Read the code to confirm your understanding
  5. Write a Production Proof description specific enough to learn WITHOUT clicking the link

CRITICAL: Never fabricate a URL. If you cannot verify a link, write <!-- TODO: verify source link --> instead.

Step 3: Write the Document

Create docs/patterns/<pattern-name>/index.md with ALL required sections:

# Pattern: [Name]
## One Liner          ← ≤ 30 English words, capture WHY not just WHAT
## Core Idea          ← concept + diagram (choose best representation for this pattern)
## Production Proof   ← table with ≥ 2 verified URLs, descriptions show HOW not just WHAT
## Implementation     ← TypeScript (required) + ≥ 1 other language in ::: code-group
## Exercises          ← table with basic + intermediate exercise links
## When to Use        ← ≥ 3 concrete scenarios
## When NOT to Use    ← ≥ 2 concrete alternatives
## More Production Uses ← bullet list with repo links
## Challenge Questions ← 3-4 scenario Q&A using ::: details syntax

Diagram Guidelines

  • Choose the representation that best matches the pattern's nature:
    • Ring/circular → for hash rings, ring buffers
    • Timeline → for temporal patterns (WAL, MVCC, retry)
    • State diagram → for state machines, circuit breakers (use mermaid)
    • Tree → for tries, heaps, B-trees
    • Box-and-arrow → for data structures (LRU, skip list)
  • ASCII text blocks: every box border must be vertically aligned
  • ZH docs: CJK characters = 2 display columns; compensate with fewer spaces
  • Verify alignment in a monospace font before committing

Read the full file on GitHub · 135 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. 6d ago First seen · 135 lines · 39 tokens per session scan A 2a63544ca241

Subscribe to this mod's changes

new-pattern is a skill published in the GitHub repository Totoro-jam/battle-tested-patterns (340 stars, last pushed yesterday), licensed MIT. It adds 39 tokens to every session and 1,504 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). 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

comms-context

Fetch on-call and discussion context from Slack threads and PagerDuty incidents — participants, timeline, and status. Auto-loads on Slack permalinks or PagerDuty incident references. Keywords — Slack, thread, PagerDuty, on-call.

lugassawan/swe-workbench · 51 tokens

principle-communication

Caveman output mode — ultra-terse brief replies with fewer tokens. Strips filler, hedging, pleasantries. Three levels — caveman lite (default), caveman full, ultra caveman / max caveman (maximum compression). Persists until normal mode. Auto-load when the user requests terser output, says "be brief", "less tokens"…

lugassawan/swe-workbench · 98 tokens

java-clean-comments

Enforces comment and Javadoc hygiene in Java — no commented-out code, no author or ticket metadata, no comments restating the code, and Javadoc that documents contracts rather than repeating signatures. Use when writing or reviewing Java comments and Javadoc, and when the code shows commented-out blocks, TODO or FIXME…

CasLubbers/code-design-skills · 88 tokens

py-clean-comments

Use when writing, fixing, editing, or reviewing Python comments and docstrings. Enforces Clean Code principles—no metadata, no redundancy, no commented-out code. Also trigger on: commented-out code blocks, TODO/FIXME banners, author/ticket/date metadata in comments, docstrings that no longer match the code, redundant…

CasLubbers/code-design-skills · 0 tokens

ts-clean-comments

Use when writing, fixing, editing, or reviewing TypeScript comments and TSDoc. Enforces Clean Code principles—no metadata, no redundancy, no commented-out code. Also trigger on: commented-out code blocks, TODO/FIXME banners, author/ticket/date metadata in comments or TSDoc, TSDoc that no longer matches the code…

CasLubbers/code-design-skills · 0 tokens

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