chain-llm-pattern — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited chain-llm-pattern (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Multi-step LLM chains outperform single-shot prompts on any task that combines extraction + reasoning. This skill encodes the production pattern.
| Single prompt works | Chain is better |
|---|---|
| "Summarize this email" | "Extract entities, then categorize by urgency, then decide routing" |
| "Translate this to English" | "Detect language, translate, then extract structured fields" |
| "Is this spam? yes/no" | "Score spam probability from email, phone, IP, content separately, then combine" |
Rule of thumb: if the task has ≥2 distinct reasoning steps OR the final decision depends on intermediate structured data, use a chain.
Input → [Extract] → [Analyze/Classify] → [Score/Decide] → OutputEach stage is its own LLM node with its own prompt. Between stages, use Set or Code nodes to transform and validate.
Use `Information Extractor` node (LangChain). NOT a generic AI Agent or raw HTTP call.
Why: Information Extractor binds output to a JSON schema. It parses, retries on invalid JSON, and fails loudly — instead of silently returning prose you then regex.
Define schema explicitly:
{
"type": "object",
"properties": {
"customer_name": { "type": "string" },
"product_mentioned": { "type": "string" },
"sentiment": { "enum": ["positive", "neutral", "negative"] },
"urgency_score": { "type": "number", "minimum": 0, "maximum": 10 }
},
"required": ["customer_name", "sentiment"]
}System prompt for this stage: short, one job. "Extract the fields defined in the schema from the transcript. If a field is absent, omit it. Do not infer or guess."
Use `Basic LLM Chain` with the extracted JSON from Stage 1 as input.
This stage reasons: categorize, cluster, identify patterns, detect issues. The input is structured (from Stage 1) so the model isn't juggling parsing + reasoning simultaneously.
Example system prompt:
Given the extracted customer data below, classify into one of: [technical_issue, billing_question, cancellation_risk, upsell_opportunity]. Then identify the single most important next action. Return JSON withcategoryandnext_action.
If the final step is arithmetic (e.g., composite scoring: 0.4 × email_score + 0.3 × phone_score + 0.3 × content_score), use a `Code` node, NOT an LLM.
LLMs are bad at arithmetic. They fail silently. Use Code (JavaScript) for any math involving weights, thresholds, or aggregation.
| Stage | Recommended model | Why |
|---|---|---|
| Extract | Groq llama-3.3-70b-versatile or openai/gpt-4o-mini | Fast, cheap, good at schema adherence |
| Analyze | Claude Sonnet 4 or GPT-4o | Reasoning quality matters more |
| Score (if LLM) | gpt-4o-mini | Arithmetic weakness, keep cheap |
Groq is the fastest provider for extract stages — 500+ tokens/sec. Use it unless you need Claude/OpenAI specifically.
maxTokens on every LLM node. Stage 1 extract rarely needs >500. Stage 2 analyze rarely >1000.Code node between LLM stages that checks required fields exist. Fail fast with a clear error — don't let a missing field propagate and produce a confusing Stage 3 failure.MySQL or Google Sheets insert after Stage 1 and Stage 2 that records the raw output (truncated to 1000 chars). You WILL need this for debugging.For transcripts in mixed languages, add a Stage 0:
Stage 0 (Groq): Detect language → route to language-specific prompts
Stage 1 (language-specific): Extract in source language
Stage 2: Translate structured output to English (cheap, short)
Stage 3: Analyze in EnglishLanguage-specific prompts extract better than a single multilingual prompt because entity names (cities, products) follow different patterns per language.
Information Extractor.Set node.references/groq-chain-example.json — a working 4-node chain ready to import into n8n~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.