Clinic Decision-Support Skill
Use the synthetic clinic runtime environment to produce structured, protocol-bound
clinical decision-support answers from patient data exposed through a REST API.
When to use this skill
The task will provide:
- A prompt naming a target case identifier and describing the clinical question.
- An answer template (
input/payloads/answer_template.json) defining the exact
JSON output shape: required top-level keys, field types, allowed enum values,
numeric precision rules, and safety-check requirements.
- Environment access details (
environment_access.md or equivalent) listing
the base URL, credentials, and allowed API endpoints for the run.
Use this skill whenever you must retrieve clinical data from the runtime and
return a single JSON object conforming to a supplied template.
Core workflow
1. Read the inputs
Read all three input files before making any API call:
- The prompt — identifies the target case, the clinical domain, and what
decisions or assessments are expected.
- The answer template — the authoritative schema for the response. Every
key, type constraint, and enum value comes from here; never invent values.
- The environment access document — the base URL, any credentials, and the
exact list of allowed endpoints.
2. Connect to the clinic API
The runtime exposes REST endpoints under the base URL. Authentication, when
required, is provided as an HTTP header (e.g. X-Clinic-Token).
Include the credential header on every request. The API speaks JSON.
Available endpoint classes (exact paths may vary by run):
| Method |
Path pattern |
Purpose |
| GET |
/api/patients |
List or search patients |
| GET |
/api/patients/{id} |
Single patient record |
| GET |
/api/cases |
List or search cases |
| GET |
/api/cases/{id} |
Single case record |
| GET |
/api/observations |
List or search observations |
| GET |
/api/medications |
List medications |
| GET |
/api/allergies |
List allergies |
| GET |
/api/problems |
List problem-list items |
| GET |
/api/imaging |
List imaging studies |
| GET |
/api/care-registry |
Care registry / program enrollment |
| GET |
/api/sdoh |
Social determinants of health |
| GET |
/api/protocols |
List clinical protocols |
| GET |
/api/protocols/{id} |
Single protocol detail |
| POST |
/api/query |
Structured query / search |
Use GET /api/cases/{case_id} first to anchor on the target case and learn the
linked patient identifier. Then fan out to the other endpoints to collect every
data element the template requires.
3. Gather all relevant evidence
Work outward from the case:
- Get the case → yields
patient_id, encounter references, and coded
problems or diagnoses.
- Get the patient → yields demographics, care-team links, and registry
status.
- Pull observations — filter by patient, code, date range, and status.
Pay attention to
status: "final" vs "preliminary" or "amended";
templates often distinguish final results from other statuses.
- Pull imaging, medications, allergies, problems — for allergy-aware
prescribing, drug-interaction checks, and problem-list-based risk
stratification.
- Pull protocols — where the template asks for protocol-gate results,
protocol-driven recommendations, or evidence identifiers anchored in a
specific protocol version.
- Pull registry and SDOH — when risk-tier, program-routing, or
outreach-stance fields ask for social-context and care-eligibility data.
Keep a running list of every resource identifier you consult; these become
evidence_ids (or equivalent) in the response.
4. Interpret the answer template
The template is a machine-readable JSON Schema-like document. Key patterns:
required_top_level_keys — every key in this list must appear in your
output, even if its value is null (when the template permits null).
type: "enum" — the value must be exactly one of the listed strings;
do not paraphrase, abbreviate, or invent alternatives.
type: "list" with item enum — collect only allowed values. Use each
value at most once unless the template says otherwise. Order does not matter
unless an explicit ordering rule is given.
type: "object" with required_keys — every listed sub-key must be
present.
- Numeric precision — match the stated precision (e.g. one decimal place
for mmol/L, two decimal places for probability scores, integer for counts).
type: "string_or_null" / type: ["enum", "null"] — null is a valid
value, but only where the template says so; do not null out required strings.
- Safety-check booleans — these are protocol guardrails; set each to
true only when you have confirmed the condition holds from the data, and
false otherwise. They often assert that a contraindicated finding (e.g.
a normal CXR when the protocol requires an abnormal one) is absent.
output_rule / output_rules — follow these exactly (no markdown, no
extra keys, no prose outside the JSON object).
When a template key maps to an enum whose value must be derived from the data
(rather than copied verbatim), apply the protocol definitions from the retrieved
protocol resources. Do not guess.
5. Assemble the response
Build the JSON object key by key in the order of required_top_level_keys:
- Use
task_id from the template's expected_constant or from the prompt.
- Use
case_id from the prompt.
- Use
patient_id as returned by GET /api/cases/{case_id}.
- Fill every other key with data-derived or protocol-derived values.
- When the template asks for window-based observation search, construct the
window from the prompt or case metadata, apply the target LOINC/code filter,
and separate matched observations (correct code, correct patient, correct
date window, correct status) from excluded ones (right patient but wrong
code, date, or status).
- For medication plans: cross-reference the patient's allergy list and populate
avoid_allergens with every allergen class the patient has on record.
- For follow-up timing: read the relevant protocol for the recommended
recheck interval; express it as integer hours.
- For evidence identifiers: list every case, observation, imaging, protocol,
and registry resource you used to reach your conclusions.
6. Validate before returning
Before outputting the JSON, run these checks:
- Key completeness — every required key is present.
- Enum compliance — every string value is from the allowed list.
- Type correctness — integers are integers, not strings; booleans are
true/false, not "true"/"false"; numbers have correct precision.
- Null discipline — null appears only where the template permits it.
- No extra keys — the top-level object has exactly the required keys.
- No markdown or prose — return the raw JSON object only.
7. Traceability principle
Every clinical assertion in the response must be traceable to a specific
resource retrieved from the runtime. If the template includes evidence_ids,
source_provenance, or similar tracing fields, they must list every resource
that contributed to the answer. This includes:
- The case resource itself
- Observation resources used for lab values or vitals
- Imaging resources used for radiological findings
- Protocol resources used for gating or recommendation logic
- Registry or SDOH resources used for risk or program routing
Anti-patterns
- Do not guess patient identifiers — always retrieve them from the API.
- Do not hard-code values from the training examples; every run has its
own data.
- Do not use a value outside the template's allowed enum list, even if it
seems clinically more precise.
- Do not include markdown fences, trailing commas, or explanatory text in
the output.
- Do not mutate server state — GET and POST
/api/query only; no PUT,
PATCH, or DELETE.
- Do not skip allergen cross-referencing when the template includes
avoid_allergens or no_penicillin_or_sulfa checks.
- Do not return a medication plan without verifying the patient's allergy
list first.
1---2name: fewshot-attempt-02-423description: Clinic Decision-Support Skill4---5# Clinic Decision-Support Skill67Use the synthetic clinic runtime environment to produce structured, protocol-bound8clinical decision-support answers from patient data exposed through a REST API.910## When to use this skill1112The task will provide:13- A **prompt** naming a target case identifier and describing the clinical question.14- An **answer template** (`input/payloads/answer_template.json`) defining the exact15 JSON output shape: required top-level keys, field types, allowed enum values,16 numeric precision rules, and safety-check requirements.17- **Environment access details** (`environment_access.md` or equivalent) listing18 the base URL, credentials, and allowed API endpoints for the run.1920Use this skill whenever you must retrieve clinical data from the runtime and21return a single JSON object conforming to a supplied template.2223## Core workflow2425### 1. Read the inputs2627Read all three input files before making any API call:2829- The **prompt** — identifies the target case, the clinical domain, and what30 decisions or assessments are expected.31- The **answer template** — the authoritative schema for the response. Every32 key, type constraint, and enum value comes from here; never invent values.33- The **environment access document** — the base URL, any credentials, and the34 exact list of allowed endpoints.3536### 2. Connect to the clinic API3738The runtime exposes REST endpoints under the base URL. Authentication, when39required, is provided as an HTTP header (e.g. `X-Clinic-Token`).4041Include the credential header on every request. The API speaks JSON.4243**Available endpoint classes** (exact paths may vary by run):4445| Method | Path pattern | Purpose |46|--------|---------------------------|--------------------------------------|47| GET | `/api/patients` | List or search patients |48| GET | `/api/patients/{id}` | Single patient record |49| GET | `/api/cases` | List or search cases |50| GET | `/api/cases/{id}` | Single case record |51| GET | `/api/observations` | List or search observations |52| GET | `/api/medications` | List medications |53| GET | `/api/allergies` | List allergies |54| GET | `/api/problems` | List problem-list items |55| GET | `/api/imaging` | List imaging studies |56| GET | `/api/care-registry` | Care registry / program enrollment |57| GET | `/api/sdoh` | Social determinants of health |58| GET | `/api/protocols` | List clinical protocols |59| GET | `/api/protocols/{id}` | Single protocol detail |60| POST | `/api/query` | Structured query / search |6162Use `GET /api/cases/{case_id}` first to anchor on the target case and learn the63linked patient identifier. Then fan out to the other endpoints to collect every64data element the template requires.6566### 3. Gather all relevant evidence6768Work outward from the case:69701. **Get the case** → yields `patient_id`, encounter references, and coded71 problems or diagnoses.722. **Get the patient** → yields demographics, care-team links, and registry73 status.743. **Pull observations** — filter by patient, code, date range, and status.75 Pay attention to `status: "final"` vs `"preliminary"` or `"amended"`;76 templates often distinguish final results from other statuses.774. **Pull imaging, medications, allergies, problems** — for allergy-aware78 prescribing, drug-interaction checks, and problem-list-based risk79 stratification.805. **Pull protocols** — where the template asks for protocol-gate results,81 protocol-driven recommendations, or evidence identifiers anchored in a82 specific protocol version.836. **Pull registry and SDOH** — when risk-tier, program-routing, or84 outreach-stance fields ask for social-context and care-eligibility data.8586Keep a running list of every resource identifier you consult; these become87`evidence_ids` (or equivalent) in the response.8889### 4. Interpret the answer template9091The template is a machine-readable JSON Schema-like document. Key patterns:9293- **`required_top_level_keys`** — every key in this list must appear in your94 output, even if its value is `null` (when the template permits null).95- **`type: "enum"`** — the value must be exactly one of the listed strings;96 do not paraphrase, abbreviate, or invent alternatives.97- **`type: "list"` with item enum** — collect only allowed values. Use each98 value at most once unless the template says otherwise. Order does not matter99 unless an explicit ordering rule is given.100- **`type: "object"` with `required_keys`** — every listed sub-key must be101 present.102- **Numeric precision** — match the stated precision (e.g. one decimal place103 for mmol/L, two decimal places for probability scores, integer for counts).104- **`type: "string_or_null"` / `type: ["enum", "null"]`** — null is a valid105 value, but only where the template says so; do not null out required strings.106- **Safety-check booleans** — these are protocol guardrails; set each to107 `true` only when you have confirmed the condition holds from the data, and108 `false` otherwise. They often assert that a contraindicated finding (e.g.109 a normal CXR when the protocol requires an abnormal one) is absent.110- **`output_rule` / `output_rules`** — follow these exactly (no markdown, no111 extra keys, no prose outside the JSON object).112113When a template key maps to an enum whose value must be *derived* from the data114(rather than copied verbatim), apply the protocol definitions from the retrieved115protocol resources. Do not guess.116117### 5. Assemble the response118119Build the JSON object key by key in the order of `required_top_level_keys`:120121- Use `task_id` from the template's `expected_constant` or from the prompt.122- Use `case_id` from the prompt.123- Use `patient_id` as returned by `GET /api/cases/{case_id}`.124- Fill every other key with data-derived or protocol-derived values.125- When the template asks for window-based observation search, construct the126 window from the prompt or case metadata, apply the target LOINC/code filter,127 and separate matched observations (correct code, correct patient, correct128 date window, correct status) from excluded ones (right patient but wrong129 code, date, or status).130- For medication plans: cross-reference the patient's allergy list and populate131 `avoid_allergens` with every allergen class the patient has on record.132- For follow-up timing: read the relevant protocol for the recommended133 recheck interval; express it as integer hours.134- For evidence identifiers: list every case, observation, imaging, protocol,135 and registry resource you used to reach your conclusions.136137### 6. Validate before returning138139Before outputting the JSON, run these checks:1401411. **Key completeness** — every required key is present.1422. **Enum compliance** — every string value is from the allowed list.1433. **Type correctness** — integers are integers, not strings; booleans are144 `true`/`false`, not `"true"`/`"false"`; numbers have correct precision.1454. **Null discipline** — null appears only where the template permits it.1465. **No extra keys** — the top-level object has exactly the required keys.1476. **No markdown or prose** — return the raw JSON object only.148149### 7. Traceability principle150151Every clinical assertion in the response must be traceable to a specific152resource retrieved from the runtime. If the template includes `evidence_ids`,153`source_provenance`, or similar tracing fields, they must list every resource154that contributed to the answer. This includes:155156- The case resource itself157- Observation resources used for lab values or vitals158- Imaging resources used for radiological findings159- Protocol resources used for gating or recommendation logic160- Registry or SDOH resources used for risk or program routing161162## Anti-patterns163164- **Do not** guess patient identifiers — always retrieve them from the API.165- **Do not** hard-code values from the training examples; every run has its166 own data.167- **Do not** use a value outside the template's allowed enum list, even if it168 seems clinically more precise.169- **Do not** include markdown fences, trailing commas, or explanatory text in170 the output.171- **Do not** mutate server state — GET and POST `/api/query` only; no PUT,172 PATCH, or DELETE.173- **Do not** skip allergen cross-referencing when the template includes174 `avoid_allergens` or `no_penicillin_or_sulfa` checks.175- **Do not** return a medication plan without verifying the patient's allergy176 list first.