AGENT SKILL

openevidence-debug-bundle

Generate comprehensive debug information for OpenEvidence integration issues. Use when troubleshooting complex problems, preparing support tickets, or conducting post-incident analysis. Trigger with phrases like "openevidence debug", "openevidence troubleshoot", "openevidence support bundle", "diagnose openevidence".

适用职业开发工程师
License 许可
MIT
最近更新
2026-11-15
Stars
★ 2.0k
Forks
233

01 前言 Front Matter

name
openevidence-debug-bundle
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
version
1.0.0
description
Generate comprehensive debug information for OpenEvidence integration issues. Use when troubleshooting complex problems, preparing support tickets, or conducting post-incident analysis. Trigger with phrases like "openevidence debug", "openevidence troubleshoot", "openevidence support bundle", "diagnose openevidence".
allowed-tools
Read, Grep, Bash(curl:*), Bash(npm:*), Bash(node:*)

03 SKILL.md 正文

OpenEvidence Debug Bundle

Overview

Generate comprehensive diagnostic information for troubleshooting OpenEvidence integration issues without exposing PHI.

Prerequisites

  • OpenEvidence SDK installed
  • Access to application logs
  • Command-line access
  • curl installed

Instructions

Step 1: Environment Check Script

#!/bin/bash
# scripts/openevidence-debug.sh

echo "=== OpenEvidence Debug Bundle ==="
echo "Generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo ""

# 1. Environment Variables (masked)
echo "=== Environment Configuration ==="
echo "OPENEVIDENCE_API_KEY: ${OPENEVIDENCE_API_KEY:+[SET - ${#OPENEVIDENCE_API_KEY} chars]}"
echo "OPENEVIDENCE_ORG_ID: ${OPENEVIDENCE_ORG_ID:+[SET - ${#OPENEVIDENCE_ORG_ID} chars]}"
echo "OPENEVIDENCE_BASE_URL: ${OPENEVIDENCE_BASE_URL:-https://api.openevidence.com}"
echo "OPENEVIDENCE_TIMEOUT: ${OPENEVIDENCE_TIMEOUT:-30000}ms"
echo "NODE_ENV: ${NODE_ENV:-not set}"
echo ""

# 2. SDK Version
echo "=== SDK Version ==="
npm list @openevidence/sdk 2>/dev/null || pip show openevidence 2>/dev/null || echo "SDK not found"
echo ""

# 3. Node/Python Version
echo "=== Runtime Version ==="
node --version 2>/dev/null || echo "Node.js not found"
python3 --version 2>/dev/null || echo "Python not found"
echo ""

