Communitygithub.com

医療評価ハーネス — 患者安全検証

医療アプリケーションのデプロイメントにおける患者安全評価ハーネス。CDSSの精度、PHI露出、臨床ワークフローの整合性、統合コンプライアンスを自動テストし、安全性違反がある場合にデプロイをブロックします。

医療評価ハーネス — 患者安全検証 とは?

Healthcare Eval Harnessは、医療アプリケーションのデプロイメントにおいて患者安全を担保する自動検証システムです。5つのテストカテゴリ(CDSS精度、PHI露出、データ整合性、臨床ワークフロー、統合コンプライアンス)を段階的に実行し、最初の3つはCRITICALゲートとして100%の合格率を要求し、1件の失敗でもデプロイをブロックします。残り2つはHIGHゲートとして95%以上の合格率を必要とし、警告は発するがレビュー付きで許可されます。CI/CD統合によりプッシュやプルリクエストごとに自動実行でき、テストランナーとしてはJestを例示していますが、Vitestやpytestなどフレームワークに依存しない設計です。これにより、医療規制要件を満たしつつ、患者データの安全性を確保しながらデプロイを進められます。

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

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Healthcare Eval Harness — 患者安全検証

医療アプリケーションのデプロイメント向け自動検証システム。単一のCRITICALな失敗がデプロイをブロックします。患者安全は絶対条件です。

注: 例ではJestを参照テストランナーとして使用しています。コマンドはご利用のフレームワーク(Vitest、pytest、PHPUnitなど)に合わせて調整してください。テストカテゴリと合格しきい値はフレームワークに依存しません。

使用すべきタイミング

  • EMR/EHRアプリケーションのデプロイメント前
  • CDSSロジック(薬物相互作用、用量バリデーション、スコアリング)を変更した後
  • 患者データに触れるデータベーススキーマを変更した後
  • 認証またはアクセス制御を変更した後
  • 医療アプリケーションのCI/CDパイプライン設定時
  • 臨床モジュールのマージ競合を解決した後

動作の仕組み

評価ハーネスは5つのテストカテゴリを順に実行します。最初の3つ(CDSS精度、PHI露出、データ整合性)はCRITICALゲートで、100%の合格率が必要です。1件の失敗でもデプロイをブロックします。残りの2つ(臨床ワークフロー、統合)はHIGHゲートで、95%以上の合格率が必要です。

各カテゴリはJestのテストパスパターンにマッピングされます。CIパイプラインはCRITICALゲートを--bail(最初の失敗で停止)で実行し、--coverage --coverageThresholdでカバレッジしきい値を適用します。

評価カテゴリ

1. CDSS精度(CRITICAL — 100%必須)

すべての臨床意思決定支援ロジックをテスト:薬物相互作用ペア(両方向)、用量バリデーションルール、公開仕様に対する臨床スコアリング、偽陰性なし、サイレント障害なし。

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

2. PHI露出(CRITICAL — 100%必須)

保護健康情報(PHI)の漏洩をテスト:APIエラーレスポンス、コンソール出力、URLパラメータ、ブラウザストレージ、施設間分離、未認証アクセス、サービスロールキーの欠如。

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

3. データ整合性(CRITICAL — 100%必須)

臨床データの安全性をテスト:ロックされた診療記録、監査証跡エントリ、カスケード削除保護、同時編集処理、孤立レコードなし。

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

4. 臨床ワークフロー(HIGH — 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 "No clinical tests found" >&2
  exit 1
fi
rate=$(echo "scale=2; $passed * 100 / $total" | bc)
echo "Clinical pass rate: ${rate}% ($passed/$total)"

5. 統合コンプライアンス(HIGH — 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 "No integration tests found" >&2
  exit 1
fi
rate=$(echo "scale=2; $passed * 100 / $total" | bc)
echo "Integration pass rate: ${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ゲート — 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

      # HIGHゲート — 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::No clinical tests found"; exit 1
          fi
          RATE=$(echo "scale=2; $PASSED * 100 / $TOTAL" | bc)
          echo "Pass rate: ${RATE}% ($PASSED/$TOTAL)"
          if (( $(echo "$RATE < 95" | bc -l) )); then
            echo "::warning::Clinical pass rate ${RATE}% below 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::No integration tests found"; exit 1
          fi
          RATE=$(echo "scale=2; $PASSED * 100 / $TOTAL" | bc)
          echo "Pass rate: ${RATE}% ($PASSED/$TOTAL)"
          if (( $(echo "$RATE < 95" | bc -l) )); then
            echo "::warning::Integration pass rate ${RATE}% below 95%"
          fi

アンチパターン

  • 「前回合格したから」という理由でCDSSテストをスキップする
  • CRITICALのしきい値を100%未満に設定する
  • CRITICALテストスイートで--no-bailを使用する
  • 統合テストでCDSSエンジンをモックする(実際のロジックをテストする必要がある)
  • 安全ゲートが赤のときにデプロイを許可する
  • CDSSスイートで--coverageなしでテストを実行する

例

例1: すべてのCRITICALゲートをローカルで実行

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: HIGHゲートの合格率を確認

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 | PASS |
| PHI露出 | 8 | 8 | 0 | PASS |
| データ整合性 | 12 | 12 | 0 | PASS |
| 臨床ワークフロー | 22 | 21 | 1 | 95.5% PASS |
| 統合 | 6 | 6 | 0 | PASS |

### カバレッジ: 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.

関連スキル