본문으로 건너뛰기
cccskills
Claude 공식무료GitHub에 공개

fhir-developer-skill

FHIR API development guide for building healthcare endpoints. Use when: (1) Creating FHIR REST endpoints (Patient, Observation, Encounter, Condition, MedicationRequest), (2) Validating FHIR resources and returning proper HTTP status codes and error responses, (3) Implementing SMART on FHIR authorization and OAuth scopes, (4) Working with Bundles, transactions, batch operations, or search pagination. Covers FHIR R4 resource structures, required fields, value sets (status codes, gender, intent), coding systems (LOINC, SNOMED, RxNorm, ICD-10), and OperationOutcome error handling.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(6)

  • SKILL.md9.7 KB
  • references/bundles.md3.5 KB
  • references/pagination.md3.1 KB
  • references/resource-examples.md5.3 KB
  • references/smart-auth.md6.4 KB
  • scripts/setup_fhir_project.py8.4 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

FHIR Developer Skill

Quick Reference

HTTP Status Codes

CodeWhen to Use
200 OKSuccessful read, update, or search
201 CreatedSuccessful create (include Location header)
204 No ContentSuccessful delete
400 Bad RequestMalformed JSON, wrong resourceType
401 UnauthorizedMissing, expired, revoked, or malformed token (RFC 6750)
403 ForbiddenValid token but insufficient scopes
404 Not FoundResource doesn't exist
412 Precondition FailedIf-Match ETag mismatch (NOT 400!)
422 Unprocessable EntityMissing required fields, invalid enum values, business rule violations

Required Fields by Resource (FHIR R4)

ResourceRequired FieldsEverything Else
Patient(none)All optional
Observationstatus, codeOptional
Encounterstatus, classOptional (including subject, period)
ConditionsubjectOptional (including code, clinicalStatus)
MedicationRequeststatus, intent, medication[x], subjectOptional
Medication(none)All optional
BundletypeOptional

Required vs Optional Fields (CRITICAL)

Only validate fields with cardinality starting with "1" as required.

CardinalityRequired?
0..1, 0..*NO
1..1, 1..*YES

Common mistake: Making subject or period required on Encounter. They are 0..1 (optional).


Value Sets (Enum Values)

Invalid enum values must return 422 Unprocessable Entity.

Patient.gender

male | female | other | unknown

Observation.status

registered | preliminary | final | amended | corrected | cancelled | entered-in-error | unknown

Encounter.status

planned | arrived | triaged | in-progress | onleave | finished | cancelled | entered-in-error | unknown

Encounter.class (Common Codes)

CodeDisplayUse
AMBambulatoryOutpatient visits
IMPinpatient encounterHospital admissions
EMERemergencyEmergency department
VRvirtualTelehealth

Condition.clinicalStatus

active | recurrence | relapse | inactive | remission | resolved

Condition.verificationStatus

unconfirmed | provisional | differential | confirmed | refuted | entered-in-error

MedicationRequest.status

active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown

MedicationRequest.intent

proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option

Bundle.type

document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection


Validation Pattern

Python/FastAPI:

from fastapi import FastAPI
from fastapi.responses import JSONResponse

app = FastAPI()

def operation_outcome(severity: str, code: str, diagnostics: str):
    return {
        "resourceType": "OperationOutcome",
        "issue": [{"severity": severity, "code": code, "diagnostics": diagnostics}]
    }

VALID_OBS_STATUS = {"registered", "preliminary", "final", "amended",
                    "corrected", "cancelled", "entered-in-error", "unknown"}

@app.post("/Observation", status_code=201)
async def create_observation(data: dict):
    if not data.get("status"):
        return JSONResponse(status_code=422, content=operation_outcome(
            "error", "required", "Observation.status is required"
        ), media_type="application/fhir+json")

    if data["status"] not in VALID_OBS_STATUS:
        return JSONResponse(status_code=422, content=operation_outcome(
            "error", "value", f"Invalid status '{data['status']}'"
        ), media_type="application/fhir+json")
    # ... create resource

TypeScript/Express:

const VALID_OBS_STATUS = new Set(['registered', 'preliminary', 'final', 'amended',
  'corrected', 'cancelled', 'entered-in-error', 'unknown']);

app.post('/Observation', (req, res) => {
  if (!req.body.status) {
    return res.status(422).contentType('application/fhir+json')
      .json(operationOutcome('error', 'required', 'Observation.status is required'));
  }
  if (!VALID_OBS_STATUS.has(req.body.status)) {
    return res.status(422).contentType('application/fhir+json')
      .json(operationOutcome('error', 'value', `Invalid status '${req.body.status}'`));
  }
  // ... create resource
});

Pydantic v2 Models (use Literal, not const=True):

from typing import Literal
from pydantic import BaseModel

class Patient(BaseModel):
    resourceType: Literal["Patient"] = "Patient"
    id: str | None = None
    gender: Literal["male", "female", "other", "unknown"] | None = None

Coding Systems (URLs)

SystemURL
LOINChttp://loinc.org
SNOMED CThttp://snomed.info/sct
RxNormhttp://www.nlm.nih.gov/research/umls/rxnorm
ICD-10http://hl7.org/fhir/sid/icd-10
v3-ActCodehttp://terminology.hl7.org/CodeSystem/v3-ActCode
Observation Categoryhttp://terminology.hl7.org/CodeSystem/observation-category
Condition Clinicalhttp://terminology.hl7.org/CodeSystem/condition-clinical
Condition Ver Statushttp://terminology.hl7.org/CodeSystem/condition-ver-status

Common LOINC Codes (Vital Signs)

CodeDescription
8867-4Heart rate
8480-6Systolic blood pressure
8462-4Diastolic blood pressure
8310-5Body temperature
2708-6Oxygen saturation (SpO2)

