Communitygithub.com

醫療評估檢查工具

醫療保健應用部署的患者安全評估框架。自動化測試套件涵蓋CDSS準確性、PHI暴露、臨床工作流程完整性與整合合規性。安全失敗時阻止部署。在需要透過患者安全測試來管控醫療保健部署時使用。

醫療評估檢查工具 是什麼?

Healthcare Eval Harness 是一個專為醫療保健應用程式部署設計的自動化患者安全驗證系統。它包含五個測試類別,其中前三項(CDSS準確性、PHI暴露、資料完整性)為關鍵門檻,要求100%通過率,單一失敗即阻止部署;後兩項(臨床工作流程、整合合規性)為高門檻,要求95%以上通過率。該框架支援基於 Jest 的測試,但可適應 Vitest、pytest、PHPUnit 等測試框架,並提供完整的 CI/CD 整合範例。透過在部署前自動執行這些測試,確保電子病歷系統、臨床決策支援邏輯、資料庫變更及身分驗證控制的安全性,避免患者安全事件發生。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/healthcare-eval-harness

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Healthcare Eval Harness — 患者安全驗證

醫療保健應用部署的自動化驗證系統。單一關鍵失敗即可阻止部署。患者安全不容妥協。

注意: 範例使用 Jest 作為參考測試執行器。請根據您的框架(Vitest、pytest、PHPUnit 等)調整命令——測試類別與通過門檻是框架無關的。

使用時機

  • 任何 EMR/EHR 應用部署之前
  • 修改 CDSS 邏輯(藥物交互、劑量驗證、評分)之後
  • 更改涉及患者資料的資料庫結構之後
  • 修改身分驗證或存取控制之後
  • 在醫療保健應用的 CI/CD 管線配置期間
  • 解決臨床模組中的合併衝突之後

運作方式

評估檢查工具依序執行五個測試類別。前三項(CDSS 準確性、PHI 暴露、資料完整性)為關鍵門檻,要求 100% 通過率——單一失敗即阻止部署。其餘兩項(臨床工作流程、整合合規性)為高門檻,要求 95% 以上通過率。

每個類別對應一個 Jest 測試路徑模式。CI 管線使用 --bail(遇到第一個失敗即停止)執行關鍵門檻,並透過 --coverage --coverageThreshold 強制設定覆蓋率門檻。

評估類別

1. CDSS 準確性(關鍵 — 100% 要求)

測試所有臨床決策支援邏輯:藥物交互配對(雙向)、劑量驗證規則、臨床評分與已發布規格的一致性、無假陰性、無靜默失敗。

npx jest --testPathPattern='tests/cdss' --bail --ci --coverage

2. PHI 暴露(關鍵 — 100% 要求)

測試受保護健康資訊洩漏:API 錯誤回應、控制台輸出、URL 參數、瀏覽器儲存、跨機構隔離、未經授權存取、缺少服務角色金鑰。

npx jest --testPathPattern='tests/security/phi' --bail --ci

3. 資料完整性(關鍵 — 100% 要求)

測試臨床資料安全性:已鎖定的就診記錄、稽核軌跡條目、串聯刪除保護、並行編輯處理、無孤立記錄。

npx jest --testPathPattern='tests/data-integrity' --bail --ci

4. 臨床工作流程(高 — 95%+ 要求)

測試端到端流程:就診生命週期、範本渲染、用藥套組、藥物/診斷搜尋、處方 PDF、紅色警報。

tmp_json=$(mktemp)
npx jest --testPathPattern='tests/clinical' --ci --json --outputFile="$tmp_json" || true
total=$(jq '.numTotalTests // 0' "$tmp_json")
passed=$(jq '.numPassedTests // 0' "$tmp_json")
if [ "$total" -eq 0 ]; then
  echo "未找到臨床測試" >&2
  exit 1
fi
rate=$(echo "scale=2; $passed * 100 / $total" | bc)
echo "臨床通過率: ${rate}% ($passed/$total)"

5. 整合合規性(高 — 95%+ 要求)

測試外部系統:HL7 訊息解析 (v2.x)、FHIR 驗證、檢驗結果映射、格式錯誤訊息處理。

tmp_json=$(mktemp)
npx jest --testPathPattern='tests/integration' --ci --json --outputFile="$tmp_json" || true
total=$(jq '.numTotalTests // 0' "$tmp_json")
passed=$(jq '.numPassedTests // 0' "$tmp_json")
if [ "$total" -eq 0 ]; then
  echo "未找到整合測試" >&2
  exit 1
