clinical-decision-support

Use this skill when implementing clinical decision support in Health Cloud: creating ClinicalAlert records via Apex or Flow, ingesting CareGap records from external clinical rules engines, displaying CDS alerts in FlexCard UIs, and integrating the Business Rules Engine for custom protocol checks. NOT for standard Flow automation unrelated to clinical decision support, or for clinical rules engine design outside of Salesforce.

Best use case

clinical-decision-support is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use this skill when implementing clinical decision support in Health Cloud: creating ClinicalAlert records via Apex or Flow, ingesting CareGap records from external clinical rules engines, displaying CDS alerts in FlexCard UIs, and integrating the Business Rules Engine for custom protocol checks. NOT for standard Flow automation unrelated to clinical decision support, or for clinical rules engine design outside of Salesforce.

Teams using clinical-decision-support should expect a more consistent output, faster repeated execution, less prompt rewriting, better workflow continuity with your supporting tools.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.
  • You already have the supporting tools or dependencies needed by this skill.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/clinical-decision-support/SKILL.md --create-dirs "https://raw.githubusercontent.com/PranavNagrecha/AwesomeSalesforceSkills/main/skills/apex/clinical-decision-support/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/clinical-decision-support/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How clinical-decision-support Compares

Feature / Agentclinical-decision-supportStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use this skill when implementing clinical decision support in Health Cloud: creating ClinicalAlert records via Apex or Flow, ingesting CareGap records from external clinical rules engines, displaying CDS alerts in FlexCard UIs, and integrating the Business Rules Engine for custom protocol checks. NOT for standard Flow automation unrelated to clinical decision support, or for clinical rules engine design outside of Salesforce.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Clinical Decision Support in Health Cloud

Use this skill when implementing clinical decision support in Health Cloud: creating ClinicalAlert records to surface clinical protocol alerts, ingesting CareGap records from external clinical rules engines, displaying CDS alerts in care coordinator UIs, and using the Business Rules Engine for custom protocol evaluation. This skill covers the implementation of CDS storage and display patterns. It does NOT cover standard Flow automation for non-clinical use cases, or the design of clinical rules logic outside of Salesforce (external clinical rules engines).

---

## Before Starting

Gather this context before working on anything in this domain:

- Understand that `ClinicalAlert` (API v51.0+) and `CareGap` (API v59.0+) are **passive data-model objects** — they are storage records for alerts and gaps, not active rules engines. Salesforce does NOT automatically evaluate clinical logic and create these records. They must be created via Apex, Flow DML, FHIR R4 API ingestion, or external system integration.
- For CareGap records specifically: they **cannot be created manually** by end users. They must be generated by an external clinical rules engine (payer quality analytics, HL7 CDS Hooks service) and ingested via FHIR R4 API or Apex. Any design that requires end-user CareGap creation must be redesigned.
- Confirm whether the Business Rules Engine (BRE) add-on is licensed. BRE is required for implementing declarative Salesforce-native clinical protocol evaluation rules. Without BRE, custom protocol checks must be implemented in Apex.
- Identify how CDS alerts will be displayed: Health Cloud FlexCards (OmniStudio-based), custom LWC, or the built-in ClinicalAlert list view in the care coordinator console.

---

## Core Concepts

### ClinicalAlert and CareGap Are Passive Storage Objects

This is the most critical concept for clinical decision support in Health Cloud:

**ClinicalAlert (API v51.0+):**
- A platform-standard object for storing clinical alerts (protocol deviations, care reminders, drug interactions).
- Has NO built-in rules evaluation engine.
- Records are created by: Apex triggers on clinical data changes, Record-Triggered Flows with DML on ClinicalAlert, or FHIR R4 API ingestion from external systems.
- Fields: `AlertType`, `AlertSeverity`, `PatientId`, `AlertMessage`, `Status`.

**CareGap (API v59.0+):**
- A platform-standard object for storing preventive care quality gaps.
- Has NO built-in rules evaluation engine.
- Records **cannot be created manually** — must be ingested from external clinical rules engines.
- Typically ingested via FHIR R4 API from payer quality analytics systems.

Salesforce does not ship a self-contained clinical protocol evaluation engine. The platform provides storage objects and display UI; clinical rules must come from an external system or be implemented in Apex/Flow.

### Business Rules Engine for Custom Protocol Logic

