Communitygithub.com

醫療保健評估測試平台 — 病患安全驗證

用於醫療保健應用程式部署的病患安全評估測試平台。自動化測試套件,涵蓋 CDSS 準確性、PHI 暴露、臨床工作流程完整性及整合合規性。若安全測試失敗則阻止部署。在需要以病患安全測試作為部署閘門時使用。

醫療保健評估測試平台 — 病患安全驗證 是什麼?

Healthcare Eval Harness 是一個自動化驗證系統,專為醫療保健應用程式的部署設計。它執行五大測試類別:CDSS 準確性(臨床決策支援)、PHI 暴露(受保護健康資訊)、資料完整性、臨床工作流程與整合合規性。前三個類別被設為「關鍵」(CRITICAL) 閘門,要求 100% 通過率,若任何一項失敗即完全阻止部署;後兩個類別則為「高」(HIGH) 閘門,要求 95% 以上通過率,失敗時僅發出警告,允許人工審查後放行。此技能支援任何測試框架(文件以 Jest 為範例),並可直接整合至 CI/CD 管道(如 GitHub Actions)。它適合在每次 EMR/EHR 應用部署、CDSS 邏輯修改、資料庫結構變更、認證或存取控制調整前執行,確保病患安全不受妥協。其反模式包括跳過 CDSS 測試、將關鍵閘門門檻設低於 100%、或在關鍵測試套件中使用 `--no-bail`。

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

在你喜歡的 AI 中提問

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

說明文件

Healthcare Eval Harness — 病患安全驗證

醫療保健應用程式部署的自動化驗證系統。單一 CRITICAL 失敗即阻止部署。病患安全不容妥協。

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

使用時機

  • 在任何 EMR/EHR 應用程式部署之前
  • 修改 CDSS 邏輯(藥物交互作用、劑量驗證、評分)之後
  • 變更觸及病患資料的資料庫結構之後
  • 修改認證或存取控制之後
  • 在為醫療保健應用設定 CI/CD 管道時
  • 解決臨床模組中的合併衝突之後

運作方式

評估測試平台依序執行五個測試類別。前三項(CDSS 準確性、PHI 暴露、資料完整性)是關鍵 (CRITICAL) 閘門,要求 100% 通過率——單一失敗即阻止部署。其餘兩項(臨床工作流程、整合)是高 (HIGH) 閘門,要求 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

      # CRITICAL gates — 100% required, bail on first failure
      - name: CDSS 準確性
        run: npx jest --testPathPattern='tests/cdss' --bail --ci --coverage --coverageThreshold='{"global":{"branches":80,"functions":80,"lines":80}}'

      - name: PHI 暴露檢查
        run: npx jest --testPathPattern='tests/security/phi' --bail --ci

      - name: 資料完整性
        run: npx jest --testPathPattern='tests/data-integrity' --bail --ci

      # HIGH gates — 95%+ required, custom threshold check
      - name: 臨床工作流程
        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: 整合合規性
        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]

### 病患安全:通過

| 類別 | 測試數 | 通過 | 失敗 | 狀態 |
|----------|-------|------|------|--------|
| 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/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

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.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相關技能