# 4. Connectivity Test
echo "=== Connectivity Test ==="
HEALTH_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer ${OPENEVIDENCE_API_KEY}" \
  "${OPENEVIDENCE_BASE_URL:-https://api.openevidence.com}/health" 2>/dev/null)
echo "Health endpoint: HTTP ${HEALTH_STATUS}"

DNS_CHECK=$(dig +short api.openevidence.com 2>/dev/null || echo "DNS lookup failed")
echo "DNS resolution: ${DNS_CHECK}"
echo ""

# 5. TLS Check
echo "=== TLS Configuration ==="
openssl s_client -connect api.openevidence.com:443 -brief 2>/dev/null | head -5 || echo "TLS check failed"
echo ""

# 6. Rate Limit Status
echo "=== Rate Limit Status ==="
curl -s -D - \
  -H "Authorization: Bearer ${OPENEVIDENCE_API_KEY}" \
  "${OPENEVIDENCE_BASE_URL:-https://api.openevidence.com}/v1/rate-limit" 2>/dev/null \
  | grep -i "x-ratelimit" || echo "Could not retrieve rate limit headers"
echo ""

echo "=== Debug Bundle Complete ==="

Step 2: Programmatic Debug Collection

// src/debug/debug-bundle.ts
import { OpenEvidenceClient } from '@openevidence/sdk';
import { execSync } from 'child_process';

interface DebugBundle {
  timestamp: string;
  environment: EnvironmentInfo;
  connectivity: ConnectivityInfo;
  sdkInfo: SDKInfo;
  recentErrors: ErrorSummary[];
  metrics: MetricsSummary;
}

interface EnvironmentInfo {
  nodeVersion: string;
  sdkVersion: string;
  apiKeySet: boolean;
  apiKeyLength: number;
  orgIdSet: boolean;
  baseUrl: string;
  timeout: number;
}

interface ConnectivityInfo {
  healthStatus: number | null;
  latencyMs: number | null;
  dnsResolution: boolean;
  tlsVersion: string | null;
}

interface SDKInfo {
  version: string;
  features: string[];
}

interface ErrorSummary {
  code: string;
  count: number;
  lastOccurred: string;
}

interface MetricsSummary {
  totalRequests: number;
  successRate: number;
  avgLatencyMs: number;
  p99LatencyMs: number;
}

export async function generateDebugBundle(): Promise<DebugBundle> {
  const timestamp = new Date().toISOString();

  // Gather environment info
  const environment = gatherEnvironmentInfo();

  // Test connectivity
  const connectivity = await testConnectivity();

  // Get SDK info
  const sdkInfo = getSDKInfo();

  // Summarize recent errors (from in-memory store or logs)
  const recentErrors = await summarizeRecentErrors();

  // Gather metrics
  const metrics = await gatherMetrics();

  return {
    timestamp,
    environment,
    connectivity,
    sdkInfo,
    recentErrors,
    metrics,
  };
}

function gatherEnvironmentInfo(): EnvironmentInfo {
  return {
    nodeVersion: process.version,
    sdkVersion: getPackageVersion('@openevidence/sdk'),
    apiKeySet: !!process.env.OPENEVIDENCE_API_KEY,
    apiKeyLength: process.env.OPENEVIDENCE_API_KEY?.length || 0,
    orgIdSet: !!process.env.OPENEVIDENCE_ORG_ID,
    baseUrl: process.env.OPENEVIDENCE_BASE_URL || 'https://api.openevidence.com',
    timeout: parseInt(process.env.OPENEVIDENCE_TIMEOUT || '30000'),
  };
}

async function testConnectivity(): Promise<ConnectivityInfo> {
  const baseUrl = process.env.OPENEVIDENCE_BASE_URL || 'https://api.openevidence.com';
  const startTime = Date.now();

  try {
    const response = await fetch(`${baseUrl}/health`, {
      headers: { Authorization: `Bearer ${process.env.OPENEVIDENCE_API_KEY}` },
    });

    return {
      healthStatus: response.status,
      latencyMs: Date.now() - startTime,
      dnsResolution: true,
      tlsVersion: 'TLS 1.2+', // Inferred from successful HTTPS
    };
  } catch (error: any) {
    return {
      healthStatus: null,
      latencyMs: null,
      dnsResolution: error.code !== 'ENOTFOUND',
      tlsVersion: null,
    };
  }
}

function getSDKInfo(): SDKInfo {
  return {
    version: getPackageVersion('@openevidence/sdk'),
    features: ['clinical-query', 'deep-consult', 'webhooks'],
  };
}

function getPackageVersion(pkg: string): string {
  try {
    const result = execSync(`npm list ${pkg} --json 2>/dev/null`, { encoding: 'utf8' });
    const json = JSON.parse(result);
    return json.dependencies?.[pkg]?.version || 'unknown';
  } catch {
    return 'unknown';
  }
}

async function summarizeRecentErrors(): Promise<ErrorSummary[]> {
  // This would typically pull from your error tracking system
  // Placeholder implementation
  return [];
}

async function gatherMetrics(): Promise<MetricsSummary> {
  // This would typically pull from your metrics system
  // Placeholder implementation
  return {
    totalRequests: 0,
    successRate: 0,
    avgLatencyMs: 0,
    p99LatencyMs: 0,
  };
}

Step 3: Sanitized Log Extraction

// src/debug/log-sanitizer.ts
// IMPORTANT: Removes PHI before including in debug bundle

const PHI_PATTERNS = [
  /\b\d{3}-\d{2}-\d{4}\b/g,           // SSN
  /\b[A-Z]\d{8}\b/gi,                  // MRN patterns
  /\b\d{10,}\b/g,                      // Long numbers (potential IDs)
  /patient[_\s]*(name|id|dob)/gi,      // Patient fields
  /\b(male|female),?\s*\d{1,3}/gi,    // Demographics
  /"name"\s*:\s*"[^"]+"/gi,           // Name fields in JSON
  /"dob"\s*:\s*"[^"]+"/gi,            // DOB fields
  /"mrn"\s*:\s*"[^"]+"/gi,            // MRN fields
];

export function sanitizeLogs(logs: string): string {
  let sanitized = logs;

  for (const pattern of PHI_PATTERNS) {
    sanitized = sanitized.replace(pattern, '[REDACTED]');
  }

  return sanitized;
}

export function extractSanitizedLogs(
  logSource: string,
  timeRange: { start: Date; end: Date },
  maxLines: number = 1000
): string[] {
  // Implementation depends on your logging infrastructure
  // Example with file-based logs:

  const logs: string[] = [];
  // Read logs, filter by time range, sanitize each line
  // ...

  return logs.map(sanitizeLogs).slice(0, maxLines);
}

