Install
openclaw skills install clinical-doc-assistantUse this skill when a clinician, practice manager, or healthcare developer needs to draft, structure, or retrieve clinical documentation — including SOAP notes, referral letters, prior authorization forms, discharge summaries, and care plan narratives. Connects to FHIR R4-compliant APIs (Epic, Cerner, Azure Health Data Services, HAPI FHIR) to pull structured patient data and generate documentation drafts. Also supports manual input when no EHR connection is available. DO NOT use for direct diagnosis, prescribing decisions, or any task requiring a licensed clinical judgment — this skill assists with documentation only.
openclaw skills install clinical-doc-assistantThis skill enables an OpenClaw agent to connect to any FHIR R4-compliant EHR, retrieve structured patient data, and generate high-quality clinical documentation drafts. It covers the most time-consuming document types in outpatient and inpatient settings.
Supported document types:
Supported FHIR backends:
⚠️ Clinical Disclaimer: All output is a documentation draft intended to be reviewed, edited, and signed by a licensed clinician. This skill does not provide clinical advice, diagnoses, or prescriptions.
🔒 Privacy / PHI Warning: FHIR data is fetched into the agent's context for the session only and is not written to disk by this skill. If you use the hosted backend (
CLINICAL_DOC_API_URL), patient context is transmitted to that server — only use a backend you control in a HIPAA-eligible environment. Do not use a third-party hosted backend with real patient data unless a BAA is in place. For development and testing, always useFHIR_SANDBOX_MODE=truewith synthetic data only.
Set FHIR_SANDBOX_MODE=true to use the public HAPI R4 sandbox. No credentials required. Ideal for testing and development.
export FHIR_SANDBOX_MODE=true
Then ask your agent:
"Pull patient John Smith from the FHIR sandbox and draft a SOAP note for today's hypertension follow-up."
This skill uses SMART on FHIR (OAuth2) for EHR connections. Set up once per environment.
Each EHR has its own developer portal:
export FHIR_BASE_URL="https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4"
export FHIR_CLIENT_ID="your-client-id"
export FHIR_CLIENT_SECRET="your-client-secret"
export FHIR_TOKEN_URL="https://fhir.epic.com/interconnect-fhir-oauth/oauth2/token"
Ask the agent:
"Check my FHIR connection status."
The agent will attempt a token fetch and a GET /metadata call, then report back.
The agent fetches only the resources needed for the requested document. All calls are read-only GET requests.
"Find patient [name] born [DOB]"
"Look up patient MRN 1234567"
"Search for patients with last name Rodriguez"
Internally calls:
GET /Patient?name=Rodriguez&birthdate=1975-04-12
GET /Patient/[id]
"What are the active conditions for this patient?"
Calls:
GET /Condition?patient=[id]&clinical-status=active
"Pull current medications for patient [id]"
Calls:
GET /MedicationRequest?patient=[id]&status=active
"Get the last set of vitals for this patient"
Calls:
GET /Observation?patient=[id]&category=vital-signs&_sort=-date&_count=10
"Pull recent labs — focus on HbA1c and BMP"
Calls:
GET /Observation?patient=[id]&category=laboratory&_sort=-date&_count=20
"Show encounters from the last 6 months"
Calls:
GET /Encounter?patient=[id]&date=ge2025-09-01&_sort=-date
Once patient data is retrieved, ask the agent to generate any document type.
Trigger phrases:
What the agent does:
Example output structure:
SUBJECTIVE:
Patient is a 58-year-old male presenting for routine diabetes follow-up.
Reports improved energy since medication adjustment. No hypoglycemic episodes.
Denies chest pain, shortness of breath, or lower extremity edema.
OBJECTIVE:
Vitals (2026-03-15): BP 132/78, HR 72, Wt 198 lbs, BMI 29.4
HbA1c (2026-02-10): 7.2% (↓ from 7.9% in November)
Current Meds: Metformin 1000mg BID, Lisinopril 10mg daily
ASSESSMENT:
1. Type 2 Diabetes Mellitus — improving, at goal
2. Hypertension — controlled
PLAN:
1. Continue current regimen
2. Repeat HbA1c in 3 months
3. Annual ophthalmology referral ordered
4. Follow up in 3 months or sooner if concerns
Trigger phrases:
What the agent does:
Example:
[Date]
Re: [Patient Name], DOB [Date], MRN [Number]
Dear Dr. [Specialist],
I am referring the above-named patient for cardiology evaluation.
[Patient] is a 64-year-old female with a history of hypertension and
hyperlipidemia presenting with exertional dyspnea over the past 6 weeks.
Recent ECG showed non-specific ST changes. Echo has not been performed.
Current medications: Amlodipine 5mg, Atorvastatin 40mg, ASA 81mg.
I would appreciate your evaluation and recommendations.
Sincerely,
[Referring Provider]
Trigger phrases:
What the agent does:
Key fields generated:
Trigger phrases:
What the agent does:
Trigger phrases:
What the agent does:
If no EHR is connected, the agent will prompt you to provide patient data manually. Useful for small practices, telehealth, or demos.
Ask: "Draft a SOAP note — I'll provide the patient data manually."
The agent will ask for:
For high-volume use or team deployments, a managed API backend handles generation, audit logging, and HIPAA-aligned data handling.
Set these variables to enable:
export CLINICAL_DOC_API_URL="https://api.yourdomain.com/v1"
export CLINICAL_DOC_API_KEY="your-api-key"
When set, document generation routes through the hosted backend instead of the local LLM. Credits are deducted per document generated. Visit [your site] to purchase credits and manage your account.
Hosted backend advantages:
FHIR_SANDBOX_MODE=true with synthetic data only.🔒 Before using with real patient data, ensure your deployment satisfies your organization's HIPAA security requirements and that a Business Associate Agreement (BAA) is in place with any third-party service.
"FHIR connection failed: 401 Unauthorized"
FHIR_CLIENT_SECRET is current."Patient not found"
Patient.read and Patient.search scopes granted."Missing vitals / labs in output"
"SMART on FHIR scopes error"
patient/Patient.read patient/Condition.read patient/MedicationRequest.read patient/Observation.read patient/Encounter.readSandbox mode not working
https://hapi.fhir.org/baseR4FHIR_SANDBOX_MODE=true is set and FHIR_BASE_URL is unset or points to the sandbox.User: "Pull patient Jane Doe, DOB 1968-03-22, from the FHIR server."
Agent: [Fetches Patient, Condition, MedicationRequest, Observation]
"Found Jane Doe (MRN 7823991). Active conditions: HTN, T2DM, CKD stage 2.
Current meds: Lisinopril, Metformin, Amlodipine. Last vitals: 3 weeks ago."
User: "She's here for a diabetes follow-up. Chief complaint: fatigue, better than last visit.
Draft a SOAP note."
Agent: [Generates full SOAP note with populated O section from FHIR data]
"Here is the draft SOAP note. Vitals from today's visit are missing —
please add them before signing."
User: "Generate a prior auth for Ozempic for this patient — payer is Aetna."
Agent: [Pulls active conditions, labs (HbA1c), current meds]
"Draft PA narrative ready. Diagnosis: T2DM (E11.9). Supporting:
HbA1c 8.4% (2026-02-01), inadequate response to Metformin 2000mg.
Do you want to add any additional clinical notes before I finalize?"
| Version | Date | Changes |
|---|---|---|
| 1.0.4 | 2026-03-29 | Fixed misleading ANTHROPIC_API_KEY comment; clarified patient_context is forwarded to Anthropic when backend is used; added CORS production warning. |
| 1.0.3 | 2026-03-29 | Fixed env var declarations (moved optional vars out of requiredEnv); added ANTHROPIC_API_KEY to optionalEnv with context; added PHI/privacy warning. |
| 1.0.0 | 2026-03-29 | Initial release. SOAP, referral, prior auth, discharge, AVS. SMART on FHIR auth. Sandbox mode. |
Questions or issues? Open a GitHub issue or reach out via the OpenClaw Discord.