fhir-api

Expert guidance for implementing FHIR RESTful API servers and clients following the HL7 FHIR specification. Use this skill when implementing a FHIR server with REST endpoints, building a FHIR client, designing FHIR API routes and handlers, implementing FHIR operations (read, create, update, delete, search, history), working with FHIR bundles, batch requests, or transactions, handling FHIR content negotiation, headers, and versioning, or implementing conditional operations. Trigger keywords include "FHIR REST", "FHIR API", "FHIR server", "FHIR client", "FHIR endpoint", "FHIR operations", "RESTful FHIR", "implement FHIR".

16 stars

Best use case

fhir-api is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Expert guidance for implementing FHIR RESTful API servers and clients following the HL7 FHIR specification. Use this skill when implementing a FHIR server with REST endpoints, building a FHIR client, designing FHIR API routes and handlers, implementing FHIR operations (read, create, update, delete, search, history), working with FHIR bundles, batch requests, or transactions, handling FHIR content negotiation, headers, and versioning, or implementing conditional operations. Trigger keywords include "FHIR REST", "FHIR API", "FHIR server", "FHIR client", "FHIR endpoint", "FHIR operations", "RESTful FHIR", "implement FHIR".

Teams using fhir-api should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

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/fhir-api/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/fhir-api/SKILL.md"

Manual Installation

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

How fhir-api Compares

Feature / Agentfhir-apiStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Expert guidance for implementing FHIR RESTful API servers and clients following the HL7 FHIR specification. Use this skill when implementing a FHIR server with REST endpoints, building a FHIR client, designing FHIR API routes and handlers, implementing FHIR operations (read, create, update, delete, search, history), working with FHIR bundles, batch requests, or transactions, handling FHIR content negotiation, headers, and versioning, or implementing conditional operations. Trigger keywords include "FHIR REST", "FHIR API", "FHIR server", "FHIR client", "FHIR endpoint", "FHIR operations", "RESTful FHIR", "implement FHIR".

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

# FHIR REST API implementation

This skill provides guidance for implementing FHIR RESTful APIs according to the HL7 FHIR specification (R4/R5).

## URL structure

All FHIR REST URLs follow the pattern:

```
[base]/[type]/[id]
```

- `[base]`: Service base URL (e.g., `https://fhir.example.org/r4`)
- `[type]`: Resource type (e.g., `Patient`, `Observation`)
- `[id]`: Logical resource ID

URLs are case-sensitive and use UTF-8 encoding.

## Core operations

| Operation         | HTTP     | URL Pattern                         | Success |
| ----------------- | -------- | ----------------------------------- | ------- |
| Read              | GET      | `[base]/[type]/[id]`                | 200     |
| VRead             | GET      | `[base]/[type]/[id]/_history/[vid]` | 200     |
| Create            | POST     | `[base]/[type]`                     | 201     |
| Update            | PUT      | `[base]/[type]/[id]`                | 200/201 |
| Patch             | PATCH    | `[base]/[type]/[id]`                | 200     |
| Delete            | DELETE   | `[base]/[type]/[id]`                | 200/204 |
| Search            | GET/POST | `[base]/[type]?params`              | 200     |
| History           | GET      | `[base]/[type]/[id]/_history`       | 200     |
| Capabilities      | GET      | `[base]/metadata`                   | 200     |
| Batch/Transaction | POST     | `[base]`                            | 200     |

For detailed specifications of each operation, see [references/operations.md](references/operations.md).

## Content negotiation

### MIME types

| Format | MIME Type                 |
| ------ | ------------------------- |
| JSON   | `application/fhir+json`   |
| XML    | `application/fhir+xml`    |
| RDF    | `application/fhir+turtle` |

Use the `Accept` header for response format and `Content-Type` for request body format.

The `_format` query parameter overrides `Accept` when clients cannot set headers.

### FHIR version

Specify version via MIME type parameter:

```
Accept: application/fhir+json; fhirVersion=4.0
```

Version mappings: 1.0 (R2), 3.0 (R3), 4.0 (R4), 4.3 (R4B), 5.0 (R5).

## Required headers

### Request headers

| Header        | Purpose             | Example                 |
| ------------- | ------------------- | ----------------------- |
| Accept        | Response format     | `application/fhir+json` |
| Content-Type  | Request body format | `application/fhir+json` |
| If-Match      | Optimistic locking  | `W/"123"`               |
| If-None-Exist | Conditional create  | `identifier=123`        |
| Prefer        | Return preference   | `return=representation` |

### Response headers

| Header        | Purpose            | Example                         |
| ------------- | ------------------ | ------------------------------- |
| ETag          | Version identifier | `W/"123"`                       |
| Location      | New resource URL   | `[base]/Patient/123/_history/1` |
| Last-Modified | Modification time  | RFC 7231 date                   |

## Versioning and optimistic locking