Data Type Patterns

Coding (direct) vs CodeableConcept (wrapped)

Coding - Used by Encounter.class:

{"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode", "code": "AMB"}

CodeableConcept - Used by Observation.code, Condition.code:

{"coding": [{"system": "http://loinc.org", "code": "8480-6"}], "text": "Systolic BP"}

Reference

{"reference": "Patient/123", "display": "John Smith"}

Identifier

{"system": "http://hospital.example.org/mrn", "value": "12345"}

Common Mistakes

MistakeCorrect Approach
Making subject or period required on EncounterBoth are 0..1 (optional). Only status and class are required
Using CodeableConcept for Encounter.classclass uses Coding directly: {"system": "...", "code": "AMB"}
Returning 400 for ETag mismatchUse 412 Precondition Failed for If-Match failures
Returning 400 for invalid enum valuesUse 422 Unprocessable Entity for validation errors
Forgetting Content-Type headerAlways set Content-Type: application/fhir+json
Missing Location header on createReturn Location: /Patient/{id} with 201 Created

Resource Structures

For complete JSON examples of all resources, see references/resource-examples.md.

Quick reference for error responses:

{
  "resourceType": "OperationOutcome",
  "issue": [{"severity": "error", "code": "not-found", "diagnostics": "Patient/123 not found"}]
}

RESTful Endpoints

POST   /[ResourceType]              # Create (returns 201 + Location header)
GET    /[ResourceType]/[id]         # Read
PUT    /[ResourceType]/[id]         # Update
DELETE /[ResourceType]/[id]         # Delete (returns 204)
GET    /[ResourceType]?param=value  # Search (returns Bundle)
GET    /metadata                    # CapabilityStatement
POST   /                            # Bundle transaction/batch

Conditional Operations

If-Match (optimistic locking):

  • Client sends: If-Match: W/"1"
  • Mismatch returns 412 Precondition Failed

If-None-Exist (conditional create):

  • Client sends: If-None-Exist: identifier=http://mrn|12345
  • Match exists: return existing (200)
  • No match: create new (201)

Reference Files

For detailed guidance, see:

  • Resource Examples: Complete JSON structures for Patient, Observation, Encounter, Condition, MedicationRequest, OperationOutcome, CapabilityStatement
  • SMART on FHIR Authorization: OAuth flows, scope syntax (v1/v2), backend services, scope enforcement
  • Pagination: Search result pagination, _count/_offset parameters, link relations
  • Bundle Operations: Transaction vs batch semantics, atomicity, processing order

Implementation Checklist

  1. Set Content-Type: application/fhir+json on all responses
  2. Return meta.versionId and meta.lastUpdated on resources
  3. Return Location header on create: /Patient/{id}
  4. Return ETag header: W/"{versionId}"
  5. Use OperationOutcome for all error responses
  6. Validate required fields → 422 for missing
  7. Validate enum values → 422 for invalid
  8. Search returns Bundle with type: "searchset"

Quick Start Script

To scaffold a new FHIR API project with correct Pydantic v2 patterns:

python scripts/setup_fhir_project.py my_fhir_api

Creates a FastAPI project with correct models, OperationOutcome helpers, and Patient CRUD endpoints.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

clinical-note-extract-skill

Claude 공식무료

Extract structured data from clinical notes with span-level provenance and null-safety. Use when users say "extract [variables] from this note", "abstract this chart", "pull structured data from these notes", "what does this note say about [field]", or when building a chart-abstraction, registry, or cohort dataset from unstructured clinical text.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

anthropics/healthcare4282026년 8월 27일 업데이트

Generate clinical trial protocols for medical devices or drugs. This skill should be used when users say "Create a clinical trial protocol", "Generate protocol for [device/drug]", "Help me design a clinical study", "Research similar trials for [intervention]", or when developing FDA submission documentation for investigational products.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

anthropics/healthcare4282026년 8월 27일 업데이트

contracts

Claude 공식무료

Answer a question across a corpus of contract documents with verified citations. Use when the user asks what a contract says, which contracts have a clause, what changed between amendments, or any question that needs reading and citing across a set of contract files. The corpus must be on the local filesystem (see README).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

anthropics/healthcare4282026년 8월 27일 업데이트

doc-extract

Claude 공식무료

Extract plain text from a document file - PDF, DOCX, XLSX, PPTX, RTF, or plain text/markdown/HTML. Use when a binary document needs to be turned into text, for example a contract PDF or an EHR DocumentReference attachment. Other skills (fhir) invoke scripts/extract.ts directly; the contracts MCP server bundles its own copy (servers/documents/src/extract.mjs) so its bundle stays self-contained — port fixes to both.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

anthropics/healthcare4282026년 8월 27일 업데이트

fhir

Claude 공식무료

Connect to a hospital's FHIR R4 server (Epic, Oracle Health/Cerner, MEDITECH, athenahealth, or any SMART-on-FHIR endpoint), pull a patient's clinical data and notes, and extract structured findings. Use when users say "connect to the EHR", "connect to Epic/Cerner", "pull notes for patient X", "what do the last 6 months of notes say about Y", or any task that starts from a live EHR rather than pasted text.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

anthropics/healthcare4282026년 8월 27일 업데이트

fraud-detection

Claude 공식무료

Screen a Medicare/Medicaid claims corpus for fraud, waste, and abuse and produce ranked, fully-cited investigation referrals for an SIU / program-integrity team. Use when asked to run a fraud sweep, screen claims for FWA, find billing anomalies, or generate investigation referrals over a claims dataset.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

anthropics/healthcare4282026년 8월 27일 업데이트

anthropics의 스킬 모두 보기

이 스킬의 문제 신고