Produce the required JSON answer for a synthetic-clinic protocol-bound clinical decision-support task. Use when the input gives a target case id plus an answer_template.json and points at a read-only clinic runtime API (patients, cases, observations, medications, allergies, problems, imaging, care-registry, sdoh, protocols). Covers acute respiratory / CAP, pediatric head injury, potassium replacement, care-management routing, and observation-window retrieval cases. The skill teaches the procedure to fetch the record, select and apply the matching protocol at runtime, and emit one schema-conformant JSON object. It never contains task-specific answer values.
input/prompt.txt — names one target case id (e.g. CASE-...) and, in
prose, which clinical questions the answer must resolve.
input/payloads/answer_template.json — the exact output contract:
the required top-level keys, each field's type, the closed enum
allowed_values, numeric precision, ordering rules, where null is
permitted, and any fixed constants (often task_id, case_id).
A separate environment-access file (e.g. environment_access.md) — the
clinic runtime base URL, credentials (usually none), and the allowed
endpoints for this run.
Your job is to return exactly one JSON object that conforms to the
template, with every value derived from the clinic record by applying the
governing protocol. No prose, no markdown, no extra top-level keys.
The correct answer is always derivable from the target patient's
authoritative records plus the protocol. Do not guess, and do not invent
findings the chart does not support.
Procedure
1. Read the contract first
Parse answer_template.json completely before touching the network. Note, for
every field: the exact key name, type, the closed set of allowed_values
(you may only emit values from these sets), precision (integer vs. N-decimal),
ordering rules ("normalized as a set" vs. "sorted by ..."), nullability, and
any required_value / expected_constant. This is the ground truth for
shape; the environment supplies the content.
Set the fixed constants directly: task_id = the task folder id (e.g.
train_001 / the current task id), case_id = the id from prompt.txt.
2. Load environment access
Read the environment-access file for the base URL and the allowed endpoint
list. Only call endpoints on that list. Do not mutate anything — every task
is read-only (no orders, no POSTs that change state). If a POST /api/query
endpoint is listed but rejects calls for a missing "clinic token" and no token
is provided, treat it as unavailable and use the GET resource endpoints,
which are sufficient.
3. Pull the case bundle
GET /api/cases/{case_id} returns a bundle for the target case:
case — patient_id, case_type, service_date, status, summary.
findings — list of {finding_key, finding_value, source_id}; the
structured clinical narrative (vitals ranges, symptoms present/absent,
current_time, allergy constraints, outreach posture, etc.).
imaging, medications, allergies, problems, sdoh, care_registry
(any may be null/empty).
Fetch GET /api/patients/{patient_id} (and, if useful, the topical list
endpoints such as GET /api/observations) for demographics and fuller context.
4. Select and read the governing protocol
GET /api/protocols lists the protocols; pick the one whose title/scope matches
the case's case_type, then GET /api/protocols/{protocol_id} and read its
body. The protocol body — not your prior knowledge — is authoritative for
thresholds, controlled_codes, authoritative_statuses, follow-up timing,
ordering, dose rules, escalation triggers, and referral criteria.
See reference/api_and_protocols.md for the case_type → protocol map and how
each protocol's fields feed each answer section.
Read protocol constants at runtime; never hardcode them. Applying the
protocol you fetched is what makes the answer correct and keeps the skill
robust if the environment changes.
5. Derive each field, mapping to the template's controlled vocabulary
Work through the template's keys. For each, apply the protocol rule to the
case data, then translate the raw clinical fact into the template's enum. The
protocol's internal code names and the template's allowed_values are
different vocabularies — map deliberately; emit only values the template
allows. Example shape (not an answer): a saturation range in findings
crosses a protocol threshold → choose the corresponding template red-flag /
risk enum, not the protocol's own string.
6. Provenance and distractor discipline
This is where most errors happen. The environment is seeded with decoys.
Target patient only. Use records whose patient_id matches the case's
patient. Silently drop any wrong-patient record — it is not evidence and is
not even a listed distractor.
Authoritative status only. Treat only statuses in the protocol's
authoritative_statuses (typically final) as satisfying gates. Exclude
preliminary / entered-in-error / canceled for authoritative claims.
Right code, right window. Match the target observation code; honor
date windows as the protocol/template state them (commonly from inclusive,
to exclusive).
Latest-wins. When several qualifying same-code results exist, select per
the protocol (usually the latest finaleffective_time in the window).
Where the template asks for excluded/distractor ids, list the same-patient
records that were relevant to review but disqualified by date, code, or
status — sorted as the template directs.
7. Evidence ids
evidence_ids (or source_provenance) must be the real resource ids you
actually relied on — e.g. observation_ids, imaging_id, renal/eGFR
observation ids, the case_id, protocol id — in the order the template
requests (often case id first, then clinical sources; or descending relevance).
Never fabricate ids.
8. Safety-check booleans
Safety-check fields assert you did not put an unsupported claim in the
answer. Set each to reflect the chart, e.g.: do not claim a normal chest X-ray
when imaging shows consolidation; do not recommend a drug class the patient has
an active allergy to; do not assert loss-of-consciousness / vomiting /
photophobia the record marks absent. The boolean is true when your answer
honors that constraint.
9. Format exactly
Emit only the required top-level keys — no extras, no prose.
Enums: only allowed_values. Lists that are "normalized as a set": no
duplicates, order-insensitive. Lists with an ordering rule: sort exactly.
Numbers: honor precision (integer hours/days; N-decimal values). Timestamps:
ISO-8601 UTC with trailing Z.
null only where the field spec permits it; otherwise supply a value.
Output one JSON object and nothing else.
Final checklist
Every required top-level key present; no extra keys.
Every enum value is in the template's allowed_values.
Constants (task_id, case_id, patient_id) correct.
Findings, observations, imaging cross-checked against protocol
thresholds — decision derived, not guessed.
Only target-patient, authoritative-status, in-window, right-code records
used; distractors excluded correctly.
evidence_ids are real ids you used, ordered per the template.
Safety checks honor the chart (no fabricated/normal/contraindicated claims).
Numeric precision, timestamp format, nullability, ordering all match.
Output is a single JSON object with no surrounding text.
1---2name: synthetic-clinic-protocol-answer3description: Produce the required JSON answer for a synthetic-clinic protocol-bound clinical decision-support task. Use when the input gives a target case id plus an answer_template.json and points at a read-only clinic runtime API (patients, cases, observations, medications, allergies, problems, imaging, care-registry, sdoh, protocols). Covers acute respiratory / CAP, pediatric head injury, potassium replacement, care-management routing, and observation-window retrieval cases. The skill teaches the procedure to fetch the record, select and apply the matching protocol at runtime, and emit one schema-conformant JSON object. It never contains task-specific answer values.4---56# Synthetic-clinic protocol answer78## What this task family is910You are given, per task:1112- `input/prompt.txt` — names one **target case id** (e.g. `CASE-...`) and, in13 prose, which clinical questions the answer must resolve.14- `input/payloads/answer_template.json` — the **exact output contract**:15 the required top-level keys, each field's type, the closed **enum16 `allowed_values`**, numeric precision, ordering rules, where `null` is17 permitted, and any fixed constants (often `task_id`, `case_id`).18- A separate environment-access file (e.g. `environment_access.md`) — the19 clinic runtime **base URL**, credentials (usually none), and the **allowed20 endpoints** for this run.2122Your job is to return **exactly one JSON object** that conforms to the23template, with every value derived from the clinic record by applying the24governing protocol. No prose, no markdown, no extra top-level keys.2526The correct answer is always *derivable* from the target patient's27authoritative records plus the protocol. Do not guess, and do not invent28findings the chart does not support.2930## Procedure3132### 1. Read the contract first33Parse `answer_template.json` completely before touching the network. Note, for34every field: the exact key name, type, the closed set of `allowed_values`35(you may only emit values from these sets), precision (integer vs. N-decimal),36ordering rules ("normalized as a set" vs. "sorted by ..."), nullability, and37any `required_value` / `expected_constant`. This is the ground truth for38shape; the environment supplies the content.3940Set the fixed constants directly: `task_id` = the task folder id (e.g.41`train_001` / the current task id), `case_id` = the id from `prompt.txt`.4243### 2. Load environment access44Read the environment-access file for the base URL and the **allowed endpoint45list**. Only call endpoints on that list. Do not mutate anything — every task46is read-only (no orders, no POSTs that change state). If a `POST /api/query`47endpoint is listed but rejects calls for a missing "clinic token" and no token48is provided, treat it as unavailable and use the `GET` resource endpoints,49which are sufficient.5051### 3. Pull the case bundle52`GET /api/cases/{case_id}` returns a bundle for the target case:5354- `case` — `patient_id`, `case_type`, `service_date`, `status`, `summary`.55- `findings` — list of `{finding_key, finding_value, source_id}`; the56 structured clinical narrative (vitals ranges, symptoms present/absent,57 `current_time`, allergy constraints, outreach posture, etc.).58- `observations` — FHIR-like: `observation_id`, `code`, `display`, `status`,59 `effective_time`, `value_number`/`value_text`, `unit`, `interpretation`,60 `patient_id`.61- `imaging`, `medications`, `allergies`, `problems`, `sdoh`, `care_registry`62 (any may be `null`/empty).6364Fetch `GET /api/patients/{patient_id}` (and, if useful, the topical list65endpoints such as `GET /api/observations`) for demographics and fuller context.6667### 4. Select and read the governing protocol68`GET /api/protocols` lists the protocols; pick the one whose title/scope matches69the case's `case_type`, then `GET /api/protocols/{protocol_id}` and read its70`body`. The protocol `body` — not your prior knowledge — is authoritative for71thresholds, `controlled_codes`, `authoritative_statuses`, follow-up timing,72ordering, dose rules, escalation triggers, and referral criteria.73See `reference/api_and_protocols.md` for the case_type → protocol map and how74each protocol's fields feed each answer section.7576**Read protocol constants at runtime; never hardcode them.** Applying the77protocol you fetched is what makes the answer correct and keeps the skill78robust if the environment changes.7980### 5. Derive each field, mapping to the template's controlled vocabulary81Work through the template's keys. For each, apply the protocol rule to the82case data, then translate the raw clinical fact into the template's enum. The83protocol's internal code names and the template's `allowed_values` are84*different vocabularies* — map deliberately; emit only values the template85allows. Example shape (not an answer): a saturation range in `findings`86crosses a protocol threshold → choose the corresponding template red-flag /87risk enum, not the protocol's own string.8889### 6. Provenance and distractor discipline90This is where most errors happen. The environment is seeded with decoys.9192- **Target patient only.** Use records whose `patient_id` matches the case's93 patient. Silently drop any wrong-patient record — it is not evidence and is94 not even a listed distractor.95- **Authoritative status only.** Treat only statuses in the protocol's96 `authoritative_statuses` (typically `final`) as satisfying gates. Exclude97 `preliminary` / `entered-in-error` / `canceled` for authoritative claims.98- **Right code, right window.** Match the target observation `code`; honor99 date windows as the protocol/template state them (commonly `from` inclusive,100 `to` exclusive).101- **Latest-wins.** When several qualifying same-code results exist, select per102 the protocol (usually the latest `final` `effective_time` in the window).103- Where the template asks for excluded/distractor ids, list the same-patient104 records that were relevant to review but disqualified by date, code, or105 status — sorted as the template directs.106107### 7. Evidence ids108`evidence_ids` (or `source_provenance`) must be the **real resource ids you109actually relied on** — e.g. `observation_id`s, `imaging_id`, renal/eGFR110observation ids, the `case_id`, protocol id — in the order the template111requests (often case id first, then clinical sources; or descending relevance).112Never fabricate ids.113114### 8. Safety-check booleans115Safety-check fields assert you did **not** put an unsupported claim in the116answer. Set each to reflect the chart, e.g.: do not claim a normal chest X-ray117when imaging shows consolidation; do not recommend a drug class the patient has118an active allergy to; do not assert loss-of-consciousness / vomiting /119photophobia the record marks absent. The boolean is `true` when your answer120honors that constraint.121122### 9. Format exactly123- Emit **only** the required top-level keys — no extras, no prose.124- Enums: only `allowed_values`. Lists that are "normalized as a set": no125 duplicates, order-insensitive. Lists with an ordering rule: sort exactly.126- Numbers: honor precision (integer hours/days; N-decimal values). Timestamps:127 ISO-8601 UTC with trailing `Z`.128- `null` only where the field spec permits it; otherwise supply a value.129- Output one JSON object and nothing else.130131## Final checklist132- [ ] Every required top-level key present; no extra keys.133- [ ] Every enum value is in the template's `allowed_values`.134- [ ] Constants (`task_id`, `case_id`, `patient_id`) correct.135- [ ] Findings, observations, imaging cross-checked against protocol136 thresholds — decision derived, not guessed.137- [ ] Only target-patient, authoritative-status, in-window, right-code records138 used; distractors excluded correctly.139- [ ] `evidence_ids` are real ids you used, ordered per the template.140- [ ] Safety checks honor the chart (no fabricated/normal/contraindicated claims).141- [ ] Numeric precision, timestamp format, nullability, ordering all match.142- [ ] Output is a single JSON object with no surrounding text.
Run npx skillmds@latest add prism-shadow/synthetic-clinic-protocol-answer in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Produce the required JSON answer for a synthetic-clinic protocol-bound clinical decision-support task. Use when the input gives a target case id plus an answer_template.json and points at a read-only clinic runtime API (patients, cases, observations, medications, allergies, problems, imaging, care-registry, sdoh, protocols). Covers acute respiratory / CAP, pediatric head injury, potassium replacement, care-management routing, and observation-window retrieval cases. The skill teaches the procedure to fetch the record, select and apply the matching protocol at runtime, and emit one schema-conformant JSON object. It never contains task-specific answer values. It is listed under Integrations & APIs on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
prism-shadow (@prism-shadow) published this skill. Their other Agent Skills are listed on their SkillMD profile.