
TL;DR
Hospitals still ship HL7 v2 pipes between systems in 2026. Here is how to wire Claude Code as a careful, HIPAA-aware migration agent that takes them to FHIR.
Walk into any mid-sized hospital integration team in 2026 and you will still find HL7 v2 messages flowing over MLLP between an old Epic interface, a lab system from a vendor that was acquired twice, and a homegrown bed-management app that nobody wants to touch. The org has a five-year FHIR mandate, a Mirth or Rhapsody engine in the middle, and one or two analysts who can read pipe-and-hat encoding without flinching. Everything else is tribal knowledge written into channel filters and JavaScript transformers.
For the broader MCP map, pair this with What Is MCP (Model Context Protocol)? A TypeScript Developer's Guide and The Complete Guide to MCP Servers; those pieces cover the concepts and server-selection layer behind this article.
This is the kind of work that looks tedious from the outside and terrifying from the inside. A wrong field map can put an allergy on the wrong patient. A dropped segment can lose a discharge time. The reason these migrations stall is not that FHIR is hard. It is that the existing v2 messages encode twenty years of local conventions that the spec never had opinions about, and nobody has the bandwidth to chase them all down.
Agentic coding tools change the math. Claude Code, scoped properly, is unusually good at this kind of grinding, well-bounded, high-context translation work. The trick is wiring it so it never sees PHI it should not see, never writes to a production interface engine, and always produces a diff that a human integrator can sign off on.
The non-obvious wedge is not "use AI to write FHIR resources." Half the FHIR community has tried that and bounced off the spec. The wedge is "use a coding agent to migrate the transformer code, not the data." The transformer is just JavaScript or Python. The agent reads the v2 sample, reads the channel transformer, reads the FHIR profile the org has standardized on (US Core, Carin BB, Da Vinci, whatever), and proposes a new transformer plus a test fixture. PHI never leaves the synthetic-fixture loop. The output is a pull request, not a live deploy.

