.claude/skills/claude-code-telemetry-enable/SKILL.md
Enable and configure Claude Code OTEL telemetry for local or Railway observability stacks. Use when setting up Claude Code to send metrics, logs, and traces to observability backends.
npx skillsauth add adaptationio/skrillz claude-code-telemetry-enableInstall 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.
Enable OpenTelemetry telemetry in Claude Code to send metrics, logs, and traces to your observability stack (local LGTM or Railway).
observability-stack-setup)Creates Claude Code environment configuration files that enable:
Privacy Note: Configured for FULL LOGGING (no redactions) per your requirements.
# After running observability-stack-setup
# Invoke this skill with:
enable-local
# Claude Code will now send telemetry to localhost:4317
# After deploying to Railway
# Invoke this skill with:
enable-railway --endpoint https://your-alloy.railway.app:443
# Claude Code will send telemetry to Railway
enable-localConfigure Claude Code for local LGTM stack.
Creates: ~/.config/claude-code/.env.telemetry
Configuration:
CLAUDE_CODE_ENABLE_TELEMETRY=1
OTEL_METRICS_EXPORTER=otlp
OTEL_LOGS_EXPORTER=otlp
OTEL_EXPORTER_OTLP_PROTOCOL=grpc
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
# Fast export (for development)
OTEL_METRIC_EXPORT_INTERVAL=10000 # 10 seconds
OTEL_LOGS_EXPORT_INTERVAL=5000 # 5 seconds
# FULL LOGGING (no privacy restrictions)
OTEL_LOG_USER_PROMPTS=1
OTEL_METRICS_INCLUDE_SESSION_ID=true
OTEL_METRICS_INCLUDE_VERSION=true
OTEL_METRICS_INCLUDE_ACCOUNT_UUID=true
enable-railwayConfigure Claude Code for Railway-hosted LGTM stack.
Parameters:
--endpoint: Railway Alloy OTLP endpoint URL--token: (Optional) Railway authentication tokenExample:
enable-railway \
--endpoint https://your-alloy-abc123.railway.app:443 \
--token your-railway-token
Creates: ~/.config/claude-code/.env.telemetry with Railway endpoint
enable-customConfigure for custom OTLP endpoint (Grafana Cloud, DataDog, etc.).
Parameters:
--endpoint: OTLP endpoint URL--protocol: grpc or http (default: grpc)--headers: Authentication headers (e.g., "Authorization=Bearer token")Example:
enable-custom \
--endpoint https://otlp.grafana.net:443 \
--protocol grpc \
--headers "Authorization=Basic base64encodedcreds"
verifyTest telemetry configuration and connectivity.
Checks:
Output:
Telemetry Configuration Check:
✅ Config file: ~/.config/claude-code/.env.telemetry
✅ CLAUDE_CODE_ENABLE_TELEMETRY=1
✅ OTLP endpoint: localhost:4317
✅ Endpoint reachable
✅ Test span sent successfully
✅ Data visible in Grafana
Status: HEALTHY - Telemetry fully operational
disableTurn off telemetry completely.
Actions:
.env.telemetry to .env.telemetry.disabledCLAUDE_CODE_ENABLE_TELEMETRY=0Re-enable: Rename file back or use enable-local / enable-railway again
statusShow current telemetry configuration.
Output:
Telemetry Status:
State: ENABLED
Endpoint: http://localhost:4317
Protocol: gRPC
Privacy: FULL LOGGING (all data captured)
Export Intervals: Metrics 10s, Logs 5s
Captured Data:
- User prompts (full content)
- Tool executions (all tools)
- API requests (tokens, cost, latency)
- Session metadata (IDs, version, account)
Essential:
CLAUDE_CODE_ENABLE_TELEMETRY: 1 to enable, 0 to disableOTEL_EXPORTER_OTLP_ENDPOINT: OTLP endpoint URLOTEL_EXPORTER_OTLP_PROTOCOL: grpc or httpExporters:
OTEL_METRICS_EXPORTER: otlp (send metrics via OTLP)OTEL_LOGS_EXPORTER: otlp (send logs via OTLP)Export Intervals:
OTEL_METRIC_EXPORT_INTERVAL: Milliseconds between metric exports (default: 60000)OTEL_LOGS_EXPORT_INTERVAL: Milliseconds between log exports (default: 5000)Privacy Controls (configured for FULL logging):
OTEL_LOG_USER_PROMPTS: 1 = log full prompt content, 0 = log length onlyOTEL_METRICS_INCLUDE_SESSION_ID: true = include session IDs in metricsOTEL_METRICS_INCLUDE_VERSION: true = include Claude Code versionOTEL_METRICS_INCLUDE_ACCOUNT_UUID: true = include account identifierAuthentication (for cloud backends):
OTEL_EXPORTER_OTLP_HEADERS: Headers for authentication (e.g., "Authorization=Bearer token")Metrics (counters, gauges, histograms):
claude_code.session.count - Session frequencyclaude_code.token.usage - Token consumption (input + output)claude_code.cost.usage - API costs in USDclaude_code.code_edit_tool.decision - Accept/reject patternsclaude_code.active_time.total - Engagement duration (seconds)claude_code.pull_request.count - PR creation countclaude_code.commit.count - Git commit countLog Events (structured JSON):
claude_code.user_prompt - User prompt submissions (full content)claude_code.tool_result - Tool execution outcomes (tool name, status, duration)claude_code.api_request - Claude API calls (model, tokens, cost, latency)claude_code.api_error - Failed API requests (status codes, retry attempts)claude_code.tool_decision - Permission decisions (approved/rejected)Traces (distributed tracing):
All data stored for 365 days (configured in observability stack).
Configuration File:
~/.config/claude-code/.env.telemetry~/.config/claude-code/.env.telemetry%USERPROFILE%\.config\claude-code\.env.telemetryManaged Settings (organization-enforced, optional):
/etc/claude-code/managed-settings.json/Library/Application Support/ClaudeCode/managed-settings.jsonC:\ProgramData\ClaudeCode\managed-settings.jsonCheck 1: Is telemetry enabled?
cat ~/.config/claude-code/.env.telemetry
# Should show CLAUDE_CODE_ENABLE_TELEMETRY=1
Check 2: Is OTLP endpoint reachable?
curl -v http://localhost:4317
# Should connect (may get empty response, that's ok)
Check 3: Is observability stack running?
docker compose -f .observability/docker-compose.yml ps
# All 5 services should be "running"
Check 4: Use Claude Code and check immediately
# After using Claude Code, query Loki:
curl -s 'http://localhost:3100/loki/api/v1/query?query={job="claude_code"}' | jq .
# Should show recent logs
If another service is using port 4317:
Option 1: Stop the conflicting service
sudo lsof -i :4317
sudo kill <PID>
Option 2: Change Alloy port in observability stack
Edit .observability/docker-compose.yml:
ports:
- "4318:4317" # Expose on 4318 instead
Then update telemetry config:
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
If configuration file creation fails:
# Create directory manually
mkdir -p ~/.config/claude-code
chmod 755 ~/.config/claude-code
# Try again
After enabling telemetry:
references/env-telemetry-local.txt - Local configuration templatereferences/env-telemetry-railway.txt - Railway configuration templatereferences/env-telemetry-custom.txt - Custom endpoint templatereferences/telemetry-variables.md - All environment variables explainedreferences/privacy-settings.md - Privacy configuration optionsscripts/enable-local.sh - Enable for local stackscripts/enable-railway.sh - Enable for Railwayscripts/verify-telemetry.sh - Test configuration and connectivityscripts/disable-telemetry.sh - Turn off telemetrydevelopment
Setup secure web-based terminal access to WSL2 from mobile/tablet via ttyd + ngrok/Cloudflare/Tailscale. One-command install, start, stop, status. Use when you need remote terminal access, web terminal, browser-based shell, or mobile access to WSL2 environment.
development
Complete development workflows where Claude writes the code while Gemini and Codex provide research, planning, reviews, and different perspectives. Claude remains the main developer. Use for complex projects requiring expert planning and multi-perspective reviews.
development
Systematic progress tracking for skill development. Manages task states (pending/in_progress/completed), updates in real-time, reports progress, identifies blockers, and maintains momentum. Use when tracking skill development, coordinating work, or reporting progress.
testing
Comprehensive testing workflow orchestrating functional testing, example validation, integration testing, and usability assessment. Sequential workflow for complete skill testing from examples through scenarios to integration validation. Use when conducting thorough testing, pre-deployment validation, ensuring skill functionality, or comprehensive quality checks.