Agent skill

Opik Explain

by comet-ml in comet-ml/opik-mcp

Root-cause a specific Opik trace, or a pattern across traces, and return a grounded explanation.

Apache-2.0Auto-check: notesAgent Workflows

Install Opik Explain

skills CLI
$ npx skills add comet-ml/opik-mcp --skill opik-explain -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install comet-ml/opik-mcp opik-explain --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/comet-ml/opik-mcp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/src/opik_mcp/skills/opik-explain .claude/skills/opik-explain && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
opik-explain
GitHub stars
219
Token cost
~2.4k tokens
SKILL.md length
1,012 words
Files
11
Skills in repo
10
Repo updated
First seen
Licence
Apache-2.0

At a glance

Root-cause a specific Opik trace, or a pattern across traces, and return a grounded explanation.

  • Works in 4 steps: Resolve the target → Fetch the trace and spans — MCP first,… → Root-cause it → …
  • Why did this trace fail
  • SKILL.md covers Inputs, Activation — the only in-scope…, Blockers and Output, plus 3 more sections
  • Runs Python scripts from its folder; needs OPIK_API_KEY

What it does

Opik Explain is an agent skill from comet-ml/opik-mcp. Root-cause a specific Opik trace, or a pattern across traces, and return a grounded explanation. Uses the hosted Opik MCP when it is connected, and falls back to SDK scripting otherwise. Returns the root cause, the evidence spans as clickable Opik UI links, and one suggested next step. Use for "why did this trace fail", "explain this trace", "debug this trace", "why is my agent slow or wrong". Not for adding tracing to an app (use the instrument skill) or for changing code.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 14 other files (for example `evals/HARNESS.md`, `evals/cases.yaml` and `evals/fixtures/latency/agent.py`). Compatibility notes: Tested with Claude Code; works with any Agent Skills-compatible host (Cursor, VS Code Copilot, Codex). Requires a Python or TypeScript project with Opik…

It sits in Agent Workflows, covering Root cause analysis and MCP servers. It works with Model Context Protocol. The repository describes itself as: Model Context Protocol (MCP) server for Opik, the open-source LLM observability and evaluation platform, built by Comet. Read traces, log scores, and manage prompts from Claude… The licence is Apache-2.0.

When your agent uses it

  • Why did this trace fail
  • Explain this trace
  • Debug this trace
  • Why is my agent slow

Example prompts

  • “why did this trace fail”
  • “explain this trace”
  • “debug this trace”
  • “/opik-explain”

Requirements

  • Python 3
  • A credential in OPIK_API_KEY
  • Compatibility (from SKILL.md): Tested with Claude Code; works with any Agent Skills-compatible host (Cursor, VS Code Copilot, Codex). Requires a Python or TypeScript project with Opik configured and at least one trace. Install the `opik` skill alongside this one — it holds the shared SDK and observability references; without it, this skill falls back to the public docs.
  • Pre-approved tools (allowed-tools): Read, Grep, Glob, Bash

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Resolve the target
  2. Fetch the trace and spans — MCP first, SDK fallback
  3. Root-cause it
  4. Report

What it can do on your machine

Read from SKILL.md and the folder at commit e0c2057. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Grep
    • Glob
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • comet.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • OPIK_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Tested with Claude Code; works with any Agent Skills-compatible host (Cursor, VS Code Copilot, Codex). Requires a Python or TypeScript project with Opik configured and at least one trace. Install the `opik` skill alongside this one — it holds the shared SDK and observability references; without it, this skill falls back to the public docs.

    From compatibility in the SKILL.md frontmatter.

Context cost

Opik Explain loads about 2.4k tokens when it runs. Until then it costs about 123 tokens; SKILL.md has 1,012 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~123
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Grep, Glob, Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from comet-ml/opik-mcp at commit e0c2057, republished under its Apache-2.0 licence (© comet-ml). 1,012 words, ~2,413 tokens.

