skills/recipes/debug-instrumentation/SKILL.md
Debug and improve your LangWatch traces. Inspects production traces for missing input/output, disconnected spans, unlabeled traces, and missing metadata. Use when traces look broken or incomplete.
npx skillsauth add langwatch/langwatch debug-instrumentationInstall 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.
This recipe uses the LangWatch MCP to inspect your production traces and identify instrumentation issues.
The LangWatch MCP must be installed with a valid API key. See MCP Setup.
Call search_traces with a recent time range (last 24h or 7d) to get an overview:
<empty>?For traces that look problematic, call get_trace with the trace ID to see the full span hierarchy:
autotrack_openai_calls(client) (Python) or experimental_telemetry (TypeScript/Vercel AI) is configured.@langwatch.trace() decorator is missing on the entry function.langwatch.get_current_trace().update(metadata={"labels": ["feature_name"]}).Use fetch_langwatch_docs to read the integration guide for the project's framework. Compare the recommended setup with what's in the code.
For each issue found:
search_traces to verify the fixAfter fixes, compare before/after:
| Issue | Cause | Fix |
|-------|-------|-----|
| All traces show <empty> input/output | Missing autotrack or telemetry config | Add autotrack_openai_calls(client) or experimental_telemetry: { isEnabled: true } |
| Spans not connected to traces | Missing @langwatch.trace() on entry function | Add trace decorator to the main function |
| No labels on traces | Labels not set in trace metadata | Add metadata={"labels": ["feature"]} to trace update |
| Missing user_id | User ID not passed to trace | Add user_id to trace metadata |
| Traces from different calls merged | Missing langwatch.setup() or trace context not propagated | Ensure langwatch.setup() called at startup |
development
Add LangWatch tracing and observability to your code. Use for both onboarding (instrument an entire codebase) and targeted operations (add tracing to a specific function or module). Supports Python and TypeScript with all major frameworks.
tools
Test your AI agent with simulation-based scenarios. Covers writing scenario test code (Scenario SDK), creating platform scenarios (CLI or MCP), and red teaming for security vulnerabilities. Auto-detects whether to use code or platform approach based on context.
testing
Test that your AI agent stays observational and doesn't give prescriptive advice in regulated domains (healthcare, finance, legal). Creates scenario tests for boundary enforcement and red team tests for adversarial probing. Use when your agent advises but must not prescribe.
tools
Write scenario tests that verify your CLI tool is usable by AI agents. Ensures commands work non-interactively, provide clear output, and don't hang on prompts. Use when you want to prove your CLI is agent-friendly.