referral-generator — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited referral-generator (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Generate a complete specialist referral as a FHIR ServiceRequest resource. Automatically populate the referral with relevant clinical context: active conditions as the reason for referral, pertinent lab results, current medications, and imaging findings. Flag conditions commonly requiring prior authorization. Format the clinical question for the specialist based on referral indication.
| Resource | Purpose | Key Fields |
|---|---|---|
| ServiceRequest | The referral itself | status, intent, code, reasonReference, supportingInfo, note |
| Condition | Reason for referral | code, clinicalStatus, onsetDateTime |
| Observation | Supporting lab/vital data | code, valueQuantity, effectiveDateTime, interpretation |
| DiagnosticReport | Imaging and pathology findings | code, conclusion, presentedForm |
| MedicationRequest | Current medications relevant to specialty | medicationCodeableConcept, dosageInstruction, status |
| MedicationStatement | Patient-reported medications | medicationCodeableConcept, status |
| Patient | Demographics and insurance | name, birthDate, gender, identifier |
| Coverage | Insurance for prior auth determination | type, payor, class |
| Procedure | Prior relevant procedures | code, performedDateTime, status |
Confirm patient identity:
Tool: fhir_read
resourceType: "Patient"
id: "[patient-id]"Extract: name, DOB, gender, MRN (from identifier where type.coding.code = "MR").
Tool: fhir_search
resourceType: "Condition"
queryParams: "patient=[patient-id]&clinical-status=active"Identify the primary reason for referral from the user's request. Match it to an active Condition. If no matching Condition exists, the referral can still proceed but note that the referring diagnosis should be documented.
Based on the target specialty, search for pertinent labs. Use specialty-specific LOINC codes from references/referral-indications.md.
Tool: fhir_search
resourceType: "Observation"
queryParams: "patient=[patient-id]&category=laboratory&code=[relevant-loinc-codes]&_sort=-date&_count=5"Common specialty-relevant labs:
Tool: fhir_search
resourceType: "MedicationRequest"
queryParams: "patient=[patient-id]&status=active&_sort=-date"Filter medications relevant to the referral specialty. Include all medications if the specialist needs a complete picture (e.g., oncology, rheumatology).
Tool: fhir_search
resourceType: "DiagnosticReport"
queryParams: "patient=[patient-id]&category=http://terminology.hl7.org/CodeSystem/v2-0074|RAD&_sort=-date&_count=5"Also check for prior procedures relevant to the specialty:
Tool: fhir_search
resourceType: "Procedure"
queryParams: "patient=[patient-id]&code=[relevant-procedure-codes]&_sort=-date&_count=5"Tool: fhir_search
resourceType: "Coverage"
queryParams: "patient=[patient-id]&status=active"Cross-reference the referral type against common prior authorization triggers (see references/referral-requirements.md). Flag if prior auth is likely required:
Based on the referral indication, generate a specific clinical question for the specialist. Avoid vague referrals like "please evaluate."
Structure: "[Clinical context]. [Specific question]. [What has been tried]."
Examples:
Tool: fhir_create
resourceType: "ServiceRequest"
resource: {
"resourceType": "ServiceRequest",
"status": "active",
"intent": "order",
"category": [{ "coding": [{ "system": "http://snomed.info/sct", "code": "3457005", "display": "Patient referral" }] }],
"priority": "[routine|urgent|asap|stat]",
"code": { "coding": [{ "system": "http://snomed.info/sct", "code": "[specialty-code]", "display": "[Specialty] referral" }] },
"subject": { "reference": "Patient/[patient-id]" },
"authoredOn": "[today-ISO-8601]",
"reasonReference": [{ "reference": "Condition/[condition-id]" }],
"supportingInfo": [
{ "reference": "Observation/[lab-id-1]" },
{ "reference": "Observation/[lab-id-2]" },
{ "reference": "DiagnosticReport/[imaging-id]" }
],
"note": [
{ "text": "[Clinical question formulated in Step 7]" },
{ "text": "Current medications: [relevant medication list]" },
{ "text": "Prior authorization: [Required/Not required/Unknown - check with payer]" }
]
}SNOMED codes for common specialties:
REFERRAL SUMMARY
================
Patient: [name] | DOB: [dob] | MRN: [mrn]
Insurance: [payor] - [plan type]
Referral To: [Specialty]
Priority: [Routine/Urgent/ASAP/STAT]
Referring Diagnosis: [condition display] ([SNOMED/ICD code])
Clinical Question:
[Formulated question from Step 7]
Pertinent Labs:
- [Lab name]: [value] [units] ([date]) [H/L flag if abnormal]
- [Lab name]: [value] [units] ([date]) [H/L flag if abnormal]
Current Relevant Medications:
- [medication] [dose] [frequency]
- [medication] [dose] [frequency]
Relevant Imaging/Procedures:
- [study]: [key finding] ([date])
Prior Authorization: [LIKELY REQUIRED / Not expected / Check with payer]
Reason: [if required, explain why]
ServiceRequest Created: ServiceRequest/[id]User says: "Refer patient 12345 to cardiology for chest pain evaluation"
Actions:
fhir_read Patient/12345 -- returns John Davis, DOB 1960-04-22, Malefhir_search Condition?patient=12345&clinical-status=active -- finds chest pain (SNOMED 29857009), hypertension, hyperlipidemiafhir_search Observation?patient=12345&category=laboratory&code=6598-7,42637-9,57698-3 -- troponin negative, BNP 340, LDL 165fhir_search MedicationRequest?patient=12345&status=active -- lisinopril 20mg, atorvastatin 40mg, aspirin 81mgfhir_search DiagnosticReport?patient=12345&category=RAD -- chest X-ray normal, no prior echofhir_search Coverage?patient=12345&status=active -- Aetna PPOfhir_create ServiceRequest with all gathered dataResult:
REFERRAL SUMMARY
================
Patient: John Davis | DOB: 1960-04-22 | MRN: MRN-12345
Insurance: Aetna - PPO
Referral To: Cardiology
Priority: Urgent
Referring Diagnosis: Chest pain (SNOMED 29857009)
Clinical Question:
64yo M with recurrent exertional chest pain x 2 weeks, history of HTN and
hyperlipidemia. Troponin negative, BNP mildly elevated at 340. No prior
cardiac workup. Please evaluate for ischemic etiology and recommend workup.
Pertinent Labs:
- Troponin I: <0.01 ng/mL (2024-01-10) [Normal]
- BNP: 340 pg/mL (2024-01-10) [H]
- LDL: 165 mg/dL (2023-11-15) [H]
Current Relevant Medications:
- Lisinopril 20mg daily
- Atorvastatin 40mg daily
- Aspirin 81mg daily
Relevant Imaging/Procedures:
- Chest X-ray: No acute cardiopulmonary process (2024-01-10)
Prior Authorization: Not expected (PPO plan, initial consult)
ServiceRequest Created: ServiceRequest/sr-88901User says: "Patient abc-555 needs a GI referral for persistent GI bleeding, please generate"
Actions:
fhir_read Patient/abc-555 -- returns Susan Park, DOB 1975-08-30, Femalefhir_search Condition?patient=abc-555&clinical-status=active -- GI hemorrhage (SNOMED 74474003), iron deficiency anemiafhir_search Observation?patient=abc-555&category=laboratory&code=718-7,2276-4,1751-7 -- Hgb 8.2, ferritin 8, albumin 3.1fhir_search MedicationRequest?patient=abc-555&status=active -- omeprazole 40mg BID, ferrous sulfate 325mg TIDfhir_search Coverage?patient=abc-555&status=active -- United Healthcare HMOfhir_create ServiceRequest with urgent priorityResult:
REFERRAL SUMMARY
================
Patient: Susan Park | DOB: 1975-08-30 | MRN: MRN-abc-555
Insurance: United Healthcare - HMO
Referral To: Gastroenterology
Priority: Urgent
Referring Diagnosis: Gastrointestinal hemorrhage (SNOMED 74474003)
Clinical Question:
48yo F with iron deficiency anemia (Hgb 8.2, ferritin 8) and melena x 3 weeks.
On PPI BID without improvement. Requesting EGD/colonoscopy for source evaluation.
No prior endoscopic evaluation.
Pertinent Labs:
- Hemoglobin: 8.2 g/dL (2024-01-12) [L - critical]
- Ferritin: 8 ng/mL (2024-01-12) [L]
- Albumin: 3.1 g/dL (2024-01-12) [L]
Current Relevant Medications:
- Omeprazole 40mg BID
- Ferrous sulfate 325mg TID
Relevant Imaging/Procedures:
- None on file
Prior Authorization: LIKELY REQUIRED
Reason: HMO plan requires prior auth for specialist visits and endoscopy procedures.
Recommend submitting auth request before scheduling.
ServiceRequest Created: ServiceRequest/sr-99102Condition?patient=[id]&code:text=[keyword] if the SNOMED code is unknown.fhir_create on Condition, then reference it in the ServiceRequest._sort=-date&_count=1 to get the most recent result even if older than expected.care-gap-identifier -- may surface conditions that trigger specialist referralsdischarge-planning-checklist -- referrals may be part of discharge requirementstransition-of-care-summary -- include referral context in transfer documentation~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.