tlf-shells¶
Generate numbered table, listing and figure shells and a tlf_index.csv from a statistical analysis plan, with placeholders only and AE tables by SOC and PT, then check numbering and that every SAP analysis has a shell. Use before programming TLFs.
| Stage | Clinical data |
| Tier | 2 (template and rubric) |
| Standards | ICH E3, ICH E9, CDISC ADaM |
Minimum pharmaskills |
0.4.0 |
| Inputs | sap, adam dataset names, treatment arms |
| Outputs | tlf shells docx, tlf index csv, tlf shell check json |
| Verified by | protocol check-tlf-shells, docs build |
Draft for qualified review. Not a validated system and not 21 CFR Part 11 compliant.
Install only this skill: pharmaskills skills install --agent claude-code --skill tlf-shells (see Install).
Purpose¶
Give programmers and statisticians a numbered set of table, listing and figure shells derived from the SAP, with an index file that other tools can read. The shells show layout and placeholders only: they define what will be produced, not results.
When to use / when not to use¶
Use after the SAP is drafted (see sap-writer) and before TLF programming, or to check an
existing shell set against a revised SAP. The index feeds the number trace in csr-e3.
Do not use to produce results, to populate shells with example numbers, to design new analyses (that is the SAP), or for patient profiles and dashboards. Never invent values.
Inputs¶
Required: the SAP (DOCX or Markdown) with planned outputs written as Table 14.n.n Title
(population) (also Listing and Figure) or [TLF: 14.n.n] markers, the treatment arm labels
and the ADaM dataset names. Ask once, in one message, for what is missing, then proceed with
stated assumptions and [DATA NEEDED: ...] placeholders (dictionary versions, sponsor
standards). State the region assumed (default US with FDA expectations; ICH E3 section 14
conventions are region independent).
If pharmaskills is not installed, say so (uv tool install pharmaskills), draft from
templates/tlf_shell.md, and mark the numbering check as not run. Check pharmaskills
--version is at least min_pharmaskills.
Workflow¶
- Extract planned outputs from the SAP: every
Table,ListingorFigurereference and[TLF: ...]marker, with title, population and SAP section. - Assign shell layouts by category using
references/shell-conventions.md: demographics, disposition, exposure, AE overview, AE by SOC and PT, efficacy model tables, sensitivity, figures, listings. Numbers equal the SAP numbers; numbering is unique. - Write
out/tlf_shells.md: one section per output with population, source dataset, SAP section, a placeholder table and a programming note. AE by SOC and PT shells carrySOCandPTrows with placeholders. - Write
out/tlf_index.csv(table_id,type,title,population,source_dataset,sap_section, file). - Build and banner.
pharmaskills docs build out/tlf_shells.md --out out/tlf_shells.docx --title "..." --skill tlf-shells, thenpharmaskills docs banner --apply out/tlf_shells.md. - Verify.
pharmaskills protocol check-tlf-shells out/tlf_index.csv --sap SAP --shells out/tlf_shells.docx --out out/tlf_shell_check.jsonmust exit 0. Exit 2 lists duplicates, SAP analyses without a shell, and AE shells lacking SOC or PT placeholders. - Report the number of shells, any SAP analysis not covered and open placeholders.
Output contract¶
Under out/:
| File | Content |
|---|---|
tlf_shells.docx, tlf_shells.md |
Numbered shells with placeholders, draft banner, provenance |
tlf_index.csv |
One row per output: id, type, title, population, source dataset, SAP section |
tlf_shell_check.json |
Report of protocol check-tlf-shells |
Verification¶
Report pass or fail: the checker exited 0; numbering is unique; every SAP analysis has a
shell (the SAP planned-table list and [TLF: ...] markers are the definition); every id in the
index appears in the shell document; every AE-by-SOC-and-PT shell has SOC and PT
placeholders; shells hold placeholders, no numeric results; the draft banner is present. Fit of
layout to sponsor standards is a documented review item for the programming lead.
Guardrails¶
- Never fabricate data, numbers, citations or identifiers; unknowns are placeholders.
- Insert the draft banner and a provenance block.
- Never populate a shell with real or invented results, counts, p-values or identifiers
(including NCT numbers); unknowns are
[DATA NEEDED: ...]. - Do not add outputs the SAP does not plan; propose SAP changes instead.
- Cite ICH E3 section 14 for numbering conventions and flag any sponsor standard as
[DATA NEEDED: sponsor TLF standard]. - State the region assumed.
References¶
references/shell-conventions.md- numbering, layout, index columns- Public sources: ICH E3 section 14 (tables, figures and graphs referred to in the text), ICH E9, CDISC ADaM implementation guide.
Templates: templates/tlf_shell.md. Scripts: scripts/check_shells.sh.
Examples¶
Worked example: examples/clinical-data/tlf-shells/ (synthetic study PSK-001 and the PSK-201
SAP from sap-writer). Cases: skills/tlf-shells/evals/cases/.
Worked example¶
Committed example with inputs and outputs: examples/clinical-data/tlf-shells/.
Shells for two synthetic SAPs. No results appear anywhere: cells are placeholders.
Inputs¶
skills/tlf-shells/evals/fixtures/sap.docx: SAP of synthetic study PSK-001 (4 planned tables);fixtures/tlf/holds that study's synthetic output index and tables.skills/tlf-shells/evals/fixtures/sap_psk201.md: the SAP drafted bysap-writer(13 outputs including efficacy, a figure and two listings).
Outputs (out/)¶
| File | How it was made |
|---|---|
tlf_shells.docx, tlf_shells.md, tlf_index.csv |
PSK-001 shells and index |
tlf_shells_psk201.docx, .md, tlf_index_psk201.csv |
PSK-201 shells and index |
tlf_shell_check.json, tlf_shell_check_psk201.json |
Real output of pharmaskills protocol check-tlf-shells |
refusal_populate_shells.md |
Sample correct response to a request for invented numbers |
Reproduce¶
pharmaskills protocol check-tlf-shells out/tlf_index.csv --sap fixtures/sap.docx \
--shells out/tlf_shells.docx
Skill source: skills/tlf-shells/SKILL.md