feat: Healthcare domain — 4 skills + 1 agent for health-tech applications#955
feat: Healthcare domain — 4 skills + 1 agent for health-tech applications#955drkeyurpatel-wq wants to merge 3 commits intoaffaan-m:mainfrom
Conversation
New skills: - healthcare-emr-patterns: EMR/EHR encounter workflows, smart templates, medication safety, clinical UI patterns - healthcare-phi-compliance: PHI/PII protection patterns, RLS templates, leak vector checklist, audit trail patterns - healthcare-cdss-patterns: Drug interaction checking, dose validation, clinical scoring (NEWS2/qSOFA), alert severity - healthcare-eval-harness: Patient safety CI/CD gate — CDSS accuracy, PHI exposure, data integrity, clinical workflows New agent: - healthcare-reviewer: Clinical safety reviewer for CDSS accuracy, PHI compliance, medical data integrity All patterns are generalized and framework-agnostic. Applicable to any health-tech stack. Origin: Health1 Super Speciality Hospitals, Ahmedabad, India.
|
Analysis Failed
Troubleshooting
Retry: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (4)
📝 WalkthroughWalkthroughAdds five new healthcare documentation/specification files covering a clinical-safety agent spec, CDSS patterns, EMR workflow patterns, PHI/PII compliance guidance, and a patient-safety evaluation harness with CI gating and test criteria. Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR adds the first healthcare/clinical domain to ECC: four skills covering CDSS patterns, PHI/PII compliance, EMR/EHR workflows, and a patient-safety CI/CD eval harness, plus a read-only Convergence from prior review round: All critical items from previous threads have been resolved — the Remaining minor items:
Confidence Score: 4/5Safe to merge after addressing the Supabase-specific auth.uid() documentation note; no correctness or security issues in the core patterns. All blocking concerns from the prior review round have been resolved (null interface, silent CI errors, non-standard frontmatter). The two remaining items are both P2 documentation quality suggestions with no runtime impact. The overall contribution is high quality: comprehensive clinical patterns, well-structured skill files, and a properly constrained read-only agent. skills/healthcare-phi-compliance/SKILL.md — auth.uid() Supabase dependency worth noting for framework-agnostic claims. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[EMR UI — Clinician Input] --> B[CDSS Engine]
B --> C{checkInteractions}
B --> D{validateDose}
B --> E{calculateNEWS2}
C -->|Critical| F[Block + Non-dismissable Modal]
C -->|Major| G[Warning Banner]
C -->|Minor| H[Info Note]
D -->|weight missing| F
D -->|out of range| F
D -->|within range| I[Allow prescribing]
E -->|HIGH risk| F
E -->|low/medium| J[Show escalation guidance inline]
F --> K{Clinician overrides?}
K -->|Yes - documents reason| L[Audit Trail Entry]
K -->|No| M[Action Blocked]
L --> N[Proceed with documented override]
subgraph CI Safety Gate
O[Push / PR] --> P[CDSS Accuracy - 100% required]
P -->|PASS| Q[PHI Exposure - 100% required]
Q -->|PASS| R[Data Integrity - 100% required]
R -->|PASS| S[Clinical Workflow - 95%+ required]
S --> T[Integration Compliance - 95%+ required]
T -->|All gates pass| U[SAFE TO DEPLOY]
P -->|FAIL| V[BLOCK deployment]
Q -->|FAIL| V
R -->|FAIL| V
end
Reviews (3): Last reviewed commit: "fix: address Greptile review — frontmatt..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@skills/healthcare-cdss-patterns/SKILL.md`:
- Around line 15-239: Add the required canonical headings to conform to repo
standards: insert explicit sections titled "When to Use", "How It Works", and
"Examples" in SKILL.md; under "When to Use" summarize activation scenarios
(e.g., drug interaction checking, dose validation, clinical scoring) by reusing
the existing "When to Activate" content, under "How It Works" describe the
architecture and key pure-function principle and reference the primary
functions/modules (checkInteractions, validateDose, NEWS2 engine) and data
models (DrugInteractionPair, DoseValidationResult, NEWS2Input/NEWS2Result), and
under "Examples" provide short example usages for checkInteractions and
validateDose (test cases from the test suite) and a snippet describing expected
NEWS2 output; ensure headings are top-level Markdown headers and preserve all
safety warnings and testing requirements.
- Around line 111-127: The DoseValidationResult.suggestedRange is declared
non-nullable but validateDose returns null for the "no rules available" path;
change the type to allow null (e.g., suggestedRange: { min: number; max: number;
unit: string } | null) or make it optional, and update any code that reads
suggestedRange accordingly (including the validateDose return and any callers)
so the interface DoseValidationResult and the validateDose implementation have
matching, null-safe types.
In `@skills/healthcare-emr-patterns/SKILL.md`:
- Around line 15-139: Rename the "When to Activate" header to "When to Use" and
add two new top-level headings "How It Works" and "Examples" (exact phrases
required by the skill format); move or reorganize existing content so "Core
Principles", "Single-Page Encounter Flow", "Smart Template System", "Medication
Safety Pattern", "Locked Encounter Pattern", "UI Patterns for Clinical Data",
"Accessibility for Healthcare", and "Anti-Patterns" become the "How It Works"
section content (keeping their subheadings and details intact), and create an
"Examples" section that contains 2–3 concrete, short examples such as "Patient
encounter flow (chief complaint → diagnosis → prescription)", "Medication safety
workflow (interaction check → override logging)", and "Locked encounter +
addendum workflow" to illustrate usage; ensure the new headings are top-level
Markdown headings and preserve all existing text under the appropriate new
headings.
In `@skills/healthcare-eval-harness/SKILL.md`:
- Around line 15-169: The doc is missing the required top-level section
headings; rename "When to Activate" to the exact heading "When to Use", and add
new sections titled "How It Works" and "Examples" (verbatim) to satisfy
docs-format checks; place "How It Works" after "When to Use" summarizing the
evaluation flow (reference the existing Eval Categories and CI/CD Integration
paragraphs and the GitHub Actions snippet), and add an "Examples" section that
shows example commands (reference the existing jest commands npx jest
--testPathPattern='tests/cdss' --bail --ci etc.) and a short example report
template (use the existing Eval Report Format) so the file contains the three
required headings and illustrative examples.
In `@skills/healthcare-phi-compliance/SKILL.md`:
- Line 41: Replace the phrase "Non-patient sensitive data in healthcare systems"
with hyphenated form "Non-patient-sensitive data in healthcare systems" in
SKILL.md; locate the exact text used in the heading/line and update it to the
hyphenated version to improve consistency and readability.
- Around line 15-185: The SKILL.md uses non-canonical section names (e.g., "When
to Activate") and is missing the required top-level headings "When to Use", "How
It Works", and "Examples"; update the document to rename "When to Activate" ->
"When to Use", add a new "How It Works" section that summarizes the rationale
and mechanics behind the guidance (covering Data Classification, Access Control
Patterns like the RLS policies shown, and Audit Trail Requirements), and add an
"Examples" section that provides short, concrete examples drawn from the
existing content (e.g., the RLS SQL snippet, PHI vs PII examples, and good/bad
error logging examples) so the file conforms to the canonical skill structure
while keeping existing guidance under the appropriate new headings.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: faa8607d-845b-4f32-9436-5a42b73ca79f
📒 Files selected for processing (5)
agents/healthcare-reviewer.mdskills/healthcare-cdss-patterns/SKILL.mdskills/healthcare-emr-patterns/SKILL.mdskills/healthcare-eval-harness/SKILL.mdskills/healthcare-phi-compliance/SKILL.md
There was a problem hiding this comment.
7 issues found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="skills/healthcare-cdss-patterns/SKILL.md">
<violation number="1" location="skills/healthcare-cdss-patterns/SKILL.md:114">
P2: `suggestedRange` is typed as a required object but returned as `null` in one code path, creating an inconsistent and unsafe contract.</violation>
<violation number="2" location="skills/healthcare-cdss-patterns/SKILL.md:124">
P2: `validateDose` accepts age and renal-function inputs but never uses them, despite presenting these as considered dosing factors.</violation>
<violation number="3" location="skills/healthcare-cdss-patterns/SKILL.md:130">
P1: Weight-based dose safety check is conditionally skipped on missing/falsy patient weight, allowing false-negative validation for mg/kg drugs.</violation>
</file>
<file name="skills/healthcare-emr-patterns/SKILL.md">
<violation number="1" location="skills/healthcare-emr-patterns/SKILL.md:81">
P1: Medication safety guidance is internally contradictory for critical interactions (hard block vs overrideable by default), risking inconsistent clinical safety behavior.</violation>
</file>
<file name="skills/healthcare-eval-harness/SKILL.md">
<violation number="1" location="skills/healthcare-eval-harness/SKILL.md:128">
P2: The documented 95%+ HIGH-gate policy is not enforced by the CI example, which only runs plain Jest commands without percentage-threshold logic.</violation>
<violation number="2" location="skills/healthcare-eval-harness/SKILL.md:159">
P2: Coverage target is documented in the report, but the provided test/CI commands do not collect or enforce coverage, creating a safety-gate documentation mismatch.</violation>
</file>
<file name="skills/healthcare-phi-compliance/SKILL.md">
<violation number="1" location="skills/healthcare-phi-compliance/SKILL.md:105">
P1: The compliance guide inconsistently treats patient IDs as safe to log, despite defining identifier numbers as PHI, which can lead to PHI leakage in logs.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
CodeRabbit fixes (6 comments): - All 4 skills: renamed 'When to Activate' → 'When to Use', added 'How It Works' and 'Examples' sections - CDSS: DoseValidationResult.suggestedRange now typed as '| null' - PHI: hyphenated 'Non-patient-sensitive' Cubic fixes (7 issues): - P1: CDSS weight-based check now BLOCKS when weight missing (was false-negative pass) - P1: EMR medication safety clarified — critical = hard block, override requires documented reason - P1: PHI logging guidance clarified — use opaque UUIDs only, not medical record numbers - P2: CDSS validateDose now uses age and renal function params (ageAdjusted, renalAdjusted rules) - P2: Eval CI example now enforces 95% threshold with jq + bc calculation - P2: Eval CI example now includes --coverage --coverageThreshold on CDSS suite - P2: CDSS suggestedRange null type fixed (same as CodeRabbit)
|
Analysis Failed
Troubleshooting
Retry: |
Greptile fixes: - Removed non-standard YAML frontmatter fields (observe, feedback, rollback) from all 4 skills — only name, description, origin, version per CONTRIBUTING.md - Added null guard to checkInteractions implementation (was missing despite test) - CI: replaced 2>/dev/null with 2>&1 (was silencing safety-critical errors) - CI: quoted $RESULT variable (was breaking jq on JSON with spaces) - CI: added division-by-zero guard when test suite is empty - CI: added note that Jest is reference implementation, thresholds are framework-agnostic
|
Analysis Failed
Troubleshooting
Retry: |
There was a problem hiding this comment.
3 issues found across 4 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="skills/healthcare-emr-patterns/SKILL.md">
<violation number="1" location="skills/healthcare-emr-patterns/SKILL.md:76">
P2: Medication policy wording is internally inconsistent for CRITICAL interactions (hard block vs overrideable block), which can lead to inconsistent safety behavior.</violation>
</file>
<file name="skills/healthcare-eval-harness/SKILL.md">
<violation number="1" location="skills/healthcare-eval-harness/SKILL.md:60">
P2: Documentation references `scripts/check-pass-rate.js`, but the script does not exist anywhere in the repo, so the example commands will fail for users.</violation>
<violation number="2" location="skills/healthcare-eval-harness/SKILL.md:111">
P2: The CI example merges stderr into stdout (`2>&1`) and then parses the output as JSON with `jq`. Any Jest warnings or stderr output will break JSON parsing and fail the step unexpectedly. Keep stderr separate or use `--outputFile` for JSON to avoid non‑deterministic failures.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| → Check encounter medications for interactions | ||
| → Check patient allergies | ||
| → Validate dose against weight/age/renal function | ||
| → If CRITICAL interaction: BLOCK prescribing entirely |
There was a problem hiding this comment.
P2: Medication policy wording is internally inconsistent for CRITICAL interactions (hard block vs overrideable block), which can lead to inconsistent safety behavior.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At skills/healthcare-emr-patterns/SKILL.md, line 76:
<comment>Medication policy wording is internally inconsistent for CRITICAL interactions (hard block vs overrideable block), which can lead to inconsistent safety behavior.</comment>
<file context>
@@ -68,72 +63,97 @@ interface ClinicalTemplate {
→ Validate dose against weight/age/renal function
- → Display alerts (critical = block, major = require override reason)
- → Log override reason if clinician proceeds
+ → If CRITICAL interaction: BLOCK prescribing entirely
+ → Clinician must document override reason to proceed past a block
+ → If MAJOR interaction: display warning, require acknowledgment
</file context>
| → If CRITICAL interaction: BLOCK prescribing entirely | |
| → If CRITICAL interaction: BLOCK by default; allow proceed only with explicit clinician override reason |
| # HIGH gates — 95%+ required | ||
| - name: Clinical Workflows | ||
| run: | | ||
| RESULT=$(npx jest --testPathPattern='tests/clinical' --ci --json 2>&1) || true |
There was a problem hiding this comment.
P2: The CI example merges stderr into stdout (2>&1) and then parses the output as JSON with jq. Any Jest warnings or stderr output will break JSON parsing and fail the step unexpectedly. Keep stderr separate or use --outputFile for JSON to avoid non‑deterministic failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At skills/healthcare-eval-harness/SKILL.md, line 111:
<comment>The CI example merges stderr into stdout (`2>&1`) and then parses the output as JSON with `jq`. Any Jest warnings or stderr output will break JSON parsing and fail the step unexpectedly. Keep stderr separate or use `--outputFile` for JSON to avoid non‑deterministic failures.</comment>
<file context>
@@ -113,57 +94,89 @@ jobs:
- name: Clinical Workflows
- run: npx jest --testPathPattern='tests/clinical' --ci
+ run: |
+ RESULT=$(npx jest --testPathPattern='tests/clinical' --ci --json 2>&1) || true
+ TOTAL=$(echo "$RESULT" | jq '.numTotalTests // 0')
+ PASSED=$(echo "$RESULT" | jq '.numPassedTests // 0')
</file context>
| Tests end-to-end flows: encounter lifecycle, template rendering, medication sets, drug/diagnosis search, prescription PDF, red flag alerts. | ||
|
|
||
| ```bash | ||
| npx jest --testPathPattern='tests/clinical' --ci 2>&1 | node scripts/check-pass-rate.js 95 |
There was a problem hiding this comment.
P2: Documentation references scripts/check-pass-rate.js, but the script does not exist anywhere in the repo, so the example commands will fail for users.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At skills/healthcare-eval-harness/SKILL.md, line 60:
<comment>Documentation references `scripts/check-pass-rate.js`, but the script does not exist anywhere in the repo, so the example commands will fail for users.</comment>
<file context>
@@ -21,83 +20,65 @@ Automated verification system for healthcare application deployments. A single C
```bash
-npx jest --testPathPattern='tests/clinical' --ci
+npx jest --testPathPattern='tests/clinical' --ci 2>&1 | node scripts/check-pass-rate.js 95
</file context>
</details>
<a href="https://www.cubic.dev/action/fix/violation/8e4014c4-50e3-4f97-ae98-04e136d5b6f8" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://cubic.dev/buttons/fix-with-cubic-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="https://cubic.dev/buttons/fix-with-cubic-light.svg">
<img alt="Fix with Cubic" src="https://cubic.dev/buttons/fix-with-cubic-dark.svg">
</picture>
</a>
Healthcare Domain Skills & Agent
First healthcare/clinical domain contribution to ECC. All patterns are generalized and framework-agnostic — usable by any health-tech team building EMR/EHR, clinical decision support, or health information systems.
New Skills (4)
healthcare-emr-patternshealthcare-phi-compliancehealthcare-cdss-patternshealthcare-eval-harnessNew Agent (1)
healthcare-reviewerOrigin
Battle-tested at Health1 Super Speciality Hospitals (Ahmedabad, India) — 5 centres, 410 operational beds, full digital ecosystem (EMR, HMIS, vendor management, doctor payouts, HR). Patterns extracted from production healthcare applications handling real PHI.
What is not included
No PHI, no patient data, no credentials, no Health1-specific business logic. All patterns are generalized templates.
Testing
All skills follow ECC v1.9 format with YAML frontmatter including
version,observe,feedback, androllbackmetadata.Contributed by Dr. Keyur Patel (@drkeyurpatel-wq) — MD, Health1 Super Speciality Hospitals
Summary by cubic
Adds the healthcare domain with 4 reusable skills and a clinical safety reviewer agent for EMR/CDSS features with strict PHI protection and patient safety gates. Tightens safety checks, normalizes skill frontmatter, and hardens CI examples to avoid silenced errors.
New Features
healthcare-emr-patterns— Encounter workflows, medication safety, accessibility-first clinical UI.healthcare-phi-compliance— PHI/PII classification, RLS templates, leak vectors, audit/deployment checklist.healthcare-cdss-patterns— Drug interactions, dose validation, NEWS2/qSOFA scoring, alert severity patterns.healthcare-eval-harness— CI safety gate for CDSS accuracy, PHI exposure, data integrity; clinical/integration suites; GitHub Actions example.healthcare-reviewer— Read-only agent for CDSS accuracy, PHI compliance, data integrity, and integration validation.Bug Fixes
validateDoserespects age/renal rules;suggestedRangetyped as| null; null guard added incheckInteractions.2>&1),$RESULTquoted, empty-suite guard; Jest noted as reference (framework-agnostic thresholds); skills frontmatter trimmed to allowed fields only.Written for commit 9b24bed. Summary will update on new commits.
Summary by CodeRabbit