fi
rate=$(echo "scale=2; $passed * 100 / $total" | bc)
echo "整合通過率: ${rate}% ($passed/$total)"

通過/失敗矩陣

類別門檻失敗時動作
CDSS 準確性100%阻止部署
PHI 暴露100%阻止部署
資料完整性100%阻止部署
臨床工作流程95%+警告,允許經審查後部署
整合合規性95%+警告,允許經審查後部署

CI/CD 整合

name: Healthcare Safety Gate
on: [push, pull_request]

jobs:
  safety-gate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm ci

      # 關鍵門檻 — 100% 要求,遇到第一個失敗即停止
      - name: CDSS Accuracy
        run: npx jest --testPathPattern='tests/cdss' --bail --ci --coverage --coverageThreshold='{"global":{"branches":80,"functions":80,"lines":80}}'

      - name: PHI Exposure Check
        run: npx jest --testPathPattern='tests/security/phi' --bail --ci

      - name: Data Integrity
        run: npx jest --testPathPattern='tests/data-integrity' --bail --ci

      # 高門檻 — 95%+ 要求,自訂門檻檢查
      # 高門檻 — 95%+ 要求
      - name: Clinical Workflows
        run: |
          TMP_JSON=$(mktemp)
          npx jest --testPathPattern='tests/clinical' --ci --json --outputFile="$TMP_JSON" || true
          TOTAL=$(jq '.numTotalTests // 0' "$TMP_JSON")
          PASSED=$(jq '.numPassedTests // 0' "$TMP_JSON")
          if [ "$TOTAL" -eq 0 ]; then
            echo "::error::未找到臨床測試"; exit 1
          fi
          RATE=$(echo "scale=2; $PASSED * 100 / $TOTAL" | bc)
          echo "通過率: ${RATE}% ($PASSED/$TOTAL)"
          if (( $(echo "$RATE < 95" | bc -l) )); then
            echo "::warning::臨床通過率 ${RATE}% 低於 95%"
          fi

      - name: Integration Compliance
        run: |
          TMP_JSON=$(mktemp)
          npx jest --testPathPattern='tests/integration' --ci --json --outputFile="$TMP_JSON" || true
          TOTAL=$(jq '.numTotalTests // 0' "$TMP_JSON")
          PASSED=$(jq '.numPassedTests // 0' "$TMP_JSON")
          if [ "$TOTAL" -eq 0 ]; then
            echo "::error::未找到整合測試"; exit 1
          fi
          RATE=$(echo "scale=2; $PASSED * 100 / $TOTAL" | bc)
          echo "通過率: ${RATE}% ($PASSED/$TOTAL)"
          if (( $(echo "$RATE < 95" | bc -l) )); then
            echo "::warning::整合通過率 ${RATE}% 低於 95%"
          fi

反模式

  • 跳過 CDSS 測試「因為上次通過了」
  • 將關鍵門檻設定低於 100%
  • 在關鍵測試套件中使用 --no-bail
  • 在整合測試中模擬 CDSS 引擎(必須測試真實邏輯)
  • 安全門為紅色時仍允許部署
  • 在 CDSS 套件中執行測試時不使用 --coverage

範例

範例 1:在本機執行所有關鍵門檻

npx jest --testPathPattern='tests/cdss' --bail --ci --coverage && \
npx jest --testPathPattern='tests/security/phi' --bail --ci && \
npx jest --testPathPattern='tests/data-integrity' --bail --ci

範例 2:檢查高門檻通過率

tmp_json=$(mktemp)
npx jest --testPathPattern='tests/clinical' --ci --json --outputFile="$tmp_json" || true
jq '{
  passed: (.numPassedTests // 0),
  total: (.numTotalTests // 0),
  rate: (if (.numTotalTests // 0) == 0 then 0 else ((.numPassedTests // 0) / (.numTotalTests // 1) * 100) end)
}' "$tmp_json"
# 預期: { "passed": 21, "total": 22, "rate": 95.45 }

範例 3:評估報告

## Healthcare Eval: 2026-03-27 [commit abc1234]

### Patient Safety: PASS

| 類別 | 測試數 | 通過 | 失敗 | 狀態 |
|----------|-------|------|------|--------|
| CDSS 準確性 | 39 | 39 | 0 | 通過 |
| PHI 暴露 | 8 | 8 | 0 | 通過 |
| 資料完整性 | 12 | 12 | 0 | 通過 |
| 臨床工作流程 | 22 | 21 | 1 | 95.5% 通過 |
| 整合合規性 | 6 | 6 | 0 | 通過 |

### 覆蓋率: 84%(目標: 80%+)
### 裁決: 可安全部署

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相關技能