error-analysis
Help the user systematically identify and categorize failure modes in an LLM pipeline by reading traces. Use when starting a new eval project, after significant pipeline changes (new features, model switches, prompt rewrites), when production metrics drop, or after incidents.
What this skill does
# Error Analysis Guide the user through reading LLM pipeline traces and building a catalog of how the system fails. ## Overview 1. Collect ~100 representative traces 2. Read each trace, judge pass/fail, and note what went wrong 3. Group similar failures into categories 4. Label every trace against those categories 5. Compute failure rates to prioritize what to fix ## Core Process ### Step 1: Collect Traces Capture the full trace: input, all intermediate LLM calls, tool uses, retrieved documents, reasoning steps, and final output. **Target: ~100 traces.** This is roughly where new traces stop revealing new kinds of failures. The number depends on system complexity. **From real user data (preferred):** - Small volume: random sample - Large volume: sample across key dimensions (query type, user segment, feature area) - Use embedding clustering (K-means) to ensure diversity **From synthetic data (when real data is sparse):** - Use the generate-synthetic-data skill - Run synthetic queries through the full pipeline and capture complete traces ### Step 2: Read Traces and Take Notes Present each trace to the user. For each one, ask: **did the system produce a good result?** Pass or Fail. For failures, note what went wrong. Focus on the **first thing that went wrong** in the trace — errors cascade, so downstream symptoms disappear when the root cause is fixed. Don't chase every issue in a single trace. Write observations, not explanations. "SQL missed the budget constraint" not "The model probably didn't understand the budget." **Template:** ``` | Trace ID | Trace | What went wrong | Pass/Fail | |----------|-------|-----------------|-----------| | 001 | [full trace] | Missing filter: pet-friendly requirement ignored in SQL | Fail | | 002 | [full trace] | Proposed unavailable times despite calendar conflicts | Fail | | 003 | [full trace] | Used casual tone for luxury client; wrong property type | Fail | | 004 | [full trace] | - | Pass | ``` **Heuristics:** - Do NOT start with a pre-defined failure list. Let categories emerge from what the user actually sees. - If the user is stuck articulating what feels wrong, prompt with common failure types: made-up facts, malformed output, ignored user requirements, wrong tone, tool misuse. ### Step 3: Group Failures into Categories After reviewing 30-50 traces, start grouping similar notes into categories. Don't wait until all 100 are done — grouping early helps sharpen what to look for in the remaining traces. The categories will evolve. The goal is names that are specific and actionable, not perfect. 1. Read through all the failure notes 2. Group similar ones together 3. Split notes that look alike but have different root causes 4. Give each category a clear name and one-sentence definition **When to split vs. group:** Split these (different root causes): - "Made up property features (solar panels)" vs. "Made up client activity (scheduled a tour never requested)" — one fabricates external facts, the other fabricates user intent. Group these (same root cause): - "Missing bedroom count filter" + "Missing pet-friendly filter" + "Missing price range filter" → **Missing Query Constraints** **LLM-assisted clustering** (use only after the user has reviewed 30-50 traces): ``` Here are failure annotations from reviewing LLM pipeline traces. Group similar failures into 5-10 distinct categories. For each category, provide: - A clear name - A one-sentence definition - Which annotations belong to it Annotations: [paste annotations] ``` Always review LLM-suggested groupings with the user. LLMs cluster by surface similarity (e.g., grouping "app crashes" and "login is slow" because both mention login). **Aim for 5-10 categories** that are: - Distinct (each failure belongs to one category) - Clear enough that someone else could apply them consistently - Actionable (each points toward a specific fix) ### Step 4: Label Every Trace Go back through all traces and apply binary labels (pass/fail) for each failure category. Each trace gets a column per category. Use whatever tool the user prefers — spreadsheet, annotation app (see build-review-interface), or a simple script. ### Step 5: Compute Failure Rates ```python failure_rates = labeled_df[failure_columns].sum() / len(labeled_df) failure_rates.sort_values(ascending=False) ``` The most frequent failure category is where to focus first. ### Step 6: Decide What to Do About Each Failure Work through each category with the user in this order: **Can we just fix it?** Many failures have obvious fixes that don't need an evaluator at all: - The prompt never mentioned the requirement. Example: the LLM never includes photo links in emails because the prompt never asked for them. Add the instruction. - A tool is missing or misconfigured. Example: the user wants to reschedule but there's no rescheduling tool exposed to the LLM. Add the tool. - An engineering bug in retrieval, parsing, or integration. Fix the code. If a clear fix resolves the failure, do that first. Only consider an evaluator for failures that persist after fixing. **Is an evaluator worth the effort?** Not every remaining failure needs one. Building and maintaining evaluators has real cost. Ask the user: - Does this failure happen frequently enough to matter? - What's the business impact when it does happen? A rare failure that causes revenue loss may outrank a frequent failure that's merely annoying. - Will this evaluator actually get used to iterate on the system, or is it checkbox work? Reserve evaluators for failures the user will iterate on repeatedly. Start with the highest-frequency, highest-impact category. **For failures that warrant an evaluator:** prefer code-based checks (regex, parsing, schema validation) for anything objective. Use write-judge-prompt only for failures that require judgment. Critical requirements (safety, compliance) may warrant an evaluator even after fixing the prompt, as a guardrail. ### Step 7: Iterate Expect 2-3 rounds of reviewing and refining categories. After each round: - Merge categories that overlap - Split categories that are too broad - Clarify definitions where the user would hesitate - Re-label traces with the refined categories ## Stopping Criteria Stop reviewing when new traces aren't revealing new kinds of failures. Roughly: ~100 traces reviewed with no new failure types appearing in the last 20. The exact number depends on system complexity. ## Trace Sampling Strategies When production volume is high, use a mix: | Strategy | When to Use | Method | |----------|------------|--------| | **Random** | Default starting point | Sample uniformly from recent traces | | **Outlier** | Surface unusual behavior | Sort by response length, latency, tool call count; review extremes | | **Failure-driven** | After guardrail violations or user complaints | Prioritize flagged traces | | **Uncertainty** | When automated judges exist | Focus on traces where judges disagree or have low confidence | | **Stratified** | Ensure coverage across user segments | Sample within each dimension | ## Anti-Patterns - **Brainstorming failure categories before reading traces.** Read first, categorize what you find. - **Starting with pre-defined categories.** A fixed list causes confirmation bias. Let categories emerge. - **Skipping the user for initial review.** The user must review the first 30-50 traces to ground categories in domain knowledge. - **Using generic scores as categories.** "Hallucination score," "helpfulness score," "coherence score" are not grounded in the application's actual failure modes. - **Building evaluators before fixing obvious problems.** Fix prompt gaps, missing tools, and engineering bugs first. - **Treating this as a one-time activity.** Re-run after every significant change: new features, prompt rewrites, model switches, production incidents.
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.