/llm-patterns:llm-pattern-selectionfrom 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.
Ships in llm-patterns. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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:
What SKILL.md sets; muted values are Claude Code's defaults
10 skills in this plugin
/agent-loopUse when a task requires autonomous multi-step reasoning — the LLM must observe, decide, act, and iterate until a goal is met or a termination condition is reached. Apply when a single prompt cannot solve the task, the number of steps is not known in advance, and the next step depends on the result of the previous one. Covers ReAct, Plan-and-Execute, state management, termination, and guardrails for autonomous agents./evaluation-harnessUse when you cannot systematically measure whether your LLM feature is working correctly. Apply when testing is based on vibes rather than metrics, when you cannot detect regressions after prompt changes, or when production quality is unknown. Covers evaluation datasets, metrics, regression testing, LLM-as-judge, and production monitoring for non-deterministic systems./graceful-degradationUse when an LLM-powered feature must remain functional when the primary model is slow, down, over budget, or producing low-quality results. Apply when building any production AI feature that users depend on. Covers fallback chains, semantic routing, circuit breakers, cost management, and degradation levels./guardrailsUse when LLM inputs or outputs must be validated for safety, policy compliance, schema conformance, or content appropriateness before they reach users or downstream systems. Apply when LLM responses could contain harmful content, PII leakage, prompt injection, off-topic responses, or policy violations. Covers input validation, output validation, content filtering, and prompt injection defence./prompt-engineeringUse when prompts are ad-hoc strings scattered through code, hard to test, version, or maintain. Apply when building any LLM-powered feature to ensure prompts are treated as first-class engineering artifacts — versioned, tested, composable, and separated from application logic. Covers prompt structure, template patterns, few-shot design, chain-of-thought, and prompt chaining./ragUse when LLM responses must be grounded in factual, up-to-date, or domain-specific data that the model was not trained on. Apply when the LLM hallucinates facts, gives outdated information, lacks knowledge of proprietary data, or needs to cite sources. Covers Retrieval-Augmented Generation — retrieval strategies, chunking, ranking, context assembly, and when simpler alternatives suffice.npx claudepluginhub entelligentsia/skillforge --plugin llm-patternsOther plugins' skills for the same job