The Business Rules Engine (BRE) is an optional paid add-on that provides declarative rule evaluation within Salesforce. For clinical decision support use cases, BRE can:
- Evaluate patient record conditions against configured rules (e.g., "if patient has Type 2 Diabetes AND last A1c was > 6 months ago → create ClinicalAlert")
- Trigger alert creation when rules fire
- Support complex condition combinations without Apex code

Without BRE, equivalent logic must be implemented in Apex triggers or Flow decision chains.

### CDS Hooks Integration Pattern

CDS Hooks is the mechanism for integrating Salesforce clinical data into EHR clinical workflows as decision support alerts. The integration flow:
1. EHR clinician opens patient chart → EHR sends CDS Hook POST to MuleSoft endpoint.
2. MuleSoft queries Salesforce ClinicalAlert and CareGap records for the patient.
3. MuleSoft formats CDS card responses with alert summaries and action links.
4. EHR displays CDS cards in the clinical workflow.

There is no native Salesforce CDS Hook service. MuleSoft is required as the intermediary.

---

## Common Patterns

### Creating ClinicalAlert from a Clinical Data Trigger

**When to use:** When a clinical data change (new lab result, updated condition, medication interaction) should create an alert for the care coordinator.

**How it works:**
1. Create an Apex trigger on `CareObservation` (for lab results) or `HealthCondition` (for conditions) with `after insert, after update`.
2. In the trigger, evaluate the clinical logic (e.g., A1c observation value > threshold).
3. If the condition is met, create a `ClinicalAlert` record:
   ```apex
   ClinicalAlert alert = new ClinicalAlert(
       PatientId = observation.PatientId,
       AlertType = 'LabResult',
       AlertSeverity = 'High',
       AlertMessage = 'A1c result ' + observation.Value + ' exceeds threshold — care coordinator review required.',
       Status = 'Active'
   );
   insert alert;
   ```
4. The ClinicalAlert record appears in the care coordinator's alert view.

**Why not the alternative:** Using custom notification objects or Activity/Task for clinical alerts bypasses the standard Health Cloud ClinicalAlert display components in the care coordinator console.

### CareGap Ingestion from External Rules Engine

**When to use:** A payer's quality analytics system generates quality measure gaps that need to appear in Salesforce for care coordinator outreach.

**How it works:**
1. Payer quality system generates FHIR R4 Measure Report or CareGap resources.
2. MuleSoft (or custom integration) receives the gap data on a scheduled basis.
3. MuleSoft maps the FHIR CareGap resource to the Salesforce CareGap object fields.
4. MuleSoft calls the Salesforce FHIR Healthcare API or SObject API (with HealthCloudICM credentials) to create CareGap records.
5. Care coordinators see open CareGap records in their patient views.
6. Care coordinators acknowledge gaps and create outreach Tasks linked to CareGap records.

**Why not the alternative:** CareGap records cannot be created manually. An integration with the quality analytics system is required.

---

## Decision Guidance

| Situation | Pattern | Note |
|---|---|---|
| Create alert from lab result change | Apex trigger → ClinicalAlert insert | Direct platform DML |
| Populate quality measure gaps | External rules engine → FHIR API → CareGap | Cannot create manually |
| Complex protocol evaluation rules | Business Rules Engine (if licensed) | Otherwise: Apex logic |
| Display alerts in EHR workflow | MuleSoft CDS Hooks integration | No native SF CDS endpoint |
| Display alerts in Salesforce UI | FlexCard on ClinicalAlert or custom LWC | Standard console integration |

---

## Recommended Workflow

1. **Confirm clinical alert source** — identify which clinical events or external systems will generate ClinicalAlert or CareGap records. For ClinicalAlert: Apex/Flow on clinical data change events. For CareGap: external clinical rules engine via integration.
2. **Design alert creation mechanism** — for ClinicalAlert: define the trigger event (clinical object change), the clinical logic condition (threshold, rule), and the alert record fields. For CareGap: design the ingestion pipeline from the external rules engine.
3. **Implement ClinicalAlert creation** — build the Apex trigger or Record-Triggered Flow that creates ClinicalAlert records when the clinical condition is met. Ensure bulkification in Apex triggers.
4. **Design CareGap ingestion** — if CareGap records are needed, design the MuleSoft (or equivalent) integration pipeline from the external quality analytics system. Define ingestion schedule, field mapping, and deduplication logic.
5. **Configure alert display** — configure the care coordinator console to display ClinicalAlert records (via built-in components or FlexCards). Define the alert acknowledgment workflow.
6. **Test with representative clinical data** — test ClinicalAlert creation with clinical data records that trigger the alert conditions. Verify CareGap records appear from the integration. Test the alert display and acknowledgment workflow.

