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 skills add mickeyyaya/refactoring-skills --skill ai-ml-integration-patternsgit clone --depth 1 https://github.com/mickeyyaya/refactoring-skillsWrote 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/mickeyyaya/refactoring-skills/ai-ml-integration-patterns)<a href="https://agentmods.dev/skills/mickeyyaya/refactoring-skills/ai-ml-integration-patterns"><img src="https://agentmods.dev/badge/skills/mickeyyaya/refactoring-skills/ai-ml-integration-patterns/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/mickeyyaya/refactoring-skills/ai-ml-integration-patterns"><img src="https://agentmods.dev/badge/skills/mickeyyaya/refactoring-skills/ai-ml-integration-patterns.svg" alt="Reviewed on agentmods" width="80" 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.1 | $0.00066 | $0.05478 |
| Opus 5 | $0.00033 | $0.02739 |
| Sonnet 5 | $0.00013 | $0.01096 |
| Haiku 4.5 | $0.00007 | $0.00548 |
Grade A, and why
ai-ml-integration-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 10d 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 — 561 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AI/ML Integration Patterns
Overview
Integrating LLMs into production systems introduces failure modes unique to probabilistic outputs: hallucinated facts, unbounded token costs, prompt injection attacks, and unvalidated structured responses. Use this guide when designing, building, or reviewing code that calls LLM APIs, builds RAG pipelines, or orchestrates AI agents.
When to use: Reviewing code that calls OpenAI, Anthropic, or other LLM APIs; evaluating RAG pipeline design; auditing prompt construction; any system that relies on LLM-generated structured output or tool execution loops.
Quick Reference
| Pattern | Core Idea | Primary Red Flag |
|---|---|---|
| RAG Pipeline | Ground LLM answers in retrieved documents | Retrieval without relevance filtering; missing context window budget |
| Prompt Engineering | Structured prompts for reliable, reproducible outputs | Hardcoded prompts scattered in code; no version control |
| Structured Output + Schema | Validate LLM JSON against a schema before using it | Trusting raw LLM output as typed data |
| Tool Use / Function Calling | LLM selects and invokes registered tools; app executes | Executing tool calls without validating arguments |
| LLM Error Handling | Retry rate limits, fall back on model failures, timeout on hangs | No retry on 429; no timeout on streaming calls |
| Token Budget Management | Count, chunk, and truncate to stay within context limits | Unlimited context assembly; no chunk size cap |
| Hallucination Mitigation | Source citation, confidence scoring, guardrails | LLM answers used directly with no grounding check |
| Anti-Patterns | Common misuse patterns that cause prod failures | Prompt injection via user input; no output validation |
Patterns in Detail
1. RAG (Retrieval-Augmented Generation) Pipeline
RAG grounds LLM responses in real data by retrieving relevant documents at query time and injecting them into the context window.
Pipeline stages:
- Embedding — convert documents and queries to dense vectors
- Vector store — index and persist embeddings for ANN search
- Retrieval — query vector store with top-k similarity
- Reranking (optional) — re-score candidates with a cross-encoder
- Context window management — pack retrieved chunks within token budget
- Generation — LLM answers using grounded context
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.
- 10d ago First seen · 561 lines · 66 tokens per session scan A 6706779819f8
ai-ml-integration-patterns is a skill published in the GitHub repository mickeyyaya/refactoring-skills (6 stars, last pushed 5mo ago), licensed MIT. It adds 66 tokens to every session and 5,478 once invoked, about $0.0003 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.
ai-engineering-toolkit
6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching.
llm-app-patterns
Production-ready patterns for building LLM applications. Covers RAG pipelines, agent architectures, prompt IDEs, and LLMOps monitoring. Use when designing AI applications, implementing RAG, building agents, or setting up LLM observability.
llm-security
Use for authorized security assessment of LLM applications and AI agents, including prompt injection, tool abuse, RAG exposure, memory poisoning, and model supply-chain risks.
ai-product
Every product will be AI-powered. The question is whether you'll build it right or ship a demo that falls apart in production.
llm-ops
LLM Operations -- RAG, embeddings, vector databases, fine-tuning, prompt engineering avancado, custos de LLM, evals de qualidade e arquiteturas de IA para producao.