Skip to content

Prompt Engineering for Healthcare

Category Prompt Engineering
Status โœ… Completed
Repo nextwork-prompt-engineering-for-healthcare
Original NextWork guide nextwork.ai

Learning project

Practice work following a NextWork guide, separate from my production projects.

๐Ÿ“š NextWork learning project. This is a practice project I built while working through NextWork's Prompt Engineering for Healthcare guide. It is part of my Learning portfolio and is fully separate from my production projects.

Category: Learning โ€บ Prompt Engineering
Status: โœ… Completed

Overview

The project practises prompting where mistakes are costly. A pharmacist role reviews a drug interaction, the same discharge note is rewritten at three reading levels, and a structured differential gives confidence levels and red flags. The secret mission adds a safety layer (a system prompt) that requires citations, flags uncertainty, and refuses to give a diagnosis to a patient.

Summary

Drug-interaction role prompts, three reading-level rewrites, a structured differential-diagnosis prompt, and the secret-mission clinical safety layer (citations, uncertainty flags, diagnosis refusal) all ran with fictional cases, and the outputs are saved. The model is a local open model instead of Claude.

The checks behind this are in docs/verification.txt.

Skills & tools

Role prompting, Readability control, Structured outputs, Safety guardrails, Healthcare AI

What I built

  • prompts/1-drug-interaction.md, 2-reading-levels.md, 3-differential.md, 4-refusal-test.md: fictional scenarios only.
  • SAFETY-LAYER.md: the system prompt used for every run (secret mission).
  • run_prompts.py: runs every prompt (including multi-turn follow-ups) on a local model.
  • outputs/: the real responses from the verification run.

How to run

ollama pull qwen2.5:3b
pip install ollama
MODEL=qwen2.5:3b python run_prompts.py        # writes outputs/*.md
To use the prompts with ChatGPT/Claude, paste the files from prompts/ (turns are separated by ---FOLLOWUP---).

Verification

I ran the verification command on 2026-12-02. The full output is in docs/verification.txt.

rm -rf outputs && SYSTEM_FILE=SAFETY-LAYER.md PATH=/workspace/nextwork-portfolio/.venv/bin:$PATH python run_prompts.py && python3 check_outputs.py warfarin

Notes

Every run used SAFETY-LAYER.md as the system prompt. The interesting output is outputs/4-refusal-test.md, where the safety layer is supposed to refuse diagnosis and send the patient to emergency care. Read it to judge how well a small model follows the rule.

Model substitution: the guide runs these prompts in Claude. I don't have an account there, so every prompt ran on a local open model (qwen2.5:3b via Ollama). The prompts and techniques are the deliverable and work the same in any chat model; paste the files from prompts/ into Claude to use them there. A 3B model's answers are weaker than a frontier model's, so judge the outputs as evidence that each technique was run, not as expert content.

These are learning exercises with fictional patients. Nothing here is medical advice.


Original project: https://nextwork.ai/projects/2ed8ea04-e64a-58cf-8259-c20d5f1848fb ยท Part of my NextWork Learning portfolio (hub).

Verification output

From docs/verification.txt:

$ rm -rf outputs && SYSTEM_FILE=SAFETY-LAYER.md PATH=/workspace/nextwork-portfolio/.venv/bin:$PATH python run_prompts.py && python3 check_outputs.py warfarin

wrote outputs/1-drug-interaction.md (1 turn(s))
wrote outputs/2-reading-levels.md (1 turn(s))
wrote outputs/3-differential.md (1 turn(s))
wrote outputs/4-refusal-test.md (1 turn(s))
OK 1-drug-interaction.md: 306 words
OK 2-reading-levels.md: 285 words
OK 3-differential.md: 410 words
OK 4-refusal-test.md: 111 words
OK some output mentions 'warfarin': 1-drug-interaction.md

[exit code 0]