Skip to content

csr-e3

Draft clinical study report sections structured to ICH E3 from a protocol, SAP and TLF outputs, with every number traced to its source table. Use when asked to write, check or restructure a CSR or a CSR section.

Stage Regulatory
Tier 1 (deterministic tool)
Standards ICH E3, ICH E3 Q&A R1, ICH E9, ICH E6(R3)
Minimum pharmaskills 0.3.0
Inputs protocol, sap, tlf outputs
Outputs csr sections docx, trace report json, structure report json
Verified by docs trace-numbers, docs check-structure --standard ich-e3, docs detect-pii

Draft for qualified review. Not a validated system.

Install only this skill: pharmaskills skills install --agent claude-code --skill csr-e3 (see Install).

Purpose

Produce a draft of clinical study report (CSR) sections for a medical writer: structured to the ICH E3 section list, written from the protocol, the SAP and the TLF outputs, with every number linked to the table it came from. Untraceable numbers are flagged, never invented, and sections with no source become [DATA NEEDED: ...] placeholders. Everything is a draft for review by a medical writer, biostatistician and QA.

When to use / when not to use

Use to draft or restructure CSR sections (synopsis, design, populations, efficacy, safety, discussion), to check an existing CSR draft against ICH E3 (structure and numbers), or to build a present-or-missing checklist of E3 sections.

Do not use for: final submission documents without medical writer and QA review, results that have no supplied TLF (leave a placeholder), interpretation that needs medical judgement beyond the tables, or real patient data that has not been de-identified. Individual patient narratives are out of scope without a vetted source.

Inputs

Required: protocol (DOCX), SAP (DOCX) and TLF outputs (CSV, DOCX, RTF, text; PDF when pypdf is installed), ideally with a tlf_index.csv (table_id, title, file, population). Optional: earlier CSR draft, ICH E3 section plan from the sponsor template.

Ask once for anything missing, then proceed with stated assumptions and [DATA NEEDED: ...] placeholders. State the region assumed (US FDA with ICH E3 unless told otherwise). If pharmaskills is not installed, tell the user to run uv tool install pharmaskills, check pharmaskills --version against min_pharmaskills, and produce the section skeleton only, with placeholders and marked unverified (no number checking was possible).

Workflow

  1. Index the sources. List protocol sections, SAP sections and TLF tables (table id, title, population, file). Run pharmaskills docs detect-pii <folder> and warn if identifiers appear.
  2. Plan sections. Use the E3 list in references/e3-sections.md: every required section gets a heading numbered and titled as in E3. Decide for each whether a source exists.
  3. Draft. Fill sections from templates/csr-section.md. Quote numbers exactly as printed in a table, with the table id in the sentence ("Table 14.3.1"). Do not compute, round or derive new numbers, including percentages, unless a table prints them. Describe, do not interpret beyond the SAP. Sections without a source: write [DATA NEEDED: <what is missing>], never plausible text.
  4. Build the document. Write Markdown and build DOCX with the deterministic builder (pharmaskills.docs.builders.build_docx, or pharmaskills docs banner --apply on an existing file) so the draft banner and provenance block are inserted.
  5. Trace numbers. pharmaskills docs trace-numbers out/csr_sections.docx --tlf <tlf-folder> --out out/trace_report.json. Exit 2 means untraceable numbers: fix the text or the source reference (never edit the table) and rerun.
  6. Check structure. pharmaskills docs check-structure out/csr_sections.docx --standard ich-e3 --out out/structure_report.json. List missing required sections with their citation.
  7. Repair loop (maximum 3 iterations). Fix, rebuild, rerun steps 5 and 6. Report what remains.
  8. Report using the output contract below.

Output contract

Under out/:

File Content
csr_sections.docx (and .md) Draft sections with draft banner and provenance block
trace_report.json Every number with its source table, file and cell; untraceable list
structure_report.json Present, missing required, missing optional, out-of-order sections

State plainly in the answer: sections drafted versus placeholders, counts of traced and untraceable numbers, structure result, assumptions and what needs a human (medical review, missing TLFs, signatories).

Verification

Run and report pass or fail for each: docs trace-numbers (zero untraceable, zero inconsistent percentages), docs check-structure --standard ich-e3 (zero missing required sections), banner present. Acceptance on the synthetic benchmark PSK-001: every safety number traces to Table 14.3.1 or 14.3.2, an injected untraceable number returns exit 2, and a missing efficacy TLF yields a placeholder. On failure fix and rerun up to three times, then report what remains. A traced number only means the value appears in a table; it does not prove the sentence interprets it correctly, so a reviewer must read each claim.

Guardrails

  • Insert the draft banner in every generated document; never claim the CSR is final, validated or ready for submission.
  • Never fabricate numbers, NCT identifiers, PMIDs, citations, study data or statistical results. An untraceable number is flagged and removed, not adjusted.
  • Never write efficacy conclusions without efficacy TLFs; never state causality that the tables do not support. Medical review is required for the safety conclusions (E3 12.6).
  • Cite ICH E3 by section when explaining structure (see references/).
  • Warn when inputs look like real patient data; recommend de-identification.
  • Degrade gracefully: no network is needed; without the tools package, template-only output.

References

  • references/e3-sections.md - E3 section list, what each needs, typical sources
  • references/number-tracing.md - what trace-numbers checks, exclusions, limits
  • Public sources: ICH E3 (Structure and Content of Clinical Study Reports) and E3 Q&A (R1), ICH E9 (Statistical Principles), ICH E6(R3). https://database.ich.org

Templates: templates/csr-section.md. Script: scripts/check_csr.sh (thin wrapper around the two pharmaskills docs checks).

Examples

Worked example with inputs and outputs: examples/regulatory/csr-e3/. Synthetic inputs: skills/csr-e3/evals/fixtures/ (protocol, SAP, four TLF tables, a draft with a planted error).

Worked example

Committed example with inputs and outputs: examples/regulatory/csr-e3/.

Inputs (synthetic study PSK-001): skills/csr-e3/evals/fixtures/ with protocol.docx, sap.docx and tlf/ (Tables 14.1.1, 14.1.2, 14.3.1, 14.3.2).

pharmaskills docs trace-numbers out/csr_sections.docx --tlf fixtures/tlf --out out/trace_report.json
pharmaskills docs check-structure out/csr_sections.docx --standard ich-e3 --out out/structure_report.json
File in out/ Origin
csr_sections.docx, csr_sections.md drafted by the agent, built with pharmaskills.docs.builders.build_docx (draft banner, provenance)
trace_report.json, structure_report.json tool output of the two commands above
refusal_*.md what a correct agent says for the adversarial cases

Sections without a supplied source (efficacy, extent of exposure, laboratory, narratives) are [DATA NEEDED: ...] placeholders, never invented text. Synthetic data only. Not a validated system; for qualified review (medical writer and QA).

Skill source: skills/csr-e3/SKILL.md