From llm-patterns
INVOKE THIS FIRST before designing any LLM-powered feature. Use when integrating an LLM as a component in a software system — not as a chat interface, but as a decision-making, data-processing, or logic-executing building block. Maps the friction you feel to the pattern that removes it.
How this skill is triggered — by the user, by Claude, or both
Slash command
/llm-patterns:pattern-selectionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
*For using LLMs as engineering components, not chat interfaces.*
For using LLMs as engineering components, not chat interfaces.
LLMs are non-deterministic functions with natural-language interfaces and token-budget constraints. Every pattern in this pack addresses a specific pain that arises from treating an LLM as a software component — not from the LLM itself being "wrong," but from the integration being naive.
Name the pain before naming the pattern.
| Friction | Pattern |
|---|---|
| LLM hallucinates facts not grounded in real data | RAG — ground responses in retrieved documents |
| LLM output breaks my parser, violates my schema, or is unpredictable in shape | Structured Generation — constrain output to a typed schema |
| LLM produces unsafe, off-topic, or policy-violating content | Guardrails — pre/post validation chain |
| LLM performance varies and I need reliable baseline quality | Evaluation Harness — systematic testing against golden datasets |
→ Invoke rag, structured-generation, guardrails, or evaluation-harness.
| Friction | Pattern |
|---|---|
| Prompts are ad-hoc strings scattered through code, hard to test or version | Prompt Engineering — prompts as versioned, tested, composable artifacts |
| A single prompt cannot solve the task — it needs multiple reasoning steps | Prompt Chaining — decompose into a pipeline of simpler prompts |
| The LLM needs to call external functions, APIs, or databases | Tool Use — LLM selects and invokes typed functions |
| The task requires autonomous multi-step reasoning with observations | Agent Loop — observe-think-act state machine with termination |
→ Invoke prompt-engineering, tool-use, or agent-loop.
| Friction | Pattern |
|---|---|
| Primary model is down, slow, or over budget — need a fallback | Graceful Degradation — fallback chain with degradation levels |
| All inputs go to the same expensive model regardless of complexity | Semantic Router — classify and route to the right handler |
| I can't tell if my AI feature is working in production | Evaluation Harness — production monitoring with quality metrics |
| LLM latency is too high for the user experience | Prompt Chaining (stream partial results) or Semantic Router (skip LLM for simple cases) |
→ Invoke graceful-degradation, semantic-router, or evaluation-harness.
| Friction | Pattern |
|---|---|
| Same LLM task runs thousands of times with identical logic | Tool Synthesis — generate a deterministic replacement |
| LLM produces non-deterministic results for a task that should be deterministic | Tool Synthesis — codify the logic as a script |
| Inference cost is accumulating for tasks that do not require reasoning | Tool Synthesis — compile reasoning into a reusable tool |
| Most inputs are simple but all hit the expensive model | Semantic Router (in graceful-degradation) + Tool Synthesis for the deterministic cases |
→ Invoke the tool-synthesis skill.
| These feel similar... | Distinction |
|---|---|
| RAG vs Tool Use | RAG retrieves knowledge to augment context. Tool Use executes actions with side effects. |
| Guardrails vs Structured Generation | Guardrails validate/reject entire inputs or outputs (safety). Structured Generation constrains the output shape (schema). Both can coexist. |
| Agent Loop vs Prompt Chaining | Prompt Chaining is a fixed pipeline — steps are predetermined. Agent Loop is dynamic — the LLM decides the next step based on observations. |
| Semantic Router vs Guardrails | Router dispatches to the right handler. Guardrails block inappropriate content. Router is about efficiency; Guardrails are about safety. |
| Prompt Engineering vs Structured Generation | Prompt Engineering designs the input. Structured Generation constrains the output. One controls what goes in; the other controls what comes out. |
| Tool Synthesis vs Tool Use | Tool Use: LLM calls existing tools at runtime. Tool Synthesis: LLM generates new tools that replace future LLM calls. |
| Tool Synthesis vs Prompt Chaining | Prompt Chaining decomposes into LLM steps. Tool Synthesis eliminates LLM steps by codifying them as deterministic code. |
Before building any LLM-powered feature:
npx claudepluginhub entelligentsia/skillforge --plugin llm-patternsProvides production-ready patterns for building LLM applications: RAG pipelines, document chunking, embedding models, vector database selection, and agent architectures.
Provides production-ready patterns for LLM apps including RAG pipelines, chunking strategies, vector DB selection, embedding models, and AI agent architectures. Use for designing RAG systems, agents, and LLMOps.