Newsletter
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools, delivered free every week.
From the archive
Apr 28, 2026 • 9 min read
Apr 28, 2026 • 8 min read
Apr 28, 2026 • 11 min read
Apr 28, 2026 • 10 min read
A workable repo for this looks like:
hl7-fhir-migration/
CLAUDE.md
channels/
adt-a08-bedboard/
v2-sample.hl7 # synthetic, Synthea-derived
current-transformer.js # exported from Mirth
target-profile.md # which FHIR profile + must-support fields
tests/
encounter.expected.json
patient.expected.json
skills/
fhir-validate/
SKILL.md
scripts/validate.sh # wraps HAPI validator
hl7-parse/
SKILL.md
scripts/parse.py # uses python-hl7
.claude/
settings.json # hooks, allowlist, deny PHI paths
mcp/
fhir-server.ts # local HAPI FHIR proxy, MCP wrapper
The CLAUDE.md does the heavy lifting. It tells the agent the org's profile choices, the deterministic ID strategy (almost always a hash of MRN plus assigning authority), the timezone rules, and the list of fields the compliance team cares about most: allergies, medications, code status, advance directives. Everything else is "best effort, flag for review."
The prompt pattern that works is two-pass.
Pass one is discovery. You point Claude Code at one channel folder and ask:
Read
v2-sample.hl7andcurrent-transformer.js. Produce a table of every v2 field the transformer touches, the FHIR resource and element it maps to under ourtarget-profile.md, and a confidence score. Flag anything where the source field is being parsed with a regex or a custom date format. Do not write code yet.
Pass two is implementation, scoped to one resource at a time:
Implement the Encounter mapping only. Write a new transformer in
channels/adt-a08-bedboard/transformer.ts. For every must-support field intarget-profile.md, write a passing test intests/encounter.expected.json. Use thefhir-validateskill on the output. If validation fails, fix the transformer, not the expected fixture.
The reason to split is cost and review. Discovery passes are cheap and make the human-readable artifact that the integration analyst actually wants. Implementation passes are bigger but bounded.
The single highest-leverage piece of glue is a local FHIR MCP server. It wraps a HAPI FHIR validator running in Docker and exposes three tools: validate_resource, search_profile, and diff_against_baseline. The agent calls validate_resource on every artifact it produces and gets back the same OperationOutcome a human would see in HAPI. Because the server is local and the fixtures are synthetic, no PHI ever crosses a network boundary.
A minimal server in TypeScript is around 120 lines using the official MCP SDK. It runs as a stdio child process of Claude Code, started from .mcp.json. The same server doubles as a skill backend if you prefer SKILL.md style invocations.
The non-negotiable piece is a PreToolUse hook in .claude/settings.json that blocks any read of files matching real PHI patterns. It looks for the org's MRN format, the v2 magic numbers in non-fixture directories, and any path under production/. If the agent tries to read a file outside channels/*/ or the synthetic fixtures, the hook exits non-zero and Claude Code refuses the tool call.
A second hook on PostToolUse runs git diff --stat after every Write and rejects diffs that touch the production Mirth export directory. Belt and suspenders, but in healthcare you wear both.
The honest risks are these. First, synthetic data does not capture every local convention. Synthea will not produce the OBX-5 quirks a particular lab uses. Mitigation: keep a "weird messages" library, scrubbed and de-identified by a human, that the agent can train its mappings against. Second, FHIR profiles drift. US Core 7.0 broke things US Core 6.1 allowed. Pin the profile version in CLAUDE.md and bump deliberately. Third, audit. Anything the agent touches needs a paper trail that a HIPAA auditor can read. The PR-only output, combined with hook logs written to an append-only file, satisfies most audit asks.
SOC2 and HITRUST add one more requirement: the agent's transcripts themselves are records. Claude Code's --output-format jsonl plus a hook that ships transcripts to your existing SIEM closes that gap.
You can run the smallest version of this today, before talking to compliance, on synthetic data only.
mkdir hl7-fhir-migration && cd hl7-fhir-migrationchannels/adt-a08-bedboard/v2-sample.hl7current-transformer.jsCLAUDE.md that names US Core 7.0 as the target profileclaude and paste the discovery prompt aboveYou will get back a field-by-field mapping table in about ninety seconds. That table, on its own, is more documentation than most channels have today. Show it to the integration lead. The conversation about whether to let an agent write the next transformer goes very differently once they have read the first one.
The hospitals that win the FHIR transition will not be the ones with the biggest integration teams. They will be the ones whose teams stop hand-typing transformers and start reviewing them.
Read next
Claude Code is turning into an orchestration layer for agent teams. Here is how subagents, MCP, hooks, and long context fit together in 2026.
9 min readClaude Code and Codex both ship great agents and terrible transcripts. AgentCanvas is a visual adapter that puts the artifacts, decisions, and handoffs on one board so the next agent and the next human can see them.
6 min readZilliz's Claude Context MCP gives coding agents semantic code search, but the real question is whether retrieval makes agent work more reviewable, cheaper, and easier to verify.
8 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
A hosted infinite canvas your headless AI agents drive over MCP. Any MCP-speaking agent - Claude Code, Codex, Cursor, or...
View ToolAnthropic's agentic coding CLI. Runs in your terminal, edits files autonomously, spawns sub-agents, and maintains memory...
View ToolAnthropic's flagship reasoning model. Best-in-class for coding, long-context analysis, and agentic workflows. 1M token c...
View ToolMac app for running parallel Claude Code, Codex, and Cursor agents in isolated workspaces. Watch every agent work at onc...
View ToolEvery coding agent in one window. Stop alt-tabbing between Claude, Codex, and Cursor.
View AppTurn a one-liner into a working Claude Code skill. From idea to installed in a minute.
View AppDesign subagents visually instead of editing YAML by hand.
View AppConfigure Claude Code for maximum productivity -- CLAUDE.md, sub-agents, MCP servers, and autonomous workflows.
AI AgentsConfigure model, tools, MCP, skills, memory, and scoping.
Claude CodeRoute specific MCP servers only to specific subagents.
Claude Code
Check out Zed here! https://zed.dev In this video, we dive into Zed, a robust open source code editor that has recently introduced the Agent Client Protocol. This new open standard allows...

Leveraging Anthropic's Subagent for Claude Code: A Step-by-Step Guide In this video, we explore Anthropic's newly released subagent feature for Cloud Code, which allows developers to create...

Open Design: Open-Source n8n App That Turns Any Website into a Brand Kit, Design System, HTML + Images The video introduces Open Design, an MIT-licensed full-stack template that combines AI and n8n a

Apple's Safari MCP server lets AI coding agents inspect pages, capture screenshots, evaluate JavaScript, and run accessi...

Claude Code and Codex both ship great agents and terrible transcripts. AgentCanvas is a visual adapter that puts the art...

MCP makes tools callable by agents. That solves invocation. It does not solve visibility. The next agent and the next hu...

GitHub's Agent Finder discovers and invokes Claude, Codex, MCP servers, and skills automatically. Here is how the new AR...

AgentMemory gives Claude Code, Codex, Cursor, and other agents persistent local memory. The real adoption question is no...

Claude Code 2.1.128 is full of small fixes around MCP, worktrees, OTEL, plugins, and permissions. That is exactly why it...

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.