AGENT SKILL

openevidence-sdk-patterns

OpenEvidence SDK patterns and best practices for clinical AI integration. Use when implementing advanced SDK features, optimizing API usage, or following clinical decision support best practices. Trigger with phrases like "openevidence patterns", "openevidence best practices", "openevidence sdk", "clinical ai patterns".

License 许可
MIT
最近更新
2026-05-26
Stars
★ 0
Forks
0

01 前言 Front Matter

name
openevidence-sdk-patterns
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
version
1.0.0
description
OpenEvidence SDK patterns and best practices for clinical AI integration. Use when implementing advanced SDK features, optimizing API usage, or following clinical decision support best practices. Trigger with phrases like "openevidence patterns", "openevidence best practices", "openevidence sdk", "clinical ai patterns".
allowed-tools
Read, Write, Edit
compatible-with
claude-code, codex, openclaw

02 资源文件 1

03 SKILL.md 正文

OpenEvidence SDK Patterns

Table of Contents

Overview

Best practices and design patterns for building production clinical decision support with OpenEvidence. Covers client singleton, typed queries, query builder, response transformer, and caching strategies.

Prerequisites

  • Completed openevidence-install-auth setup
  • Understanding of async/await patterns
  • Familiarity with clinical workflows

Instructions

Step 1: Client Singleton with DI

Create OpenEvidenceClientFactory with configure(), getClient(), and setClient() (for testing). Ensures single client instance across the application.

Step 2: Define Typed Clinical Queries

Create TypeScript types for ClinicalSpecialty (10 specialties), QueryUrgency (stat/urgent/routine/research), ClinicalContext (specialty, urgency, patient demographics, conditions, medications), and QueryOptions.

Step 3: Implement Query Builder

Build fluent ClinicalQueryBuilder with .question(), .specialty(), .urgency(), .withPatient(), .withConditions(), .withMedications(), .maxCitations(), .includeGuidelines(), and .build() with validation.

Step 4: Create Response Transformer

Transform raw API responses into FormattedClinicalAnswer with summary, detailed answer, key points, evidence with strength ratings (high for NEJM/JAMA/Lancet, moderate for recent, low otherwise), and confidence level.

Step 5: Implement Caching Layer

Build ClinicalQueryCache with SHA-256 key generation, configurable TTL (1 hour default for clinical data), and invalidation support.

Output

  • Client singleton factory with dependency injection
  • Typed clinical query interfaces
  • Fluent query builder with validation
  • Response transformer with evidence strength ratings
  • In-memory caching with TTL management

Error Handling

Pattern Use Case Benefit
Singleton Single client instance Memory efficiency, connection reuse
Builder Complex queries Type safety, validation, readability
Transformer Response normalization Consistent UI layer, evidence grading
Cache Repeated queries Reduced API calls, lower latency

Examples

Query Builder Usage

const query = new ClinicalQueryBuilder()
  .question('Recommended statin dosing for secondary prevention?')
  .specialty('cardiology')
  .urgency('routine')
  .withPatient(65, 'male')
  .withConditions(['prior MI', 'hyperlipidemia'])
  .includeGuidelines()
  .build();

See detailed implementation for advanced patterns.

Resources

04 同仓库更多 Skills

SamuelChien
SamuelChien/mega-skills-collection

zustand-store-ts

Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zustand-store-creator

Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zero-trust-config-helper

Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zapier-integration-helper

Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

zai-cli

Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.

★ 0
SamuelChien
SamuelChien/mega-skills-collection

yt-research

Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.

★ 0