/sf-industries:industries-patient-card-generatefrom sf-industries
Builds a Health Cloud Patient Card Lightning Web Component with Provider and Payer personas, member plan selector, allergy/communication pills, info row, and six expandable summary tiles using UI API GraphQL wire adapter and Jest tests.
Ships in sf-industries. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Notice: Intended Use
This tool is intended to provide capabilities for Customers to configure and optimize use of their implemented Salesforce Services. Customers should ensure that their use of this tool meets their own use case needs and compliance requirements (including any applicable healthcare and privacy laws, rules, and regulation).
This document fully specifies a Patient Card Lightning Web Component for a Health Cloud org. It is written so that an AI coding assistant (or a developer) can build, test and deploy the component from scratch in a Salesforce DX project, using only public platform features.
For the AI assistant: build everything in the Deliverables section and follow every rule in this document. Where this document doesn't decide something, choose the simplest option that fits the existing rules. When you finish, check your work against the Acceptance tests section.
The Patient Card summarizes one patient on a single card. It has two personas, which an admin picks when placing the card:
From top to bottom, the card shows:
| # | Provider persona | Payer persona |
|---|---|---|
| 1 | Care Gaps | Coordination of Benefits |
| 2 | Primary Care | Pending Prior Auths |
| 3 | Next Appointment | Deductible |
| 4 | Recent Encounter | Out of Pocket Max |
| 5 | Allergies | Care Gaps |
| 6 | Preferred Pharmacy | Primary Care |
Build these in a Salesforce DX project, under force-app/main/default/:
Lightning Web Components in the default c namespace:
Pick clear camelCase names, for example patientCard, patientCardHeader and so on. Only the root component is exposed.
Custom labels for every user-facing string (section 9), in labels/CustomLabels.labels-meta.xml.
Jest tests for every component and the utilities, using @salesforce/sfdx-lwc-jest (section 12, references/acceptance-tests.md).
No Apex. All data comes from the UI API GraphQL wire adapter (lightning/graphql).
API version 65.0 or later: set sourceApiVersion in sfdx-project.json and apiVersion in every component's .js-meta.xml. Earlier versions don't support lightning/graphql or some of the query syntax used here.
.forceignore at the project root, listing **/__tests__/**, **/jsconfig.json and **/.eslintrc.json. Without it, the deploy uploads the Jest tests and fails with LWC1702: Invalid LWC imported identifier "createElement".
Project tooling: package.json with dev dependencies @salesforce/sfdx-lwc-jest, @salesforce/wire-service-jest-util and @sa11y/jest, and a test script that runs sfdx-lwc-jest.
@wire(graphql, { query: gql\...`, variables: '$someGetter' })`.
variables returns undefined, its wire doesn't run. Use this to skip queries that the current persona doesn't need, or that are missing an input such as a selected plan.undefined, the wire does not emit again, so the old data stays in component state. Whenever the input that drives a wire changes (the patient or the selected plan), reset the related state in the @api setter. The previous patient's or plan's data must never show while the new data loads.{ data, errors }. Treat a response with no data as "no records" and show the empty state. Read records through one helper that returns data?.uiapi?.query?.<Object>?.edges?.map(e => e.node) || [].displayValue, falling back to value.--slds-g-*). The org's theme sets those hooks, and SLDS 1 and SLDS 2 (Cosmos) orgs give them different values, so the same CSS can look completely different (for example, a light tint can become solid brand blue). Section 10 lists every value.padding-inline, border-inline-start, text-align: start) so the card also works right-to-left.Intl using @salesforce/i18n/locale and @salesforce/i18n/currency.{0}, {1}, … and are filled by a small formatLabel(label, ...args) helper.lightning__RecordPage, restricted to the Account object, with form factors Large and Small.lightningCommunity__Page and lightningCommunity__Default (Experience Cloud).persona property: String, datasource Provider,Payer, default Provider. Available on the record page and on Experience Cloud.patientId property: String, Experience Cloud only. The site sets it, for example to {!recordId}.lightning__RecordPage targetConfig holds objects (Account), supportedFormFactors and persona.lightningCommunity__Default targetConfig holds persona and patientId.roleText, not role, for the header role, and heading, not title, for the tile title. Otherwise the browser applies them to the host element (an ARIA role, or a tooltip).masterLabel ("Patient Card") and a description.patientId when one is set, otherwise the record page's recordId. Implement both as @api setter/getter pairs, so a change to either one re-resolves the patient.Payer is treated as Provider.The patient is a person account. The table lists the objects, fields and relationships the card reads; all of them are standard Health Cloud or platform objects.
| Area | Object | Filter | Fields |
|---|---|---|---|
| Header | Account | Id = patient | Name, PersonBirthdate, Phone, PersonMobilePhone, PersonEmail, PersonMailingStreet/City/State/PostalCode, BillingStreet/City/State/PostalCode |
| Pills: Individual | Account | Id = patient | PersonIndividualId, Phone, PersonMobilePhone |
| Pills: allergies | AllergyIntolerance | PatientId = patient, Status = "Active" and VerificationStatus not in ("Refuted", "Entered in error"), first 20 | Code.Name, Severity |
| Pills: best time | ContactPointPhone | ParentId = patient and BestTimeToContactStartTime != null, ordered by IsPrimary DESC, first 20 | TelephoneNumber, BestTimeToContactStartTime, BestTimeToContactEndTime, BestTimeToContactTimezone |
| Pills: consents | ContactPointTypeConsent | PartyId = patient's PersonIndividualId, first 20 | EngagementChannelType.Name, PrivacyConsentStatus |
| Member plans | MemberPlan | MemberId = patient, ordered by PriorityOrder ASC (nulls last) then EffectiveFrom DESC, first 50 | Name, Status, GroupNumber, SubscriberId, PlanId, PrimarySecondaryTertiary, PriorityOrder, RelationshipToSubscriber, PrimaryCarePhysician, EffectiveFrom, EffectiveTo, Payer.Name |
| MRN | Identifier | ParentRecordId = patient, ordered by EffectiveDate DESC (nulls last), first 50 | IdValue, EndDate, IdType (a CodeSet; read its Code with an inline fragment ... on CodeSet { Code { value } }) |
| Language | PersonLanguage | IndividualId = patient, ordered by Rank ASC (nulls last), first 1 | Language |
| Members | MemberPlan | SubscriberId = selected plan's subscriber, first 200 | Name, MemberId, PlanId |
| Care Gaps | CareGap | AccountId = patient and Status = "Open", first 200 | Name |
| Care relations (Provider) | AccountContactRelation | Contact.AccountId = patient, first 200 | Roles, Account.Name |
| Next Appointment (Provider) | ServiceAppointment | AccountId = patient, SchedStartTime >= now and StatusCategory not in ("Canceled", "CannotComplete"), ordered by SchedStartTime ASC, first 1 | SchedStartTime, AppointmentType, Status |
| Recent Encounter (Provider) | ClinicalEncounter | PatientId = patient, ordered by StartDate DESC, first 1 | StartDate, Status, DischargeDisposition.Name |
| Allergies tile (Provider) | AllergyIntolerance | PatientId = patient, Status = "Active" and VerificationStatus not in ("Refuted", "Entered in error"), first 20 | Code.Name |
| Prior auths (Payer) | CareRequest, CareRequestItem | see section 7.4 in references/values-and-rules.md | |
| Benefits (Payer) | CoverageBenefit | MemberPlanId = selected plan and IsActive = true, first 1 | IndividualInNetworkDeductibleApplied/Limit, FamilyInNetworkDeductibleApplied/Limit, IndividualInNetworkOutofPocketApplied/Limit, PrimaryCareCopay |
GraphQL notes:
DateTime variable, computed in JavaScript as new Date().toISOString(), and filter with {SchedStartTime: {gte: {value: $now}}}. Don't use a TODAY literal: it would match appointments that already happened earlier today.gql query (filter values, ApiName, nin lists, variable defaults) must be written as "...", for example {Code: {eq: "MR"}}, {Status: {nin: ["Canceled", "Approved"]}} and $patientId: ID = "". A single ' anywhere in a query makes Lightning App Builder fail to load every component on the page, with Syntax Error: Unexpected single quote character (') from loadComponentDefinitions. The same applies to customer-supplied values pasted into a query.
${...}, interpolate only numbers (such as first: limits) or strings built with JSON.stringify(value), which always produces double quotes. For a list: STATUSES.map((s) => JSON.stringify(s)).join(", "). Never interpolate a raw string or wrap one in '...'.$patientId: ID = "".PersonLanguage.IndividualId is a polymorphic lookup (Account, Contact or Individual), so filter it directly with the patient's account ID. Don't look up the Individual first.Id on every node; use it as the record key (for example the plan object's id).where: {and: [{...}, {...}]}. A "not null" filter is {Field: {ne: null}}.Name { value } or PersonBirthdate { value displayValue }; ask for displayValue wherever you display it. Parent lookups nest: Payer { Name { value } }.where: {Contact: {AccountId: {eq: $patientId}}}.orderBy: {PriorityOrder: {order: ASC, nulls: LAST}, EffectiveFrom: {order: DESC}}.YYYY-MM-DD. Parse the parts yourself; don't pass the string to new Date(), which can shift the day.BestTimeToContactStartTime/EndTime): a wall-clock time like 14:00:00.000Z. Read the hours and minutes from the string, and build new Date(Date.UTC(1970, 0, 1, h, m)) to format it.displayValue for display.BestTimeToContactTimezone): an IANA zone ID such as America/Los_Angeles.CareRequestItems(where: ..., orderBy: ..., first: 1) { edges { node { StatusReason { value } } } } inside the CareRequest node.inq and ninq with ApiName naming the child's lookup field to the parent, exactly as written in section 7.4.Read references/component-behavior.md for how every part of the card behaves: root card, header, member plan section, patient pills, plan details and tiles. Build all of it.
Read references/values-and-rules.md for the exact values and rules: the info row (including MRN), shared tiles (Care Gaps, Primary Care), Provider tiles, and Payer tiles (including the pending prior authorization count and subtitle).
Put these in the shared utilities module and unit-test each one:
formatLabel(label, ...args): replaces {n} placeholders; null or undefined arguments leave the placeholder.joinParts(...parts): joins the non-empty parts with ·.formatCurrency(amount): user currency with no decimals, e.g. "$1,500". Returns undefined for null, undefined or NaN.formatDate(isoDate): medium date in UTC, as described in 6.2 of references/component-behavior.md.ageFromBirthdate(isoDate, today): whole years, as described in 6.2 of references/component-behavior.md.formatTimeRange(start, end) and timeZoneAbbreviation(zone): as described in 6.4 of references/component-behavior.md.isSamePhoneNumber(a, b): the number match described in 6.4.patientPhone(account): mobile, otherwise phone.memberRoleLabel(relationship): "Subscriber" for Self, "Dependent" for any other non-empty value, otherwise undefined.Read references/custom-labels.md for the full list of custom labels (names and default text). Create every label in it in the project's CustomLabels.labels-meta.xml, and use only these labels for user-visible text.
Read references/visual-design.md for all styling: card, header, member plan section, pills, info row, toggle and tile grid, tiles, and general rules, with exact SLDS token names and values. Use only the token values listed there.
<article> for the card and tiles, <h2> for the name, <h3> for tile titles, and <dl> for the info row and contact details.<button type="button"> with an accessible name, and every button has a visible :focus-visible outline.references/component-behavior.md): aria-expanded, aria-controls, aria-current on the selected option, Escape support, and focus returned to the toggle.@sa11y/jest toBeAccessible()) in its Jest tests.Read references/acceptance-tests.md for the acceptance tests to check your work against, and write Jest tests that cover every case in it.
force-app source directory to the target org using your normal Salesforce DX deployment workflow.{!recordId}) and persona, then publish.AccountContactRelation doesn't exist. The provider Primary Care and Preferred Pharmacy tiles then stay empty, because their query fails with Field 'AccountContactRelation' in type 'RecordQuery' is undefined; the rest of the card still works.Primary Care Physician and Preferred Pharmacy values to the AccountContactRelation.Roles picklist, or change the two role constants to roles you already use.Syntax Error: Unexpected single quote character (') ... loadComponentDefinitions when you open Edit Page. A gql query contains a single-quoted string. Search the component's .js files for ' between gql` and the closing backtick, change those strings to double quotes (see the GraphQL notes in section 5), run test 27, and deploy again.first:) should each be defined once as a named constant or query argument, so they're easy to change. To exclude prior-auth items with a blank status, add {Status: {ne: null}} next to each status filter.PatientCard_* labels.What SKILL.md sets; muted values are Claude Code's defaults
3 plugins ship this exact skill · first indexed Nov 24, 2026
npx claudepluginhub cloudzlab/sf-team-skills --plugin sf-industriesOther plugins' skills for the same job