Skip to content

Guide · Agent skill

How to use the PyHealth Clinical ML Pipelines agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The PyHealth agent skill is a set of instructions and helper files that teaches an AI agent how to build and check clinical machine-learning pipelines with the PyHealth library. It is aimed at researchers, data scientists and developers who prototype prediction models on EHR datasets such as MIMIC-III or MIMIC-IV, or who need medical code mapping. After this guide you will know what the skill does, how to install it, how to ask for it in natural language, and what it needs before you run anything.

PyHealth Clinical ML PipelinesK-Dense-AI/scientific-agent-skills · MIT

Quick start

  1. 1Download and unzip. Download the pyhealth skill ZIP and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder.
  2. 2Check prerequisites. Confirm Python 3.12 or 3.13, uv, and network access are available.
  3. 3Run the smoke test. From the skill directory, run the starter with --demo and --epochs 1 to confirm the environment works.
  4. 4Ask a clear question. Describe the dataset, outcome and output you need in plain language.
  5. 5Review the cohort definition. Check the prediction time, observation window, outcome horizon and split before accepting any modeling.
  6. 6Evaluate once. Let the agent evaluate the held-out test set after the model choice is fixed.

What an agent skill is and what this one makes the agent do

An agent skill is a folder of instructions that an AI agent can load when a task matches it. This skill is named pyhealth and is part of K-Dense-AI's scientific-agent-skills collection under MIT licence.

Once installed, the agent follows PyHealth's pipeline of Dataset, Task, Model, Trainer and Metrics when building clinical prediction work. It also checks common pitfalls such as patient-level splitting, leakage and outcome timing, and knows how to map ICD, ATC, NDC and RxNorm codes. The skill targets PyHealth 2.0.2 and warns against mixing in legacy 1.x patterns.

  • Dataset loading for MIMIC-III, MIMIC-IV, eICU and OMOP prediction tasks
  • Mortality, readmission and length-of-stay modeling, plus medication recommendation and sleep staging
  • Patient-level evaluation and Trainer checkpoints
  • ICD, ATC, NDC and RxNorm code mapping

Install the PyHealth skill from the ZIP or the Claude apps

Download the ZIP for skills/pyhealth from our page. Unzip it into ~/.claude/skills/ to make it available to your user account, or into a project's .claude/skills/ folder to limit it to that project.

If you use the Claude apps, you can instead upload the skill under Settings → Capabilities → Skills.

  • Personal install: unzip into ~/.claude/skills/
  • Project install: unzip into the project's .claude/skills/
  • Claude apps: Settings → Capabilities → Skills, then upload

Check the requirements before you start

The skill needs Python 3.12 or 3.13, PyHealth 2.0.2 with Torch 2.7.1, and uv, which the install command uses. Network access is needed for installation, public synthetic datasets and medical-code resources downloaded on first use.

Restricted clinical datasets such as MIMIC require authorized local access. The skill does not provide that access; you must already have it.

  • Python 3.12 or 3.13
  • PyHealth 2.0.2 with Torch 2.7.1
  • uv
  • Network access for installation and first-use downloads
  • Authorized local access for restricted datasets

Run the starter smoke test

The skill includes assets/starter_pipeline.py. Run this command from the skill directory, or use the absolute path to the asset. It trains on invented in-memory records and checks patient splitting, metrics and best-checkpoint restoration.

The smoke test confirms the setup works. It provides no evidence of clinical performance.

uv run --no-project --isolated --python 3.12 --with pyhealth==2.0.2 python assets/starter_pipeline.py --demo --epochs 1

Trigger the skill with natural requests

You do not need special syntax. Describe the clinical task, dataset and output you want. Mention the dataset name and the outcome so the agent loads the right reference files. The skill asks you to define the cohort, prediction time, observation window, outcome horizon and unit of evaluation before modeling.

Good requests name the data and the decision, for example: build a mortality prediction pipeline on MIMIC-IV with patient-level splits.

  • Build a PyHealth mortality prediction pipeline on MIMIC-III with patient-level splitting.
  • Map these ICD-10 codes to ATC codes using PyHealth.
  • Set up a PyHealth 2.0.2 project and run the demo starter.
  • Check my PyHealth split for patient leakage before training.

Understand the workflow the agent follows

The agent inspects your installed version and dataset configuration, then checks task semantics and required tables. It creates supervised samples, partitions by patient, and runs one batch before training. It declares validation metrics and the exact monitor key, and evaluates the held-out test set once.

The skill notes that the mortality task predicts death in the next admission. It is not an early-warning model for the current stay.

  • Dataset, then Task, then Model, then Trainer, then Metrics
  • Patient-level splits rather than visit-level splits
  • Monitor criterion set to min for loss and max for AUC or accuracy

Safety notes: scripts and network use

This skill runs scripts and uses the network. Installation, public synthetic datasets and medical-code tables download on first use and are cached. Review the commands before the agent runs them, and use an authorized local root for any real patient data.

Do not use this skill for clinical decision-making or patient care. Demo results are not evidence of clinical performance.

  • Run scripts only after reading them
  • Keep restricted patient data on authorized local storage
  • Use a fresh cache root after changing data, configuration or task code
  • Retain coding-system version and provenance for mapped codes

What people use it for

  • Prototype a next-admission mortality model on authorized MIMIC-IV data
  • Check a patient-level split for leakage before training
  • Map a list of ICD codes to ATC or RxNorm equivalents, noting one-to-many results
  • Confirm a PyHealth 2.0.2 environment works using the invented-data starter

Frequently asked questions

How do I install the PyHealth agent skill?

Download the ZIP for skills/pyhealth from the page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder. In the Claude apps, you can upload it under Settings → Capabilities → Skills.

Is the PyHealth skill free?

The skill is published under the MIT licence. The source does not state pricing for the skill, and PyHealth itself is installed from its released package.

What do I need to run it?

You need Python 3.12 or 3.13, PyHealth 2.0.2 with Torch 2.7.1, and uv. Network access is needed for installation and first-use downloads, and restricted datasets such as MIMIC need authorized local access.

Can I use it on MIMIC data?

Yes, if you have authorized access. Point the workflow at a local authorized root. The public synthetic bucket is for testing only and is too small for reliable AUC estimates.

Why does the starter use invented data?

The --demo option trains on invented in-memory records so you can confirm the setup works. It provides no evidence of clinical performance.

Does the skill replace clinical validation?

No. The skill states that attention weights, DDI penalties and demo results do not establish causal explanation, prescribing safety or deployment readiness.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

This skill suits researchers and developers prototyping clinical prediction models on PyHealth with authorized EHR data, and analysts who need medical code mapping. It is not suitable for patient care or clinical decisions, and general tabular machine learning without a PyHealth dataset is better served by other tools.

Download the skill