skills/langfuse/SKILL.md
One front door for Langfuse — combines the Langfuse Agent Skill (best practices + docs), the Langfuse CLI (full API surface via npx), and the Langfuse MCP server (native prompt-management tool calls). Use when instrumenting an app, querying or modifying Langfuse data (traces, prompts, datasets, scores, sessions, evals), looking up Langfuse documentation, or configuring Langfuse for a new repo. Routes between Skill knowledge / CLI / MCP based on intent.
npx skillsauth add jankneumann/agentic-coding-tools langfuseInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Langfuse is the team's default LLM observability and prompt-management platform. This skill is the single front door for every Langfuse interaction — instrumentation, debugging traces, managing prompts, running evals, capturing user feedback.
Langfuse is reachable three ways. They are complementary, not redundant — pick the right one per intent:
| Mechanism | What it is | When to use |
|---|---|---|
| Skill knowledge (this file + references/) | Best-practice playbooks, docs index, instrumentation patterns | "How do I…?" / "What's the right way to…?" — anything that needs conditioning before action |
| Langfuse CLI (npx langfuse-cli) | Wraps the full Langfuse REST API. Every endpoint reachable from the terminal. | Querying or mutating arbitrary resources (traces, datasets, scores, sessions, metrics, evals); batch ops; CI scripting |
| Langfuse MCP server (mcp__langfuse__* tools) | Native MCP tools for prompt management — getPrompt, listPrompts, createTextPrompt, createChatPrompt, updatePromptLabels | Fetch / create / version / label a prompt during a conversation. One tool call instead of a Bash → npx → JSON-parse round-trip. |
Default routing:
references/*.md file.Apply these to every Langfuse task:
Before any Langfuse operation, verify the surface you intend to use:
echo "${LANGFUSE_PUBLIC_KEY:?missing}" # pk-lf-...
echo "${LANGFUSE_SECRET_KEY:?missing}" # sk-lf-...
echo "${LANGFUSE_HOST:?missing}" # https://cloud.langfuse.com (EU), https://us.cloud.langfuse.com (US), or self-hosted URL
If unset, ask the user for their project keys (Langfuse UI → Settings → API Keys) and the host they're using. Never hardcode keys in committed files — use ${VAR} interpolation.
In repos that use OpenBao (this one does — see docs/openbao-secret-management.md), one line populates all four LANGFUSE_* env vars (including the computed LANGFUSE_BASIC_AUTH):
eval "$(skills/bao-vault/scripts/langfuse_env.sh)"
Safe to run unconditionally — falls back silently when OpenBao is unavailable.
npx langfuse-cli --version # should print a version string
npx will fetch the package on first run; no global install required. If the user prefers a global install: npm i -g langfuse-cli.
Verify by attempting a read-only call:
mcp__langfuse__listPrompts({})
If it errors with "tool not found" or "MCP server not configured", the server isn't registered. See references/mcp-setup.md for full coverage, or run bash skills/langfuse/scripts/install-mcp.sh for an idempotent setup that targets Claude Code (.mcp.json), Codex (~/.codex/config.toml), and Gemini (~/.gemini/settings.json) in one shot.
Shared vocabulary used across CLI args, MCP tools, and the UI:
span (generic), generation (LLM call, has model/usage), event (point-in-time).name + version (or name + label, e.g. production).Common enough to handle inline without loading a reference.
mcp__langfuse__listPrompts({})
mcp__langfuse__getPrompt({"name": "chat-assistant", "version": 3})
mcp__langfuse__getPrompt({"name": "chat-assistant", "label": "production"})
mcp__langfuse__createTextPrompt({"name": "chat-assistant", "prompt": "...", "labels": ["production"]})
mcp__langfuse__updatePromptLabels({"name": "chat-assistant", "version": 4, "newLabels": ["production"]})
CLI fallback when MCP isn't available:
npx langfuse-cli api prompts list --json
npx langfuse-cli api prompts get --name chat-assistant --version 3 --json
npx langfuse-cli api traces list --limit 20 --json
npx langfuse-cli api traces get --trace-id <id> --json
npx langfuse-cli api observations-v2s list --trace-id <id> --json # prefer v2
npx langfuse-cli api score-v2s list --trace-id <id> --json # prefer v2
npx langfuse-cli api sessions list --limit 20 --json
npx langfuse-cli api metrics-v2s list --json # prefer v2
npx langfuse-cli api __schema # all resources
npx langfuse-cli api <resource> --help # actions on a resource
npx langfuse-cli api <resource> <action> --help # args for an action
npx langfuse-cli api <resource> <action> --curl # preview HTTP without sending
For anything beyond quick operations, load at most one or two of these:
| Intent | Reference | |---|---| | Instrument a new or existing app with Langfuse tracing | references/instrumentation.md | | Move hardcoded prompts in a codebase into Langfuse | references/prompt-migration.md | | Capture user feedback (thumbs, ratings, implicit signals) as scores | references/user-feedback.md | | Upgrade or migrate a Langfuse SDK to the latest version | references/sdk-upgrade.md | | Deeper CLI patterns, pagination, batching, complex queries | references/cli.md | | Register the MCP server in a new repo (or change scope) | references/mcp-setup.md | | Wire Claude Code session transcripts into Langfuse via Stop hook | references/stop-hook.md | | Submit feedback about this skill itself | references/skill-feedback.md |
Multi-step Langfuse workflows chain naturally:
createTextPrompt → reference it in code → CLI traces list to verify it ran → CLI scores create to grade it.createTextPrompt for the externalized version → refactor code to call get_prompt() → CLI traces list to confirm the new prompt name appears.traces list --limit 50 --json filtered by name → CLI traces get for the suspect trace → CLI observations-v2s list for the failing span → MCP getPrompt to inspect the prompt version that ran.eval "$(skills/bao-vault/scripts/langfuse_env.sh)" (or export LANGFUSE_* directly) → bash skills/langfuse/scripts/install-mcp.sh (registers MCP with all three agents) → python3 skills/langfuse/scripts/install_stop_hook.py (Claude Code session traces) → instrument app code (see references/instrumentation.md).When composing, return one unified response covering all steps. Don't ask the user to invoke each step separately.
Three methods, in preference order. Always prefer your application's native fetch tool (WebFetch, mcp_fetch, etc.) over curl when available — the URL patterns below work with any tool.
llms.txt)https://langfuse.com/llms.txt
Structured list of every doc page with titles and URLs. Scan for relevant titles, then fetch the page directly.
Append .md to any doc path, or send Accept: text/markdown:
https://langfuse.com/docs/observability/overview.md
https://langfuse.com/api/search-docs?query=<url-encoded-query>
Returns JSON with matching pages and excerpts. Useful when debugging — issues and discussions are indexed alongside docs. Responses can be large; extract only relevant portions.
Workflow: start with llms.txt to orient → fetch specific pages once you know which ones → fall back to search when the topic is unclear.
When the user says this skill gave wrong/outdated guidance, missed a workflow, or could be improved, offer to submit feedback to the upstream Langfuse skill maintainers. Process: references/skill-feedback.md.
Do not trigger this for issues with Langfuse the product — only for issues with this skill's instructions and behavior.
development
Open the artifacts relevant to a review (OpenSpec proposal, branch changes, or explicit paths) in VS Code, in a curated read-order, in the right worktree.
tools
Render and seed coordinator-owned task status block in OpenSpec tasks.md
testing
User-invocable skill that omits the tail block
tools
Missing several required keys