Step 4: Support Ticket Generator

// src/debug/support-ticket.ts
import { generateDebugBundle, DebugBundle } from './debug-bundle';
import { sanitizeLogs, extractSanitizedLogs } from './log-sanitizer';

interface SupportTicket {
  subject: string;
  description: string;
  debugBundle: DebugBundle;
  sanitizedLogs: string[];
  stepsToReproduce: string[];
  expectedBehavior: string;
  actualBehavior: string;
}

export async function generateSupportTicket(
  issue: {
    summary: string;
    stepsToReproduce: string[];
    expectedBehavior: string;
    actualBehavior: string;
  }
): Promise<SupportTicket> {
  const bundle = await generateDebugBundle();

  const logs = extractSanitizedLogs(
    '/var/log/app/openevidence.log',
    { start: new Date(Date.now() - 3600000), end: new Date() },
    500
  );

  return {
    subject: `[OpenEvidence Integration] ${issue.summary}`,
    description: `
## Issue Summary
${issue.summary}

## Environment
- Node Version: ${bundle.environment.nodeVersion}
- SDK Version: ${bundle.environment.sdkVersion}
- Base URL: ${bundle.environment.baseUrl}
- Timeout: ${bundle.environment.timeout}ms

## Connectivity
- Health Status: ${bundle.connectivity.healthStatus || 'Failed'}
- Latency: ${bundle.connectivity.latencyMs || 'N/A'}ms
- DNS Resolution: ${bundle.connectivity.dnsResolution ? 'OK' : 'Failed'}

## Recent Errors
${bundle.recentErrors.map(e => `- ${e.code}: ${e.count} occurrences (last: ${e.lastOccurred})`).join('\n') || 'None recorded'}
`,
    debugBundle: bundle,
    sanitizedLogs: logs,
    stepsToReproduce: issue.stepsToReproduce,
    expectedBehavior: issue.expectedBehavior,
    actualBehavior: issue.actualBehavior,
  };
}

Output

  • Environment configuration status
  • Connectivity test results
  • SDK version information
  • Sanitized logs (no PHI)
  • Formatted support ticket

Diagnostic Checklist

  • [ ] API key is set and correct length
  • [ ] Organization ID is configured
  • [ ] Health endpoint returns 200
  • [ ] DNS resolves api.openevidence.com
  • [ ] TLS handshake succeeds
  • [ ] Rate limits have headroom
  • [ ] No recent 5xx errors

Error Handling

Issue Check Resolution
No connectivity DNS, firewall Check network config
Auth failures API key format Regenerate key in dashboard
Timeouts Latency test Increase timeout, check network
PHI in logs Log sanitizer Audit logging configuration

Examples

Quick Debug Command

# Run bash debug script
chmod +x scripts/openevidence-debug.sh
./scripts/openevidence-debug.sh > debug-bundle.txt

Generate Support Ticket

const ticket = await generateSupportTicket({
  summary: 'Clinical queries timing out after SDK upgrade',
  stepsToReproduce: [
    '1. Upgrade @openevidence/sdk to v2.0.0',
    '2. Make clinical query request',
    '3. Request times out after 30s',
  ],
  expectedBehavior: 'Response within 10s',
  actualBehavior: 'Timeout after configured limit',
});

console.log(JSON.stringify(ticket, null, 2));

Resources

Next Steps

For rate limit management, see openevidence-rate-limits.

04 同仓库更多 Skills

Dicklesworthstone
Dicklesworthstone/pi_agent_rust

theme-factory

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

视觉设计
★ 2.0k
Dicklesworthstone
Dicklesworthstone/pi_agent_rust

web-artifacts-builder

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

前端开发
★ 2.0k
Dicklesworthstone
Dicklesworthstone/pi_agent_rust

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

测试与质量前端开发
★ 2.0k
Dicklesworthstone
Dicklesworthstone/pi_agent_rust

neuropixels-analysis

Neuropixels neural recording analysis. Load SpikeGLX/OpenEphys data, preprocess, motion correction, Kilosort4 spike sorting, quality metrics, Allen/IBL curation, AI-assisted visual analysis, for Neuropixels 1.0/2.0 extracellular electrophysiology. Use when working with neural recordings, spike sorting, extracellular electrophysiology, or when the user mentions Neuropixels, SpikeGLX, Open Ephys, Kilosort, quality metrics, or unit curation.

★ 2.0k
Dicklesworthstone
Dicklesworthstone/pi_agent_rust

skill-creator

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

Skill与智能体开发
★ 2.0k
Dicklesworthstone
Dicklesworthstone/pi_agent_rust

notebooklm

Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.

Skill与智能体开发
★ 2.0k