FHIR uses weak ETags for version tracking:

1. Server returns `ETag: W/"[versionId]"` with responses
2. Client sends `If-Match: W/"[versionId]"` with updates
3. Server returns `412 Precondition Failed` if version mismatch

Implement version-aware updates when `CapabilityStatement.rest.resource.versioning` is `versioned-update`.

## Error handling

Return `OperationOutcome` resources for all errors:

```json
{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "invalid",
            "diagnostics": "Patient.birthDate: Invalid date format"
        }
    ]
}
```

### Status codes

| Code | Meaning                                |
| ---- | -------------------------------------- |
| 400  | Invalid syntax or validation failure   |
| 404  | Resource not found                     |
| 409  | Version conflict                       |
| 410  | Resource deleted                       |
| 412  | Precondition failed (version mismatch) |
| 422  | Business rule violation                |

## Prefer header

Control response content with `Prefer`:

| Value                     | Response body        |
| ------------------------- | -------------------- |
| `return=minimal`          | Empty (headers only) |
| `return=representation`   | Full resource        |
| `return=OperationOutcome` | Validation outcome   |

For async operations, use `Prefer: respond-async` to get `202 Accepted` with status polling URL.

## Implementation checklist

Server implementations should:

1. Implement CapabilityStatement at `/metadata`
2. Support content negotiation (JSON at minimum)
3. Return proper ETags for versioned resources
4. Include `Location` header on create/update
5. Return `OperationOutcome` for all errors
6. Support `_format` parameter fallback
7. Honour `Prefer` header for response content

## References

- [operations.md](references/operations.md): Detailed operation specifications
- [search.md](references/search.md): Search parameter and result handling
- [batch-transaction.md](references/batch-transaction.md): Batch and transaction processing

Related Skills

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

framework

16
from diegosouzapw/awesome-omni-skill

Expert on SpecWeave framework structure, rules, and spec-driven development conventions. Use when learning SpecWeave best practices, understanding increment lifecycle, or configuring hooks. Covers source-of-truth discipline, tasks.md/spec.md formats, living docs sync, and file organization patterns.

framework-learning

16
from diegosouzapw/awesome-omni-skill

Learn and answer questions from any framework documentstion website quickly and accurately. Crawls a docs site from a seed URL, builds a lightweight URL index (titles/headings/snippets), BM25-ranks pages for a user's question, then fetehces and converts only the top-k pages to clean markdown for grounded answers with source links. Use when a user shares a docs URL and asks "how do I..", "where is..", "explain..", "OAuth/auth", "errors", "configuration" or "API usage"

framework-expert

16
from diegosouzapw/awesome-omni-skill

Unified framework expertise bundle. Lazy-loads relevant framework patterns (React, Vue, Angular, Next.js, Node.js, Python, Laravel, Go, Flutter, Godot) based on detected tech stack.

framework-consciousness

16
from diegosouzapw/awesome-omni-skill

Meta-orchestration skill for holistic TNF system understanding and coordinated capability use.

fp-ts-react

16
from diegosouzapw/awesome-omni-skill

Practical patterns for using fp-ts with React - hooks, state, forms, data fetching. Use when building React apps with functional programming patterns. Works with React 18/19, Next.js 14/15.

fp-ts-pragmatic

16
from diegosouzapw/awesome-omni-skill

A practical, jargon-free guide to fp-ts functional programming - the 80/20 approach that gets results without the academic overhead. Use when writing TypeScript with fp-ts library.

fp-ts-errors

16
from diegosouzapw/awesome-omni-skill

Handle errors as values using fp-ts Either and TaskEither for cleaner, more predictable TypeScript code. Use when implementing error handling patterns with fp-ts.

fox-pilot

16
from diegosouzapw/awesome-omni-skill

Firefox browser automation CLI for AI agents. Use when users ask to automate Firefox, navigate websites, fill forms, take screenshots, extract web data, or test web apps in Firefox. Trigger phrases include "in Firefox", "fox-pilot", "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", or any browser interaction request mentioning Firefox.

Fossil SCM Usage

16
from diegosouzapw/awesome-omni-skill

This skill should be used when the user asks to "fossil commit", "fossil branch", "fossil merge", "fossil clone", "fossil sync", "fossil ticket", "fossil stash", "fossil timeline", mentions working with a Fossil repository, asks about Fossil vs Git differences, or needs help with Fossil SCM commands and workflows.

formula-decoder-skill

16
from diegosouzapw/awesome-omni-skill

Decodes mathematical and physical formulas using a 5-stage process: Confusion, Intuition, Symbol Mapping, Limit Testing, and Dimension Ascension. Combines the styles of Feynman, Sanderson, Euclid, and Victor for deep understanding.

formsite-automation

16
from diegosouzapw/awesome-omni-skill

Automate Formsite tasks via Rube MCP (Composio). Always search tools first for current schemas.