Download SKILL.mdSave it as .claude/skills/opik-explain/SKILL.md (or your agent's skills folder). This skill also uses 10 other files; get the full folder from GitHub.
name
opik-explain
description
Root-cause a specific Opik trace, or a pattern across traces, and return a grounded explanation. Uses the hosted Opik MCP when it is connected, and falls back to SDK scripting otherwise. Returns the root cause, the evidence spans as clickable Opik UI links, and one suggested next step. Use for "why did this trace fail", "explain this trace", "debug this trace", "why is my agent slow or wrong". Not for adding tracing to an app (use the instrument skill) or for changing code.
allowed-tools
Read, Grep, Glob, Bash
compatibility
Tested with Claude Code; works with any Agent Skills-compatible host (Cursor, VS Code Copilot, Codex). Requires a Python or TypeScript project with Opik configured and at least one trace. Install the `opik` skill alongside this one — it holds the shared SDK and observability references; without it, this skill falls back to the public docs.
metadata.last_updated
2026-09-08
metadata.source_commit
2.0.0
metadata.argument-hint
[trace id, or a description of the behavior to explain]

Explain — Root-Cause an Opik Trace and Ground It in the Code

Definition of done: a grounded root cause for the requested trace (or pattern), tied to specific evidence spans and paired with exactly one suggested next step. "Grounded" means the explanation names the failing/anomalous span and connects it to the code or data that produced it — not a restatement of the trace. If the target can't be fetched or read, stop at the first genuine blocker and return one concrete next step. A trace dump is not an explanation.

Operate: investigate over the real trace data, reason against the repo, commit to a single most-likely root cause with its evidence — and change no code. This skill is read-only by design.

Inputs

The entry point is /opik-explain <trace-id> (one trace) or /opik-explain <describe the behavior> (a pattern to find and explain). Infer the rest; treat these as optional overrides:

  • project name (default: inferred from config/repo) · time window for a pattern (default: recent) · a known-good trace to compare against.

Ask only at a genuine, non-inferable blocker (see Blockers).

Activation — the only in-scope work

1. Resolve the target
  • A trace id (uuid-shaped): explain that one trace.
  • A behavior/pattern ("hallucinations since the prompt change", "slow responses"): search for the matching set (below), then explain the shared cause.
  • Confirm Opik is reachable: if ~/.opik.config exists or OPIK_API_KEY is set, use it. Otherwise → Blocker ("run opik configure, then rerun").
2. Fetch the trace and spans — MCP first, SDK fallback

Check whether the hosted Opik MCP is connected and prefer it; fall back to SDK scripting when it isn't.

  • MCP connected: use the MCP to read the trace and list/read its spans.
  • No MCP: fall back to the SDK.

Either way, read every span's input/output/error/duration.

python
import opik

client = opik.Opik()

tid = "<trace_id>"
trace = client.get_trace_content(
    tid
)  # TracePublic: exposes project_id, input, output, error info — NOT project_name (accessing .project_name raises)
project = client.rest_client.projects.get_project_by_id(trace.project_id).name
spans = client.search_spans(
    project_name=project, trace_id=tid
)  # spans come from a SEPARATE call, not from the trace object
# ALWAYS pass project_name: without it the SDK searches the configured default project, which
# returns an empty list (or a 404 if that project doesn't exist) even for a valid trace id.
# Reconstruct the tree via each span's parent_span_id (the root span has none).
# Your anchor is the first span that errored, returned wrong output, or dominates the duration.

For a pattern, pull the matching set scoped to the project, then look for the shared failing span across them. With the MCP, one list call does the filtering and ordering server-side — filters is an OQL string, sort is "<field> [asc|desc]", since takes "1h" / "7d":

list(entity_type="trace", project_name="<project>", since="7d",
     filters="error_info is_not_empty", sort="start_time desc")        # error traces
list(entity_type="trace", project_name="<project>", since="7d",
     sort="duration desc")                                             # slow traces (duration in ms)
list(entity_type="trace", project_name="<project>", since="7d",
     filters="feedback_scores.hallucination > 0.5")                    # low-scored traces
list(entity_type="span",  project_name="<project>", since="7d",
     filters='name = "<span name>" AND error_info is_not_empty')       # the shared failing span, across traces

The applied filter is echoed on the first line; a rejected one comes back with what fixes it (schema("list.trace") is the full field reference). Without the MCP, the SDK takes the same grammar:

python
traces = client.search_traces(project_name="<project>", filter_string="error_info is_not_empty")

Traces are asynchronous; if you just produced the trace, allow a few seconds and confirm the flush ran.

3. Root-cause it

The coding agent root-causes over the fetched data, against the repo — it has the one thing a generic reasoner lacks: the code. Whether the trace came from the MCP or the SDK, the analysis is the same: find the anchor span (error / wrong output / latency dominator), read its input and output, connect it to the code (grep the repo for the span name / function), and state the single most-likely root cause with its evidence spans. Prefer one well-evidenced cause over a list of maybes.

4. Report

Return the root cause, the evidence spans as clickable Opik UI links (the trace redirect URL Opik emits, e.g. .../session/redirect/...?trace_id=THE_ID — never a bare id), and one next step (see Output). If a fix is obvious, name it as the next step; do not apply it (this skill changes no code — handing off to opik-instrument/opik-test or the developer is the next step).

Blockers

Stop at the earliest blocker and return exactly one next step:

  • "Run opik configure, then rerun /opik-explain <trace-id>."
  • "No trace found for <id> in project <name> — confirm the id and project, then rerun."
  • "This environment can't reach Opik — open the trace in the UI and paste its error/output, or run where Opik is configured."
  • "Which behavior should I explain? Give a trace id or describe what went wrong."
Show full SKILL.md (409 more words)Show less

Output

User-facing: a short human message — the root cause in one or two sentences, the evidence spans as clickable Opik UI links (name + why each matters), and the single next step. Not a raw trace dump, not JSON.

Underneath (for composition / evals), one shape whether the MCP or the SDK path produced it:

  • status: explained | blocked | not_found
  • target: trace_id + trace_url (the Opik UI link; for a pattern, the trace_ids + trace_urls sampled)
  • root_cause: one grounded statement
  • evidence: spans (each: name, type, a trace_url deep-link where available, why it's evidence)
  • next_step: exactly one
  • reasoner: agent (the coding agent root-causes over the trace data and the repo)

Invariants: explained must carry a root_cause and at least one evidence span; blocked/not_found carry exactly one next_step; every path leaves the codebase unchanged.

Examples

Single trace — tool failure. /opik-explain 019fd8a7-.... Fetch trace + spans; the retrieve (tool) span returned empty and the llm span then hallucinated. Open retrieve() in the repo: the query filter is wrong. Root cause = the retrieval filter, evidence = the empty tool span feeding the llm span; next step = "fix the filter in retrieve() (or /opik-test it)". → explained.

Pattern — slowness. /opik-explain why responses got slow this week. list('trace', since="7d", sort="duration desc") (or search_traces without the MCP) for the slowest traces; the same external tool span dominates each. Root cause = that call's latency; evidence = the shared slow span across N traces; next step = "add a timeout/cache around it". → explained.

Blocked — bad id. /opik-explain 123. get_trace_content finds nothing. → not_found: "No trace 123 in project X — confirm the id/project and rerun." (No code touched.)

Anti-patterns

Dumping the span tree without naming a cause; guessing a cause without reading the anchor span's input/output; listing five maybes instead of the one best-evidenced cause; returning bare span/trace ids instead of clickable Opik UI links; editing code (this skill explains; opik-instrument/opik-test or the developer make changes); calling .project_name on a TracePublic (it raises — use project_id); calling search_spans(trace_id=…) without project_name (it searches the default project and comes back empty).

References

SDK and observability detail live in the opik skill, installed beside this one. Read the files directly — paths are relative to this file: ../opik/SKILL.md (Searching traces — the OQL filter grammar shared by the MCP list tool and search_traces), ../opik/references/production.md (search_traces, error/latency/cost analysis), ../opik/references/tracing-python.md (SDK read APIs), ../opik/references/observability.md (span-type model). If your host lays skills out differently, locate the opik skill's references/ directory.

If the opik skill isn't installed, say so in the report and use https://www.comet.com/docs/opik/ rather than working from memory.

© comet-ml, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 10 other files in src/opik_mcp/skills/opik-explain of comet-ml/opik-mcp.

  • SKILL.md
  • evals/.gitignore
  • evals/HARNESS.md
  • evals/cases.yaml
  • evals/fixtures/latency/agent.py
  • evals/fixtures/latency/pyproject.toml
  • evals/fixtures/toolbug/agent.py
  • evals/fixtures/toolbug/pyproject.toml
  • evals/grader.py
  • evals/metrics.py
  • evals/run_evals.py

Open the folder on GitHubat commit e0c2057

Compare with similar skills

Opik Explain next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Opik Explain compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Opik Explain this skillcomet-ml/opik-mcp219—~2.4kAutomated safety check: NotesApache-2.0
Fix Sentry Issuesbrianlovin/agent-config3761 repos~1.2kAutomated safety check: PassNone
Flowstudio Power Automate Debuggithub/awesome-copilot40k2 repos~5kAutomated safety check: PassMIT
QA Find Bugs MCPbex-co/beancount-io295—~3kAutomated safety check: PassMIT
Monte Carlo Remediationsickn33/agentic-awesome-skills47k1 repos~4kAutomated safety check: PassApache-2.0
Debugagentic-community/mcp-gateway-registry964—~1.8kAutomated safety check: NotesApache-2.0

Similar skills

  • Fix Sentry Issues

    brianlovin/agent-config

    Use Sentry MCP to discover, triage, and fix production issues with root-cause analysis.

    376 GitHub starsUsed in 1 repo~1.2k tokens
    DevelopmentAuto-check passed
  • Flowstudio Power Automate Debug

    github/awesome-copilot

    Official

    Debug failing Power Automate cloud flows using the FlowStudio MCP server.

    40k GitHub starsUsed in 2 repos~5k tokens
    DevelopmentAuto-check passed
  • QA Find Bugs MCP

    bex-co/beancount-io

    Hunt bugs in the Beancount.io remote MCP server by driving the real POST /api-gateway/mcp endpoint with JSON-RPC and real MCP clients, checking transport, discovery, credential boundaries, tool and…

    295 GitHub stars~3k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Monte Carlo Remediation

    sickn33/agentic-awesome-skills

    Investigate and remediate data quality alerts using Monte Carlo MCP tools.

    47k GitHub starsUsed in 1 repo~4k tokens
    DevelopmentAuto-check passed
  • Debug

    agentic-community/mcp-gateway-registry

    Debug issues in the MCP Gateway Registry using first-principles thinking.

    964 GitHub stars~1.8k tokensUpdated 2 days ago
    DevelopmentAuto-check: notes
  • Official

    Pro+ subscription required. An agent skill from github/awesome-copilot.

    40k GitHub starsUsed in 2 repos~3.3k tokens
    DevelopmentAuto-check passed

More from comet-ml/opik-mcp

All 10 skills in this repo
  • Opik

    comet-ml/opik-mcp

    Reference for the Opik SDK — tracing, span types, framework integrations, threads, and the prompt library (Python, TypeScript, REST).

    219 GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Opik Compare

    comet-ml/opik-mcp

    Run a candidate against the baseline over an Opik test suite and read the numbers back — which cases broke, which got fixed, the per-metric deltas, worst rows, and whether the two runs are…

    219 GitHub stars~2.6k tokensUpdated today
    Auto-check: notes
  • Opik Diagnose

    comet-ml/opik-mcp

    Surface the Opik traces worth a developer's attention, ranked by signal — Diagnostics issues first, then errors, failed tool calls, latency, regressions, and low online-eval scores.

    219 GitHub stars~2.7k tokensUpdated today
    Auto-check: notes
  • Opik Evaluate

    comet-ml/opik-mcp

    Build an LLM evaluation and run it against the app, returning an Opik experiment with scores and its link.

    219 GitHub stars~2.5k tokensUpdated today
    Auto-check: notes
  • Opik Instrument

    comet-ml/opik-mcp

    Add Opik tracing to an existing app and verify a real trace lands.

    219 GitHub stars~2.7k tokensUpdated today
    Auto-check: notes
  • Opik Optimize

    comet-ml/opik-mcp

    Improve a prompt with the Opik Agent Optimizer — resolve the prompt, a dataset, and a metric, pick the algorithm, run a bounded optimization, check the gain on held-out data, and save the winner as…

    219 GitHub stars~2.6k tokensUpdated today
    Auto-check: notes

Questions about Opik Explain

What does Opik Explain do?

Root-cause a specific Opik trace, or a pattern across traces, and return a grounded explanation. Opik Explain is an agent skill from comet-ml/opik-mcp. Root-cause a specific Opik trace, or a pattern across traces, and return a grounded explanation.

When should I use Opik Explain?

Opik Explain fits situations like: why did this trace fail; explain this trace; debug this trace; why is my agent slow.

How do I install Opik Explain in Claude Code?

Run `npx skills add comet-ml/opik-mcp --skill opik-explain -a claude-code`. Or copy the skill folder (src/opik_mcp/skills/opik-explain in comet-ml/opik-mcp) into .claude/skills/opik-explain in your project. Claude Code loads it when a task matches its description.

How do I install Opik Explain in Codex?

Run `npx skills add comet-ml/opik-mcp --skill opik-explain -a codex`. Or copy the skill folder (src/opik_mcp/skills/opik-explain in comet-ml/opik-mcp) into .agents/skills/opik-explain in your project. Codex loads it when a task matches its description.

Can I use Opik Explain in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add comet-ml/opik-mcp --skill opik-explain -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/opik-explain, .gemini/skills/opik-explain, .github/skills/opik-explain and .opencode/skills/opik-explain in your project.

What does Opik Explain need to run?

Going by SKILL.md and its folder, Opik Explain needs Python for the scripts in its folder and credentials named OPIK_API_KEY. Our summary lists: Python 3; A credential in OPIK_API_KEY. Its frontmatter pre-approves these tools: Read, Grep, Glob, Bash. Compatibility (from SKILL.md): Tested with Claude Code; works with any Agent Skills-compatible host (Cursor, VS Code Copilot, Codex). Requires a Python or TypeScript project with Opik configured and at least one trace. Install the `opik` skill alongside this one — it holds the shared SDK and observability references; without it, this skill falls back to the public docs..

Does Opik Explain access the network?

SKILL.md names 1 domain. As links in the text: comet.com. This is read from the text; nothing was executed.

Is Opik Explain safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Opik Explain use?

Opik Explain is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Opik Explain use?

About 2.4k tokens (SKILL.md is roughly 9.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Opik Explain?

Skills that share tags, products or a category with Opik Explain: Fix Sentry Issues (brianlovin/agent-config, 376 stars), Flowstudio Power Automate Debug (github/awesome-copilot, 40k stars), QA Find Bugs MCP (bex-co/beancount-io, 295 stars) and Monte Carlo Remediation (sickn33/agentic-awesome-skills, 47k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Opik Explain?

comet-ml (a GitHub organization) maintains it in comet-ml/opik-mcp, which has 219 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 7, 2026.

Source: comet-ml/opik-mcp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.