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.
npx agentmods add skills/sergei-aronsen/claude-code-toolkit/llm-patternsnpx skills add sergei-aronsen/claude-code-toolkit --skill llm-patternsgit clone --depth 1 https://github.com/sergei-aronsen/claude-code-toolkitWrote 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.
[](https://agentmods.dev/skills/sergei-aronsen/claude-code-toolkit/llm-patterns)<a href="https://agentmods.dev/skills/sergei-aronsen/claude-code-toolkit/llm-patterns"><img src="https://agentmods.dev/badge/skills/sergei-aronsen/claude-code-toolkit/llm-patterns.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00034 | $0.02415 |
| Opus 5 | $0.00017 | $0.01208 |
| Sonnet 5 | $0.00007 | $0.00483 |
| Haiku 4.5 | $0.00003 | $0.00242 |
Grade A, and why
LLM 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 406 lines — stays where its author put it; the contents beside it link to each section on GitHub.
LLM Patterns Skill
Load this skill when working with LLMs, RAG systems, embeddings, or AI integrations.
Rule
LLM INTEGRATIONS MUST BE ROBUST AND COST-EFFECTIVE!
- Always handle streaming and errors
- Optimize tokens for cost
- Use appropriate models for tasks
Model Selection Guide
| Task | Model | Why |
|---|---|---|
| Complex reasoning | Claude Opus 4.5 / GPT-4 | Best quality |
| General tasks | Claude Sonnet 4.5 / GPT-4o | Balance |
| Simple tasks | Claude Haiku 4.5 / GPT-4o-mini | Fast & cheap |
| Embeddings | text-embedding-3-small | Cost-effective |
| Classification | Fine-tuned small model | Fastest |
RAG Architecture
Basic RAG Flow
Query → Embed Query → Vector Search → Retrieve Chunks → Augment Prompt → LLM → Response
Implementation
async function ragQuery(query: string): Promise<string> {
// 1. Embed the query
const queryEmbedding = await embedText(query);
// 2. Vector search for relevant chunks
const chunks = await vectorStore.similaritySearch(queryEmbedding, {
topK: 5,
minScore: 0.7,
});
// 3. Build context from chunks
const context = chunks.map((c) => c.content).join('\n\n---\n\n');
// 4. Augment prompt
const prompt = `Answer based on the following context:
Context:
${context}
Question: ${query}
Answer:`;
// 5. Get LLM response
return await llm.complete(prompt);
}
Chunking Strategies
Size Guidelines
| Document Type | Chunk Size | Overlap |
|---|---|---|
| Dense text (legal, technical) | 256-512 tokens | 50 tokens |
| General content | 512-1024 tokens | 100 tokens |
| Conversational | 1024-2048 tokens | 200 tokens |
Chunking Methods
// 1. Fixed size chunking
function fixedChunks(text: string, size: number, overlap: number): string[] {
const chunks = [];
for (let i = 0; i < text.length; i += size - overlap) {
chunks.push(text.slice(i, i + size));
}
return chunks;
}
// 2. Semantic chunking (by paragraph/section)
function semanticChunks(text: string): string[] {
return text
.split(/\n\n+/)
.filter((chunk) => chunk.trim().length > 50);
}
// 3. Recursive character splitting (LangChain style)
const splitter = new RecursiveCharacterTextSplitter({
chunkSize: 1000,
chunkOverlap: 200,
separators: ['\n\n', '\n', '. ', ' ', ''],
});
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.
- 4d ago First seen · 406 lines · 34 tokens per session scan A adb961619bd7
LLM Patterns is a skill published in the GitHub repository sergei-aronsen/claude-code-toolkit (5 stars, last pushed 18d ago), licensed MIT. It adds 34 tokens to every session and 2,415 once invoked, about $0.0002 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-31.
Other skills, from other repositories
dspy
DSPy: declarative LM programs, auto-optimize prompts, RAG.
llm-application-dev
Building applications with Large Language Models - prompt engineering, RAG patterns, and LLM integration. Use for AI-powered features, chatbots, or LLM-based automation.
paranoia-ai-system-evolver
用于升级 AI 系统、agent workflow、Codex skill、prompt、memory、RAG、tool routing、schema、eval set 或 feedback loop;也用于把 AI 工作单从指令单升级为意图单,并对研究、检索、测试和 AI 对话做 VOI 决策门审计。需要 Intent Work Order、WOOP 任务准入、决策对象、VOI/EVPI/EVSI、UL(Uncertainty Ladder,不确定性阶梯)、OODA、eval、Human Gate、versioning 与 rollback 的受控演化时使用。Use when controlled AI system…
ai-features
Use this skill when the user needs to add AI-powered features to their SaaS product, integrate LLM APIs, build AI assistants, implement RAG, or use AI to differentiate their product. Covers API selection, prompt engineering for product features, cost management, and building AI features that non-technical founders can…
senior-prompt-engineer
Use when the user asks to optimize prompts, design prompt templates, evaluate LLM outputs with an eval set, measure RAG retrieval quality, validate agent/tool configurations, analyze token usage, or design structured-output contracts. Covers eval-driven prompt iteration, RAG metrics (relevance, faithfulness…
fine-tune-readiness
Decide whether fine-tuning is justified versus prompting or RAG, and gate the training dataset before any LoRA/SFT/DPO run. Use when someone says 'let's fine-tune'.