---

## Review Checklist

- [ ] ClinicalAlert creation mechanism is Apex/Flow/FHIR API (not manual entry)
- [ ] CareGap records are ingested from external rules engine (not manually created)
- [ ] Business Rules Engine licensed (if declarative rule evaluation is needed)
- [ ] Apex triggers for ClinicalAlert creation are bulkified
- [ ] HealthCloudICM permission set assigned to all API users creating clinical alert records
- [ ] CDS Hooks architecture (if needed) uses MuleSoft as the service endpoint

---

## Salesforce-Specific Gotchas

1. **Health Cloud has no native clinical rules evaluation engine** — ClinicalAlert and CareGap are storage objects only. Salesforce does not automatically evaluate clinical logic. Alert creation requires Apex, Flow, or external system integration. Assuming clinical alerts auto-generate from clinical data changes is the #1 implementation design error.

2. **CareGap records cannot be created manually or via standard DML** — CareGap records are system-generated via FHIR API ingest or external clinical rules engines. Standard Flow "Create Records" on CareGap or direct Apex DML inserts will fail or produce unauthorized records that do not participate in the quality measure lifecycle correctly.

3. **Apex triggers on clinical objects must be bulkified** — Clinical data bulk loads (e.g., during patient data migration or daily EHR sync) can produce large volumes of clinical object records in a single transaction. Apex triggers on CareObservation, HealthCondition, etc. must implement proper bulkification to avoid hitting trigger CPU time limits during bulk operations.

---

## Output Artifacts

| Artifact | Description |
|---|---|
| ClinicalAlert creation trigger | Apex trigger on clinical objects that creates ClinicalAlert records based on threshold logic |
| CareGap ingestion design | Pipeline architecture from external quality system to Salesforce CareGap records |
| Alert display configuration | FlexCard or LWC configuration showing ClinicalAlert/CareGap on patient console |
| BRE rule definitions | Business Rules Engine rule configuration for declarative protocol evaluation |

---

## Related Skills

- admin/care-coordination-requirements — ICM object design including CareGap constraints
- apex/health-cloud-apis — FHIR Healthcare API usage for CareGap ingestion
- apex/fhir-integration-patterns — FHIR integration patterns for clinical data ingestion

Related Skills

omnistudio-vs-flow-decision

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when choosing between OmniStudio (OmniScript / Integration Procedure / FlexCard / DataRaptor) and Flow / Screen Flow / Apex for a given capability. Triggers: 'omnistudio or flow', 'omniscript vs screen flow', 'integration procedure vs subflow', 'flexcard vs lightning page'. NOT for general automation selection across Workflow/Process Builder/Apex (see automation-selection tree).

lwc-shadow-vs-light-dom-decision

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when deciding whether a Lightning Web Component should keep the default Shadow DOM or opt into Light DOM via `static renderMode = 'light'`. Covers CSS scoping, third-party CSS-framework compatibility, accessibility implications, Experience Cloud LWR vs internal-app constraints, performance differences, and event composition. NOT a generic Light DOM how-to (see lwc/lwc-light-dom). NOT a CSS styling reference (see lwc/lwc-styling-and-slds). NOT for managed-package distribution rules — that is a hard constraint and Light DOM is forbidden there.

flow-decision-element-patterns

8
from PranavNagrecha/AwesomeSalesforceSkills

Structure Decision elements in Flow: default outcome placement, outcome ordering, compound criteria, null-safe checks, Boolean vs Pick-list comparisons, and avoiding deep nested branching. Trigger keywords: decision element, flow branching, default outcome, condition logic, formula in decision. Does NOT cover loop or fault path design, or Screen Flow navigation.

clinical-data-quality

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill when configuring duplicate detection for Health Cloud patient records, managing Person Account merges in a clinical org, or designing pre-merge clinical record reassignment strategies. Trigger keywords: patient deduplication, MPI, duplicate patients, merge person accounts Health Cloud, clinical record orphan, EpisodeOfCare orphan, PatientMedication orphan. NOT for generic Salesforce data quality or standard deduplication outside Health Cloud.

omnistudio-vs-standard-decision

8
from PranavNagrecha/AwesomeSalesforceSkills

