Communitygithub.com

ヘルスケア評価ハーネス — 患者安全検証

医療アプリケーションのデプロイメントのための患者安全評価ハーネス。CDSSの精度、PHIの露呈、臨床ワークフローの完全性、および統合コンプライアンスを自動テストし、安全性の失敗時にデプロイをブロックします。患者安全が最優先される医療デプロイメントのゲートとして使用します。

ヘルスケア評価ハーネス — 患者安全検証 とは?

Healthcare Eval Harnessは、医療アプリケーションのデプロイメント前に患者安全を自動検証するための評価ハーネスです。CDSS(臨床意思決定支援)の正確性、PHI(保護健康情報)の漏洩、データ整合性、臨床ワークフローの完全性、外部統合コンプライアンスの5つのテストカテゴリを実行します。最初の3カテゴリ(CDSS精度、PHI露呈、データ整合性)はCRITICALゲートであり、100%の合格率が必須で、1つでも失敗するとデプロイがブロックされます。残りの2カテゴリ(臨床ワークフロー、統合)はHIGHゲートで95%以上の合格率が必要です。Jestをデフォルトのテストランナーとしていますが、Vitest、pytest、PHPUnitなど他のフレームワークでも利用可能です。CI/CDパイプライン(GitHub Actionsなど)に簡単に統合でき、患者安全を損なう変更を確実にブロックします。

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

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

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

ドキュメント

ヘルスケア評価ハーネス — 患者安全検証 は何をしますか?

医療アプリケーションのデプロイメントのための自動検証システム。1つの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%必須)

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

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

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

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

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

4. 臨床ワークフロー (HIGH — 95%以上必須)

エンドツーエンドのフローをテストします:encounter ライフサイクル、テンプレートレンダリング、投薬セット、薬物/診断検索、処方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 gates — 100% required, bail on first failure
      - 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 gates — 95%+ required, custom threshold check
      - 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: すべてのクリティカルゲートをローカルで実行

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"
# Expected: { "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/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.

関連スキル