Skill Issue ›
Browse Skills ›
Ai llm patterns
Ai llm patterns
Ai llm patterns is an AI agent skill from the GitHub repository rnavarych/alpha-engineer . AI/LLM integration patterns: Anthropic SDK streaming with TypeScript, RAG architecture (chunking, embedding, vector search with pgvector), tool use / function calling, model selection guide (Haiku 4.5 vs Sonnet 5 vs Opus 4.8), prompt caching, structured output with Zod, token cost management. Use wh
How to use this skill
Claude Code: save it as .claude/skills/ai-llm-patterns/SKILL.md
Cursor: save it as .cursor/rules/ai-llm-patterns.md
Codex: save it as .agents/skills/ai-llm-patterns/SKILL.md
ChatGPT, Gemini and other assistants: paste it into custom or project instructions
Skill file
AI/LLM Integration Patterns
When to Use This Skill
Building AI features with Claude / Anthropic SDK
Implementing RAG (Retrieval-Augmented Generation)
Using tool use / function calling patterns
Choosing the right Claude model for the task
Managing token costs and prompt caching
Core Principles
Model selection matters for cost — Haiku is 10× cheaper than Sonnet; Sonnet is 5× cheaper than Opus; use the smallest model that can do the task
Streaming for user experience — start showing text immediately; never make users wait for full response
Tool use for deterministic operations — LLM decides what to do; your code does it safely; never trust LLM output directly for DB writes
Prompt caching for repeated context — system prompts, documents, RAG context: cache if >1024 tokens
RAG chunk size matters — too small (50 tokens) = no context; too large (2000 tokens) = irrelevant context dilutes relevance
References available
references/prompt-engineering.md — streaming with SSE, model selection guide (Haiku/Sonnet/Opus), prompt caching, structured output with Zod
references/rag-architecture.md — chunking strategy, embedding with text-embedding-3-small, pgvector cosine search, retrieval pipeline
references/llm-ops.md — tool use / agent loop pattern, cost tracking, token budgeting, multi-model routing, error handling
Use this skill with your AI agent:
Open on Skill Issue to copy, download, or add to your library.
Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.