Decision framework for choosing OmniStudio (OmniScript, FlexCards, Integration Procedures) vs standard Salesforce tooling (Screen Flow, LWC, Apex) for guided UI and data transformation use cases: capability matrix, license availability gate, team skills assessment, and migration path from managed package to Standard Designers. NOT for OmniStudio implementation or configuration.

npsp-vs-nonprofit-cloud-decision

8
from PranavNagrecha/AwesomeSalesforceSkills

Use this skill when an organization must decide whether to stay on NPSP (Nonprofit Success Pack) or move to Nonprofit Cloud (NPC), evaluate the timeline for that move, and understand what the migration entails at an architectural level. Trigger keywords: NPSP vs Nonprofit Cloud, upgrade NPSP, migrate to NPC, nonprofit platform decision, NPSP end of life, Nonprofit Cloud vs NPSP comparison. NOT for implementation — does not cover post-decision NPC build, NPSP customization, or data migration execution.

data-cloud-vs-analytics-decision

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when choosing or explaining how Salesforce Data Cloud (Data 360) and CRM Analytics (Tableau CRM / Einstein Analytics) fit together versus overlap — unified data platform vs analytics consumption, Direct Data on Data Model Objects (DMOs), identity and activation vs dashboards and recipes. Triggers: 'Data Cloud vs CRM Analytics', 'when to use Data Cloud versus Einstein Analytics', 'should we buy Data Cloud or CRM Analytics', 'CRM Analytics on Data Cloud DMOs', 'direct data connector Data Cloud', 'analytics on unified profile architecture'. NOT for step-by-step implementation of Data Cloud data streams, identity resolution rules, CRM Analytics recipes, dataflows, or dashboard build — use architect/data-cloud-architecture, admin/data-cloud-identity-resolution, or admin/einstein-analytics-basics for that.

crm-analytics-vs-tableau-decision

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when deciding between CRM Analytics (formerly Einstein Analytics / Tableau CRM) and Tableau Desktop, Tableau Server, or Tableau Cloud for a Salesforce-centric analytics requirement. Triggers: 'CRM Analytics vs Tableau', 'which BI tool for Salesforce', 'Tableau for Salesforce data', 'Einstein Analytics vs Tableau', 'analytics platform decision', 'licensing comparison CRM Analytics Tableau', 'Tableau Next', 'Tableau+ for Salesforce'. NOT for implementation guidance on configuring CRM Analytics datasets, recipes, or Tableau workbooks — use admin/einstein-analytics-basics for that.

cpq-vs-standard-products-decision

8
from PranavNagrecha/AwesomeSalesforceSkills

Use when deciding whether to implement Salesforce CPQ or stay with standard Products and Pricebooks for quoting and pricing. Triggers: 'should we buy CPQ or use standard pricebooks', 'is CPQ worth the cost for our quoting process', 'product bundling without CPQ', 'guided selling vs manual product selection', 'complex pricing rules or multi-dimensional discounting'. NOT for CPQ implementation details, NOT for CPQ package installation or configuration, NOT for Revenue Cloud Advanced.

architecture-decision-records

8
from PranavNagrecha/AwesomeSalesforceSkills

Author and maintain Architecture Decision Records (ADRs) for Salesforce implementations: capture chosen approach, rejected alternatives, constraints, and consequences. Trigger keywords: adr, architecture decision record, design decision log, technical decision. Does NOT cover project roadmap planning, release notes, or RFC workflow for features.

apex-with-without-sharing-decision

8
from PranavNagrecha/AwesomeSalesforceSkills

Choosing the correct sharing keyword on an Apex class: with sharing vs without sharing vs inherited sharing, how the choice flows through called methods, and when WITH USER_MODE overrides class-level behavior. NOT for org-level sharing design (use standards/decision-trees/sharing-selection.md). NOT for FLS / CRUD enforcement (use apex-fls-crud-enforcement). NOT for Apex Managed Sharing (use apex-managed-sharing).

salesforce-support-escalation

8
from PranavNagrecha/AwesomeSalesforceSkills

Guide practitioners through opening, classifying, and escalating support cases with Salesforce Technical Support via the Help portal, including choosing the correct severity level, engaging Premier Success resources, using the Escalate to Technical Support Management path, and tracking incidents on the Trust site. NOT for configuring Salesforce Case Escalation Rules (declarative platform automation), Entitlement Management or SLA milestones, or building customer-facing support processes inside an org.