Agent skill

Fhirpath

by aehrc in aehrc/pathling

Condensed working reference for writing FHIRPath expressions — syntax, function signatures, operator precedence, date/time arithmetic, and common patterns.

Apache-2.0Auto-check passedResearch & Science

Install Fhirpath

skills CLI
$ npx skills add aehrc/pathling --skill fhirpath -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install aehrc/pathling fhirpath --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/aehrc/pathling.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/fhirpath .claude/skills/fhirpath && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
fhirpath
GitHub stars
137
Token cost
~2.8k tokens
SKILL.md length
396 words
Files
1
Skills in repo
25
Repo updated
First seen
Licence
Apache-2.0

At a glance

Condensed working reference for writing FHIRPath expressions — syntax, function signatures, operator precedence, date/time arithmetic, and common patterns.

  • Works in 11 steps: . (path), [] (indexer) → Unary +, - → *, /, div, mod → …
  • Reading a FHIRPath expression
  • SKILL.md covers Path Navigation, Literals, Collections and Key Functions, plus 5 more sections
  • Reaches unitsofmeasure.org and snomed.info

What it does

Fhirpath is an agent skill from aehrc/pathling. Condensed working reference for writing FHIRPath expressions — syntax, function signatures, operator precedence, date/time arithmetic, and common patterns. Use this skill when writing or reading a FHIRPath expression, navigating FHIR resource trees, filtering collections, or writing FHIR invariants. Trigger keywords include "FHIRPath", "path expression", "FHIR navigation", "where()", "select()", "exists()", "ofType()", "resolve()", "FHIR invariant", "collection filtering". For questions about what the…

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Research & Science, covering Clinical and healthcare research. The repository describes itself as: Tools that make it easier to use FHIR and clinical terminology within data analytics, built on Apache Spark. The licence is Apache-2.0.

When your agent uses it

  • Reading a FHIRPath expression
  • Navigating FHIR resource trees
  • Filtering collections
  • Writing FHIR invariants

Example prompts

  • “FHIRPath”
  • “path expression”
  • “FHIR navigation”
  • “/fhirpath”

Workflow steps

11 steps, taken from the first numbered list in SKILL.md.

  1. . (path), [] (indexer)
  2. Unary +, -
  3. *, /, div, mod
  4. +, -, &
  5. is, as
  6. >, <, >=, <=
  7. =, ~, !=, !~
  8. in, contains
  9. and
  10. xor, or
  11. implies

What it can do on your machine

Read from SKILL.md and the folder at commit 56a3b4a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • unitsofmeasure.org
    • snomed.info
    • loinc.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Fhirpath loads about 2.8k tokens when it runs. Until then it costs about 164 tokens; SKILL.md has 396 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~164
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from aehrc/pathling at commit 56a3b4a, republished under its Apache-2.0 licence (© aehrc). 396 words, ~2,825 tokens.

