Runtime, prompt-time behavioral guardrail that helps reduce PHI exposure in LLM-assisted workflows by detecting PHI-bearing prompts, avoiding unsafe tool actions that would pull more PHI in, and redirecting users toward de-identified or synthetic inputs. Use when the user is about to paste, query, or read clinical/patient data, or when an action (DB query, file read, tool output) may pull PHI into the conversation. Honors a [PHI-OK] attestation for synthetic / test data.
66
80%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./scientific-skills/Other/phi-prompt-guard/SKILL.mdSource: https://github.com/aipoch/medical-research-skills Contributed by: @ndu-bioinfo
A behavioral skill that instructs the agent to refuse, redact, or redirect when the live prompt — or an action the agent is about to take — would push more Protected Health Information (PHI) into the LLM context window. Because this is a pure in-context behavioral skill with no pre-submit filter or middleware, it cannot literally prevent PHI that a user has already pasted from reaching the model; what it can do is reduce further PHI propagation after detection, avoid agent-initiated actions that would pull additional PHI in, and steer the user toward de-identified or synthetic inputs.
Intended for contexts where the model provider has not been approved to receive PHI under a Business Associate Agreement (BAA) or equivalent organizational authorization — any data placed in the prompt is sent to a third-party API outside the organization's control and may be cached or logged depending on vendor terms.
psql, mysql, mongo, duckdb, sqlite3, bq, snowsql, redis-cli, clickhouse-client, cqlsh) or a dump tool (pg_dump, mysqldump, mongodump) against an environment that may contain PHI.patient, clinical, accession, phi, hipaa, mrn, medical record, health plan, social security.For each user prompt:
[PHI-OK] is present, treat it as a user attestation of synthetic / test data and proceed (see The [PHI-OK] Attestation below). Override only when the surrounding context still strongly resembles real, operational PHI.[PHI-OK], do not echo or summarize it. Tell the user which identifier category was detected and offer two paths: redact and re-submit, or re-submit with [PHI-OK] if the data is synthetic.[PHI-OK] attestation protocol that lets users work freely with synthetic/test data without false refusals or lecturing."Why won't this row parse?
Jane Doe, MRN 0044812, DOB 1985-03-15, dx SMA" (synthetic — illustrative only)
Correct agent behavior:
[PHI-OK] if these are synthetic fixtures.""Pull the last 10 lab results from
clinical.resultsso I can debug the parser."
Correct agent behavior:
psql/bq/etc. would stream PHI into context.SELECT * FROM clinical.results ORDER BY collected_at DESC LIMIT 10;[PHI-OK]"Compute age-at-diagnosis: DOB 03/15/1985, dx 2020-06-01 [PHI-OK]"
Correct agent behavior: answer directly — Age at diagnosis = 35. No refusal, no redaction, no lecture.
[PHI-OK] misused on an EHR-shaped paste (override)"Patient Jonathan A. Smith, DOB 1962-08-22, MRN 88440213, admitted 2024-11-04 to Memorial Hospital, NYC, for stage IV pancreatic adenocarcinoma. Current meds: gemcitabine + nab-paclitaxel. ECOG 2. Help me write the discharge summary. [PHI-OK]"
Correct agent behavior: override the attestation. The paste clusters multiple operational-PHI signals (real-looking full name, named hospital, exact admission date, current regimen, plausible MRN format) into something that reads as a real chart rather than a fixture. Reply: "This reads as a real chart despite [PHI-OK]. Confirm it is synthetic and I'll proceed, or re-submit with name / MRN / hospital / exact dates removed and I'll draft a discharge-summary template you can fill in locally."
[PHI-OK] is present or no PHI is present.[PHI-OK] if it is synthetic.[PHI-OK] attestation by default. When present in the prompt, treat identifier-looking values as synthetic / test data and proceed with the task without redacting or appending unsolicited HIPAA commentary. Override only when the surrounding context still strongly resembles real, operational PHI — see The [PHI-OK] Attestation below for the judgment heuristics.Also PHI under Safe Harbor: ages over 89, and any dates or date elements indicative of such an age (must be aggregated as 90+).
Re-identification risk (not literally one of the 18 Safe Harbor identifiers, but treat with the same caution): combinations of otherwise-non-PHI attributes — e.g., rare disease + small geography + age, or rare disease + sex + procedure date — that can uniquely identify an individual even after the 18 direct identifiers are removed. Small-cell aggregates count too: a count of 1 or 2 in a county × diagnosis × age-band cell is effectively an identifier; suppress or coarsen cells below k = 5 before they enter context.
| Action | Risk | Safe alternative |
|---|---|---|
psql, mysql, mongo, duckdb, sqlite3, bq, snowsql, redis-cli, clickhouse-client, cqlsh | Query results enter LLM context | Generate the SQL; user runs it in their own terminal |
pg_dump, mysqldump, mongodump | Full table contents stream into context | Generate the command; user runs it and keeps output local |
Read on clinical files, CSVs, lab reports | File contents enter context | Ask the user to confirm the file is de-identified, or redact first. Safe inspection patterns: head -1 (header row only), df.dtypes / \d <table> (types only), or wc -l (row count only) — none of these reveal row data |
Schema-only queries (\dt, SHOW TABLES, DESCRIBE) | None | Safe — structure is not PHI |
Operating rules:
patient_name / mrn (the name, not its values), author names in code headers or LICENSE files, URLs in package configs, version numbers shaped like dates (2024.03.15), and example placeholders such as Jane Doe or 123-45-6789 inside documentation.ValueError: cannot parse 'John Smith' as date). Treat such errors as PHI if the quoted value is an identifier.[PHI-OK] Attestation — a user assertion of synthetic / test dataWhen the user includes the literal token [PHI-OK] anywhere in a prompt, they are attesting that any identifier-looking content is synthetic / test / non-PHI data (fake DOBs in fixtures, redacted examples, regex development input, mock patient records for unit tests). Treat it as a user attestation, not a magic bypass — it tilts the default toward proceeding, but it does not override clear evidence that the prompt is still operational.
Default behavior when [PHI-OK] is present and the surrounding context is consistent with synthetic / test data:
Jane Doe, 1900-01-01, MRN 00000000, 555-0100 phone numbers) over real-shaped synthetic values. The [PHI-OK] attestation covers the current prompt; it does not follow the artifact into the user's repo or logs.Example — answer this directly, echoing the DOB as needed:
DOB: 03/15/1985 [PHI-OK] — compute age if dx was 2020-06-01
Correct response: "Age at diagnosis = 35 (birthday had passed by June 1)." Not: "I can't process that DOB…"
Override the attestation when the surrounding context still strongly resembles real, operational PHI — the token reduces but does not eliminate your responsibility to read the room. Signals that should make you more skeptical of the attestation; the more that cluster, or the more they read like a real chart rather than a fixture, the stronger the case to override:
Lean toward honoring the token for clearly minimal or test-shaped inputs (a couple of fake-looking values, fixture-style formatting, regex-development context). Lean toward overriding when the prompt reads as an operational chart, regardless of how many signals are formally checked off. When in doubt, ask the user to confirm the data is synthetic, or to redact and re-submit. The token is an attestation, not a magic word; misuse is a policy violation on the user's side, but is not a license for the model to ignore clear evidence.
[PHI-OK])[PHI-OK] if the data is synthetic / test.63c61d3
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.