For agents
Every page on this site is available to coding agents in three ways: a read-only MCP server, raw Markdown over HTTP, and installable skills. Markdown and skills need no account; the MCP server signs you in through your browser on first connect. Starting a build from an idea? The grill skill walks it to production.
Connect over MCP
The server speaks Streamable HTTP, following the MCP 2026-07-28 specification. It is stateless, so older clients that use the 2025 protocol work from the same URL. It is OAuth-protected: on first connect the client opens a browser to sign in. It only reads.
Claude Code
claude mcp add --transport http aipatterns https://aipatterns.dev/mcpCursor
{
"mcpServers": {
"aipatterns": {
"url": "https://aipatterns.dev/mcp"
}
}
}VS Code
{
"servers": {
"aipatterns": {
"type": "http",
"url": "https://aipatterns.dev/mcp"
}
}
}Codex
[mcp_servers.aipatterns]
url = "https://aipatterns.dev/mcp"Clients that only support stdio
{
"mcpServers": {
"aipatterns": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://aipatterns.dev/mcp"
]
}
}
}Tools
- search
- USE FIRST whenever work involves a design pattern, code smell or refactoring - named or suspected (switch statements, long method, duplicated code, strategy, factory, god class). Full-text search of the reference; returns slugs for get_entry. Never answer such questions from memory.
- get_entry
- USE once a slug is known, before implementing or explaining it: the full entry with intent, steps, when (not) to use, and TypeScript/Python/Go/Java examples.
- get_section
- USE instead of get_entry to read a single '##' section - 'Do not use it when', 'Steps', 'Agent checklist', 'Treatment' - at a fraction of the tokens.
- list_entries
- USE to browse the catalogue (patterns, refactoring techniques, code smells, guides) by kind or category when no search term fits.
- recommend
- USE BEFORE implementing any design pattern or restructuring code: describe the concrete problem (e.g. 'a switch statement that gains a case for every new variant', 'a 300-line function'); get likely smells, the refactorings that treat them, candidate patterns and each one's do-not-use warnings.
- get_examples
- USE when writing the implementation: an entry's code examples, optionally filtered to TypeScript, Python, Go or Java.
- check_pattern_fit
- USE BEFORE adding any design pattern to code: returns forces, 'Use it when', 'Do not use it when' and a checklist. Default to no pattern without a current, concrete pain.
- grill_pattern
- USE when you intend to apply a retrieved pattern to a codebase - after check_pattern_fit confirmed fit, before writing any code: returns the pattern's grill - what to inspect in this codebase, infrastructure that may be missing (cache, queue, limiter) with the options' trade-offs and costs, and the questions to settle with the user about scale, performance, reliability, budget and rollout. Not for researching or explaining a pattern.
- compare_patterns
- USE when two patterns both seem to fit (strategy vs state, decorator vs proxy): intent, triggers, do-not-use warnings and trade-offs for 2–4 patterns, so you can pick one - or none.
- find_refactorings
- USE BEFORE any refactoring or cleanup: name the change you want ('remove a switch statement', 'split a long function', 'remove a flag parameter') and get the matching step-by-step techniques and the smells each one fixes.
- get_refactoring_steps
- USE once a technique is chosen: its safe, behavior-preserving steps, 'Watch out' risks and checklist. Apply one step at a time, tests green between steps.
- detect_smells
- USE when reviewing or editing code that seems structurally wrong: describe it or paste a short excerpt, and get likely smells with confirming signs and 'When to ignore' notes before anything is changed.
- get_smell_treatment
- USE after confirming a smell: its treatment, when to ignore it, and the refactoring techniques that fix it.
Resources: aipatterns://index and aipatterns://entry/{slug}. Every tool is annotated read-only and idempotent.
Plain HTTP
- Add
.mdto any page URL, e.g. /design-patterns/strategy.md. - Or send
Accept: text/markdownto any page URL. - /llms.txt is the index, and /llms-full.txt has every entry in one file.
curl -H "Accept: text/markdown" https://aipatterns.dev/refactoring/smells/long-methodRules for agents
- Name the problem (a smell, or a force that hurts) before reaching for a pattern.
- Read “Do not use it when” before “Use it when”.
- Intending to implement a pattern: call
grill_pattern(or run the aipatterns-grill skill) - inspect the code and existing infrastructure, then settle scale, reliability and budget questions with the user before writing code. - Prefer a language feature (function values, generics, sum types) over a pattern that emulates it.
- Refactor in small, behavior-preserving steps, and run the tests after each one.
- Cite the entry URL in your explanation, so a human can check your reasoning.