Download SKILL.mdSave it as .claude/skills/fhirpath/SKILL.md (or your agent's skills folder).
name
fhirpath
description
Condensed working reference for writing FHIRPath expressions — syntax, function signatures, operator precedence, date/time arithmetic, and common patterns. Use this skill when writing or reading a FHIRPath expression, navigating FHIR resource trees, filtering collections, or writing FHIR invariants. Trigger keywords include "FHIRPath", "path expression", "FHIR navigation", "where()", "select()", "exists()", "ofType()", "resolve()", "FHIR invariant", "collection filtering". For questions about what the specification *requires* — exact semantics, empty propagation, coercion, precision, error conditions — use the `fhirpath-spec` skill instead.

FHIRPath

A condensed reference for writing FHIRPath expressions. Use it to orient quickly or to recall a signature.

It is a summary, not a source of truth. When exact semantics matter — empty propagation, coercion, precision, error conditions — use the fhirpath-spec skill, which reads the normative spec text and the fhirpath.js reference implementation. Where this file and the spec disagree, the spec wins.

FHIRPath is a path-based navigation and extraction language for hierarchical data models, used extensively in FHIR and CQL. All operations return collections.

Path Navigation

Patient.name.given              // Navigate to given names
Patient.name[0].given           // First name's given (0-based indexing)
Patient.name.first().given      // Equivalent using first()
Observation.value.ofType(Quantity).unit  // Filter by type then navigate

Prefix with type name to restrict context: Patient.name.given only works on Patient resources.

Literals

TypeExamples
Booleantrue, false
Integer42, -5
Decimal3.14159
String'hello', 'urn:oid:1.2.3' (single quotes, use \' to escape)
Date@2024-01-15, @2024-01, @2024 (partial dates allowed)
DateTime@2024-01-15T14:30:00Z, @2024-01-15T14:30:00+10:00, @2024T
Time@T14:30:00, @T14:30
Quantity10 'mg', 4 days, 100 '[degF]' (UCUM units in quotes)

Collections

  • All values are collections (even single items)
  • Empty collection: { }
  • Collections are ordered, non-unique, 0-indexed
  • Empty propagates through most operations

Key Functions

Existence
name.exists()                           // true if any names
name.exists(use = 'official')           // true if any official names
name.all(given.exists())                // true if all names have given
telecom.where(system='phone').empty()   // true if no phone telecoms
name.count()                            // number of names
Filtering and Projection
name.where(use = 'official')                    // Filter by criteria
entry.select(resource as Patient)               // Project/transform
name.select(given.first() + ' ' + family)       // Combine fields
telecom.distinct()                              // Remove duplicates
item.repeat(item)                               // Recursive traversal (unique)
expansion.repeat(contains)                      // Navigate tree structures
Subsetting
name[0]           // First item (0-based)
name.first()      // First item
name.last()       // Last item
name.tail()       // All but first
name.skip(2)      // Skip first 2
name.take(3)      // Take first 3
name.single()     // Error if not exactly one
Combining
name.given | name.family     // Union (removes duplicates)
a.union(b)                   // Same as |
a.combine(b)                 // Merge without removing duplicates
a.intersect(b)               // Items in both
a.exclude(b)                 // Items in a but not b
Type Operations
value is Quantity                    // Type check (returns Boolean)
value as Quantity                    // Cast (empty if wrong type)
entry.resource.ofType(Patient)       // Filter collection by type
String Functions
'hello'.length()                     // 5
'hello'.substring(1, 3)              // 'ell'
'hello'.startsWith('he')             // true
'hello'.endsWith('lo')               // true
'hello'.contains('ell')              // true (different from contains operator)
'hello'.indexOf('l')                 // 2
'HELLO'.lower()                      // 'hello'
'hello'.upper()                      // 'HELLO'
'a-b-c'.replace('-', '_')            // 'a_b_c'
'abc'.matches('[a-z]+')              // true (partial match)
'abc'.matchesFull('[a-z]+')          // true (full match)
'a,b,c'.split(',')                   // {'a', 'b', 'c'}
('a' | 'b' | 'c').join(',')          // 'a,b,c'
'  hello  '.trim()                   // 'hello'
Math Functions (STU)
(-5).abs()              // 5
1.5.ceiling()           // 2
1.5.floor()             // 1
1.5.round()             // 2
1.5.truncate()          // 1
2.power(3)              // 8.0
9.sqrt()                // 3.0
2.718.ln()              // ~1.0
100.log(10)             // 2.0
0.exp()                 // 1.0
Conversion
'42'.toInteger()              // 42
42.toString()                 // '42'
'3.14'.toDecimal()            // 3.14
'true'.toBoolean()            // true (also 't', 'yes', 'y', '1')
'2024-01-15'.toDate()         // @2024-01-15
'10:30:00'.toTime()           // @T10:30:00
'5 mg'.toQuantity()           // 5 'mg'
value.convertsToInteger()     // true if conversion would succeed
Date/Time Component Extraction (STU)
@2024-03-15.yearOf()                          // 2024
@2024-03-15.monthOf()                         // 3
@2024-03-15.dayOf()                           // 15
@2024-03-15T10:30:45.123.hourOf()             // 10
@2024-03-15T10:30:45.123.minuteOf()           // 30
@2024-03-15T10:30:45.123.secondOf()           // 45
@2024-03-15T10:30:45.123.millisecondOf()      // 123
@2024-03-15T10:30:00+10:00.timezoneOffsetOf() // 10.0
@2024-03-15T10:30:00.dateOf()                 // @2024-03-15
@2024-03-15T10:30:00.timeOf()                 // @T10:30:00
Utility
now()                                 // Current DateTime
today()                               // Current Date
timeOfDay()                           // Current Time
iif(condition, true-result, else)     // Conditional (short-circuit)
coalesce(a, b, c)                     // First non-empty (STU)
trace('label', projection)            // Debug logging
defineVariable('name', expr)          // Define variable for later use (STU)
Aggregates (STU)
(1 | 2 | 3).sum()                     // 6
(1 | 2 | 3).min()                     // 1
(1 | 2 | 3).max()                     // 3
(1 | 2 | 3).avg()                     // 2.0
values.aggregate($this + $total, 0)   // Custom aggregation

Operators

Equality
a = b       // Equal (empty if either empty)
a ~ b       // Equivalent (false if precisions differ, case-insensitive for strings)
a != b      // Not equal
a !~ b      // Not equivalent
Comparison
a > b       // Greater than
a < b       // Less than
a >= b      // Greater or equal
a <= b      // Less or equal

Comparison with different date/time precisions returns empty: @2024-01 > @2024-01-15 → { }

Boolean
a and b     // Three-valued AND
a or b      // Three-valued OR
a xor b     // Exclusive OR
a implies b // Implication
not()       // Negation (function, not operator)

Three-valued logic: true and { } → { }, false and { } → false

Math
5 + 3       // Addition (also string concatenation)
5 - 3       // Subtraction
5 * 3       // Multiplication
5 / 3       // Division (always Decimal)
5 div 3     // Integer division
5 mod 3     // Modulo
'a' & 'b'   // String concat (empty → empty string)
Collections
item in collection       // Membership
collection contains item // Containership (converse of in)
a | b                    // Union
Precedence (high to low)
  1. . (path), [] (indexer)
  2. Unary +, -
  3. *, /, div, mod
  4. +, -, &
  5. is, as
  6. |
  7. >, <, >=, <=
  8. =, ~, !=, !~
  9. in, contains
  10. and
  11. xor, or
  12. implies
Show full SKILL.md (159 more words)Show less

Date/Time Arithmetic

Add/subtract time-valued quantities from dates/times:

@2024-01-15 + 1 month       // @2024-02-15
@2024-01-31 + 1 month       // @2024-02-29 (last day of month)
@2024-03-15 - 10 days       // @2024-03-05
now() - 1 year              // One year ago

Calendar duration keywords: year(s), month(s), week(s), day(s), hour(s), minute(s), second(s), millisecond(s)

UCUM definite durations ('a', 'mo', 'd') are NOT equivalent for arithmetic above seconds.

Environment Variables

%ucum        // UCUM URL (http://unitsofmeasure.org)
%context     // Original evaluation context
%`custom`    // Custom variables (backtick-delimited)

Singleton Evaluation

When a function expects a single item but receives a collection:

  • Single item → use it
  • Single item convertible to Boolean → use as Boolean
  • Empty → return empty
  • Multiple items → ERROR

Common Patterns

Safe navigation with existence checks
name.where(use = 'official').exists() implies name.where(use = 'official').given.exists()
Conditional logic
iif(gender = 'male', 'M', iif(gender = 'female', 'F', 'U'))
Fallback values
coalesce(name.where(use='official'), name.where(use='usual'), name.first())
Reference resolution (FHIR-specific)
subject.resolve().ofType(Patient).birthDate
generalPractitioner.all(resolve() is Practitioner)
Working with CodeableConcept
code.coding.where(system = 'http://snomed.info/sct').code
code.coding.exists(system = 'http://loinc.org' and code = '12345-6')
Recursive navigation
Questionnaire.repeat(item)            // All nested items
ValueSet.expansion.repeat(contains)   // All expansion concepts
Type-safe polymorphic access
Observation.value.ofType(Quantity).value > 100
(Observation.value as Quantity).value > 100

FHIR Invariants

FHIRPath is used to define constraints in FHIR profiles:

// Name must have family or given
name.family.exists() or name.given.exists()

// If dosage exists, it must have timing or asNeeded
dosage.exists() implies (dosage.timing.exists() or dosage.asNeeded.exists())

// All references must be resolvable as Practitioner
performer.all(resolve() is Practitioner)

Pitfalls

  1. Multiple items in singleton context: Patient.name.given + ' ' + Patient.name.family fails if multiple names
  2. Equality with empty: { } = { } returns { }, not true
  3. Date precision: @2024 = @2024-01 returns { } (unknown)
  4. String contains vs collection contains: .contains('x') is string function; contains x is operator
  5. Case sensitivity: FHIRPath keywords are case-sensitive; type names depend on model
  6. Indexing: Collections are 0-based (first element is [0])

© aehrc, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/fhirpath of aehrc/pathling.

Open the folder on GitHubat commit 56a3b4a

Compare with similar skills

Fhirpath next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Fhirpath compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Fhirpath this skillaehrc/pathling137—~2.8kAutomated safety check: PassApache-2.0
Clinical Trials Databasegoogle-deepmind/science-skills3.2k2 repos~3.2kAutomated safety check: PassApache-2.0
CHARLS Paper Reproduction Guidexjtulyc/MedgeClaw6171 repos~1.8kAutomated safety check: PassNone
Model AssessmentAperivue/medsci-skills3291 repos~4.5kAutomated safety check: PassMIT
Biomedical Analysis Dispatchxjtulyc/MedgeClaw6171 repos~2kAutomated safety check: PassNone
Research Proposalluwill/research-skills857—~4.4kAutomated safety check: NotesNone

Similar skills

  • Clinical Trials Database

    google-deepmind/science-skills

    Query ClinicalTrials.gov via APIv2. An agent skill from google-deepmind/science-skills.

    3.2k GitHub starsUsed in 2 repos~3.2k tokens
    Research & ScienceAuto-check passed
  • Guides an agent through reproducing papers built on the CHARLS health and retirement survey, from variable mapping to cognition, depression and isolation scores.

    617 GitHub starsUsed in 1 repo~1.8k tokens
    Research & ScienceAuto-check passed
  • Model Assessment

    Aperivue/medsci-skills

    A skill your agent uses when validating or evaluating a trained medical-imaging model.

    329 GitHub starsUsed in 1 repo~4.5k tokens
    Research & ScienceAuto-check passed
  • Routes bioinformatics, drug discovery, clinical and multi-omics tasks from a chat interface to Claude Code sessions running K-Dense scientific skills, with a live dashboard per task.

    617 GitHub starsUsed in 1 repo~2k tokens
    Research & ScienceAuto-check passed
  • Research Proposal

    luwill/research-skills

    A skill your agent uses when the user asks to write or draft a PhD / doctoral research proposal, research plan, 研究计划书, or 开题报告 — a forward-looking plan of background, gap, research questions…

    857 GitHub stars~4.4k tokensUpdated 7 days ago
    Research & ScienceAuto-check: notes
  • Medical Imaging Review

    LeonChaoX/qinyan-academic-skills

    Write comprehensive literature reviews for medical imaging AI research.

    937 GitHub starsUsed in 3 repos~1.1k tokens
    Research & ScienceAuto-check: notes

More from aehrc/pathling

All 25 skills in this repo
  • Fhir API

    aehrc/pathling

    Expert guidance for implementing FHIR RESTful API servers and clients following the HL7 FHIR specification.

    137 GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed
  • Fhir Bulk Data

    aehrc/pathling

    Expert guidance for implementing FHIR Bulk Data Access (Flat FHIR) following the HL7 specification.

    137 GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Databricks CLI

    aehrc/pathling

    Expert guidance for using the Databricks CLI to manage Databricks workspaces, clusters, jobs, pipelines, Unity Catalog, SQL warehouses, serving endpoints, secrets, bundles, and all other Databricks…

    137 GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Fhir Search Spec

    aehrc/pathling

    FHIR RESTful search specification expert with access to the official HL7 search specification text and the formal SearchParameter registry.

    137 GitHub stars~649 tokensUpdated today
    Auto-check passed
  • Design and generate comprehensive FHIRPath test suites using input domain partitioning and Pathling's DSL test framework.

    137 GitHub stars~3.6k tokensUpdated today
    Auto-check passed
  • Hapi Fhir Server

    aehrc/pathling

    Expert guidance for implementing FHIR servers using HAPI FHIR Plain Server framework.

    137 GitHub stars~2.6k tokensUpdated today
    Auto-check passed

Questions about Fhirpath

What does Fhirpath do?

Condensed working reference for writing FHIRPath expressions — syntax, function signatures, operator precedence, date/time arithmetic, and common patterns. Fhirpath is an agent skill from aehrc/pathling. Condensed working reference for writing FHIRPath expressions — syntax, function signatures, operator precedence, date/time arithmetic, and common patterns.

When should I use Fhirpath?

Fhirpath fits situations like: reading a FHIRPath expression; navigating FHIR resource trees; filtering collections; writing FHIR invariants.

How do I install Fhirpath in Claude Code?

Run `npx skills add aehrc/pathling --skill fhirpath -a claude-code`. Or copy the skill folder (.claude/skills/fhirpath in aehrc/pathling) into .claude/skills/fhirpath in your project. Claude Code loads it when a task matches its description.

How do I install Fhirpath in Codex?

Run `npx skills add aehrc/pathling --skill fhirpath -a codex`. Or copy the skill folder (.claude/skills/fhirpath in aehrc/pathling) into .agents/skills/fhirpath in your project. Codex loads it when a task matches its description.

Can I use Fhirpath in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aehrc/pathling --skill fhirpath -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fhirpath, .gemini/skills/fhirpath, .github/skills/fhirpath and .opencode/skills/fhirpath in your project.

What does Fhirpath need to run?

SKILL.md names no scripts, command-line tools or credentials: Fhirpath is instructions for the agent only.

Does Fhirpath access the network?

SKILL.md names 3 domains. In commands or code: unitsofmeasure.org, snomed.info and loinc.org; the agent is likely to contact these when it follows the instructions. This is read from the text; nothing was executed.

Is Fhirpath safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Fhirpath use?

Fhirpath is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Fhirpath use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Fhirpath?

Skills that share tags, products or a category with Fhirpath: Clinical Trials Database (google-deepmind/science-skills, 3.2k stars), CHARLS Paper Reproduction Guide (xjtulyc/MedgeClaw, 617 stars), Model Assessment (Aperivue/medsci-skills, 329 stars) and Biomedical Analysis Dispatch (xjtulyc/MedgeClaw, 617 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Fhirpath?

aehrc (a GitHub organization) maintains it in aehrc/pathling, which has 137 GitHub stars. The repository holds 25 skills in this directory. The repository was last updated on October 7, 2026.

Source: aehrc/pathling on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.