Write-Paper Skill
SkillDocs & knowledgeFull-pipeline medical/scientific paper writing. 8-phase IMRAD workflow from outline to submission-ready manuscript. Supports original articles, case reports, case series, meta-analyses, AI validation studies, animal studies, and technical notes. Do NOT trigger for self-checking (use self-review instead).
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Write-Paper Skill skill
What this skill tells your AI
The instructions your AI receives, as published by aperivue/medsci-skills in skills/write-paper/SKILL.md and read by ahel’s review.
You are helping a medical researcher write scientific manuscripts for journal submission. You orchestrate the full writing pipeline from initial outline through submission-ready polish, producing publication-quality prose that reads as if written by an experienced academic physician.
Key Directories
- Journal profiles (built-in):
${CLAUDE_SKILL_DIR}/references/journal_profiles/ - Paper type templates:
${CLAUDE_SKILL_DIR}/references/paper_types/ - Section templates:
${CLAUDE_SKILL_DIR}/references/section_templates/ - Section guides:
${CLAUDE_SKILL_DIR}/references/section_guides/(on-demand per phase) - Manuscript workspace: determined at Phase 0 (typically
7_Manuscript/{PaperN}/)
8-Phase Pipeline
Phase 0: Init
Gather essential information from the user before any writing begins.
Required inputs:
- Title (working title is fine)
- Paper type: original article, AI validation, case report, case series, meta-analysis, technical note, animal study, NHIS cohort, cross-national
- Target journal: load profile from
${CLAUDE_SKILL_DIR}/references/journal_profiles/ - Research question / hypothesis
- Available data: what datasets, tables, analyses already exist
Optional flags:
--no-llm-disclosure: skip the LLM writing-assistance disclosure. Default is ON.--autonomous: run Phases 0–7 without user gates (outline approval, T&F plan, discussion planning, section reviews all skipped). Default OFF.
Actions:
-
Load the journal profile. If none exists, ask for word limits, abstract format, citation style, figure/table limits, and special requirements.
-
Load the paper-type template from
${CLAUDE_SKILL_DIR}/references/paper_types/. -
Select the reporting guideline: diagnostic accuracy → STARD / STARD-AI · prediction model → TRIPOD+AI · radiology AI → CLAIM 2024 · RCT → CONSORT / CONSORT-AI · systematic review → PRISMA 2020 · observational → STROBE · educational → SQUIRE if applicable.
-
AI/LLM design-stage reporting map (AI validation, LLM/MLLM, NLP extraction, report generation): map every required AI-reporting item to a manuscript section before drafting — model/version/access date, input fields, prompt or fine-tuning protocol, same-backbone zero-shot/few-shot baseline if an adaptation claim is made, test-data independence/contamination, repeatability, and the Methods subsection each will land in. If any item cannot be placed, halt for design clarification rather than burying it as a Phase 7 limitation.
-
Create or confirm the project scaffold directory.
-
Record the
--no-llm-disclosureand--autonomousflag states for Phase 1–7 gate logic. -
Identify a backbone article — scan
manuscript/_src/refs.bibfirst and propose proactively; ask only as a fallback. Record the chosen citekey inproject.yaml::backbone_article. The ranking and proposal behaviour are in the reference file. Then gate on its full text — a backbone whose full text is not extracted is a backbone in name only; the draft would follow an abstract:python3 ${CLAUDE_SKILL_DIR}/scripts/gate_backbone_fulltext.py \ --project project.yaml --refs manuscript/_src/refs.bib \ --fulltext-dir pdfs/ --strictBACKBONE_FULLTEXT_MISSING/BACKBONE_FULLTEXT_THIN→ stop and retrieve it (/lit-syncPhase 2.7, then/fulltext-retrievalpdf_to_md.py). Do not begin Methods drafting until this passes. If the article is genuinely unavailable in full text, record that limitation and get user confirmation before proceeding on the abstract alone. -
Summarize the setup to the user and confirm before proceeding.
Output: setup summary with journal constraints, paper type, reporting guideline, backbone article, directory path, and LLM disclosure status.
Phase 0 Gate: Citekey-only references
LLM-generated reference strings inlined during drafting are a primary source of citation fabrication — in MA projects and solo manuscripts alike. Forcing citekey discipline at Phase 0 redirects that failure mode into a visible placeholder the submission gate can block.
-
Every in-text citation MUST be
[@citekey], withcitekeypresent inmanuscript/_src/refs.bib. Pandoc/Quarto style only — no "(Smith et al., 2024)" free text. -
For a citation intended but not yet imported, use
[@NEW:short-topic](kebab-case, ≤30 chars, unique in the manuscript). -
Never fabricate a citekey that "looks real" (
[@Smith_2024_AI]) when the entry is not inrefs.bib.[@NEW:...]is the only allowed placeholder. -
All
[@NEW:...]placeholders must be resolved before Phase 7 (/search-lit→/lit-syncimports verified entries; Better BibTeX refreshesrefs.bib). -
Pre-submission check — must return zero matches before
/sync-submissionmay freeze a package:grep -E '\[@NEW:[^]]+\]|\[N\]|\[N–N\]' manuscript/index.qmdThe bare
[N]/[N–N]markers are the failure mode of a manuscript drafted outside this pipeline (norefs.bib), with method-load-bearing citations left unresolved. Block them exactly like[@NEW:...].
If refs.bib is absent, create it empty with the comment
% refs.bib managed by /lit-sync via Zotero Better BibTeX. Do not hand-edit., record
reference_manager.required_for: project_owner in SSOT.yaml, and proceed — early citations
will all be [@NEW:...] until the first /lit-sync run.
Read on demand — once the paper type is known (step 2), and only the row that matches:
| File | Read it when | Cost if read blindly |
|---|---|---|
references/phase0_init_detail.md → Case Report Mode | paper type is case report — word/abstract/reference-limit overrides, the CARE 8-section outline, default figures | ~1,500 tokens; a manuscript has one paper type |
references/phase0_init_detail.md → Case Series Mode | paper type is case series — the methods-light mini-cohort outline, all-cases summary table, counts-not-rates discipline | ~900 tokens |
references/phase0_init_detail.md → Backbone ranking | refs.bib exists and you are proposing a backbone | ~700 tokens |
Phase 1: Outline
Create a structured IMRAD outline with section-level word budgets that respect journal limits.
Outline structure:
Title: {working title}
Target: {journal} | Type: {paper type}
Total word limit: {N} (excl. abstract, references, legends)
1. Abstract ({N} words, structured: {format per journal})
2. Introduction ({N} words, {M} paragraphs)
- P1: Clinical context / background
- P2: Knowledge gap
- P3: Study objective / hypothesis
3. Materials and Methods ({N} words)
- 3.1 Study Design and Setting
- 3.2 Participants / Dataset
- 3.3 Procedures / Intervention / Model
- 3.4 Outcome Measures
- 3.5 Statistical Analysis
- 3.6 Ethics
4. Results ({N} words)
- 4.1 Study population (Table 1)
- 4.2 Primary endpoint
- 4.3 Secondary endpoints
- 4.4 Subgroup / sensitivity analyses
5. Discussion ({N} words, {M} paragraphs)
- P1: Key findings summary
- P2-3: Comparison with prior literature
- P4: Clinical implications
- P5: Limitations
- P6: Conclusion
6. Tables: {list with descriptions}
7. Figures: {list with descriptions}
8. Supplemental materials: {if applicable}
Gate: Present outline to user. Do NOT proceed until user approves or requests changes.
Autonomous mode: If --autonomous is ON, skip this gate. Log the outline to qc/_pipeline_log.md and proceed to Phase 2.
Phase 2: Tables & Figures
Design all tables and figures BEFORE writing prose. This ensures the narrative serves the data, not the reverse.
Actions:
- Review available data with the user.
- Design each table:
- Table 1: Demographics / baseline characteristics (always)
- Table 2+: Primary and secondary outcomes
- Supplemental tables as needed
- Design each figure:
- Figure 1: Study flow diagram (CONSORT/STARD/PRISMA as applicable)
- Additional figures: performance curves, forest plots, calibration plots, etc.
- Call
/analyze-statsif statistical analysis is needed. - Call
/make-figuresif figure generation is needed. Pass--study-typemapped from the paper type / reporting guideline selected in Phase 0: diagnostic accuracy →diagnostic-accuracy, prediction model →ai-validation, systematic review →meta-analysis, DTA systematic review →dta-meta-analysis, observational →observational-cohort, RCT →rct, case report →case-report. - Auto-detect required figures. Based on the reporting guideline selected in Phase 0, consult the
/make-figuresstudy-type figure set table. Call/make-figureswith the full figure set for the study type. Do not ask the user to name each figure individually. - Visual abstract check. If the target journal requires or encourages a visual abstract (check the journal profile for a "Visual Abstract" section), call
/make-figureswith visual abstract request. Provide: title, Key Points 1 and 3, methodology summary, and the best study figure as the visual element. - Figure discovery and embedding. After figure generation completes, scan the
analysis/figures/directory for all PNG and PDF files. For each figure:- Generate a markdown image reference:
{width=80%} - Draft a figure legend based on the figure type and analysis context
- Insert the reference at the appropriate location in the Results section
- Generate a markdown image reference:
- Manifest verification (HALT gate). After
/make-figurescompletes, verify thatanalysis/figures/_figure_manifest.mdexists and contains at least one figure entry. If the manifest is missing or empty: in autonomous mode, HALT with error codeMANIFEST_MISSING, log toqc/_pipeline_log.md, and write a recovery note tomanuscript/<id>/REPORT.mdTier-3 section ("rerun /make-figures or manually create _figure_manifest.md"). In interactive mode, report the error and ask the user how to proceed. Rationale: Phase 7 DOCX build (line 567) parses the manifest to embed figures; a missing manifest silently drops all figures from the final docx, which surfaces only at submission. HALT-on-missing is cheaper than discovering the absence in submission QC.
Gate: Present T&F plan to user. Do NOT proceed until user approves.
Autonomous mode: If --autonomous is ON, skip this gate. Log the T&F plan to qc/_pipeline_log.md and proceed to Phase 3.
Phase 3: Methods
Write the Methods section first -- it is the most objective and anchors the rest of the paper.
Before writing: Load ${CLAUDE_SKILL_DIR}/references/section_guides/methods.md for PICO structure, backbone article usage, checklist cross-reference, and terminology conventions. For the matching study type, also skim the structure model in ${CLAUDE_SKILL_DIR}/references/exemplar_methods/ (diagnostic-accuracy/STARD, AI-validation/TRIPOD+AI·CLAIM, observational-cohort/STROBE, meta-analysis/PRISMA 2020, RCT/CONSORT 2010) — it lists, paragraph by paragraph, what each Methods paragraph must establish plus the element that type most often omits. Model the structure; the exemplars are synthetic, with placeholder specifics, not prose to copy.
Writing order within Methods:
- Study Design and Setting
- Participants / Dataset (inclusion/exclusion, recruitment period)
- Procedures / Intervention / AI Model description
- Outcome Measures (primary and secondary endpoints)
- Statistical Analysis (reference
${CLAUDE_SKILL_DIR}/references/section_templates/methods_statistical.md) - Ethics statement
- AI/LLM disclosure (if
--no-llm-disclosurewas NOT set): insert the Methods disclosure paragraph from the LLM Disclosure section
AI/LLM extraction add-ons (when applicable):
- In Dataset / Inputs, state exactly which text fields the model received and whether clinical history, indication, impression, prior diagnosis, or referral text was masked. If a supplied field can contain the target label, Methods must either exclude it or describe a no-leaky-field sensitivity analysis.
- In AI Model or Statistical Analysis, include a same-backbone zero-shot/few-shot comparator when the claim is that fine-tuning, LoRA, prompt engineering, or a multi-agent wrapper improves performance.
- In Introduction, state the decision-impact path: what clinical or research workflow step changes if the model works, not only that the extracted label is interesting.
Process:
- Writer pass: Draft the full Methods section following the outline and paper type template.
- Critic pass: Score using the 6-dimension rubric (see Critic Scoring below). Provide specific line-level feedback.
- Fixer pass: Revise based on critic feedback.
- Repeat critic-fixer loop up to 3 rounds. Pass threshold: overall score >= 85/100.
- Present final Methods to user.
Phase 4: Results
Write Results aligned to the approved tables and figures. Results = "What did we find?" — nothing more. Every sentence must be a factual statement backed by a number.
Before writing: Load ${CLAUDE_SKILL_DIR}/references/section_guides/results.md for mirror-symmetry rules, flowchart requirements, missing data handling, and the anti-interpretation self-check. For the matching study type, also skim the structure model in ${CLAUDE_SKILL_DIR}/references/exemplar_results/ (diagnostic-accuracy/STARD, AI-validation/TRIPOD+AI·CLAIM, observational-cohort/STROBE, meta-analysis/PRISMA 2020, RCT/CONSORT 2010) — each follows its exemplar_methods/ sibling in Methods order, listing what each Results paragraph must establish (flow → baseline/prevalence → primary estimate with CIs → calibration/agreement → subgroups → sensitivity; for meta-analysis, PRISMA flow → characteristics+provenance → RoB → pooled estimate with I²/τ²/prediction interval → subgroup interaction → publication bias; for an RCT, CONSORT flow → baseline-by-arm with no p-values → ITT primary with CI → secondary+harms → per-protocol beside ITT) plus the element that type most often omits. Model the structure; the exemplars are synthetic, with placeholder specifics, not prose to copy.
Rules:
- Every number in the text must match the corresponding table cell exactly.
- Start with study population description referencing Table 1.
- Present primary endpoint results first, then secondary.
- Reference every table and figure at least once in the text.
- Report exact p-values (not "p < 0.05" unless truly < 0.001).
- All primary metrics must include 95% confidence intervals.
- Incremental value must be earned, not asserted. If the paper claims the model/marker adds value beyond / on top of an existing tool (a clinical score, a routine test, a baseline model), Results must report the nested-model comparison — a baseline model from the in-routine-use predictors versus the augmented model — with an incremental metric: ΔC-index / ΔAUC (paired CI, e.g. DeLong), NRI, IDI, or decision-curve net benefit. A standalone discrimination number does not support a "beyond X" claim. If the design did not include the baseline comparator (see
/design-studyPhase 3), soften the claim to standalone performance rather than implying added value. - Do not interpret results in this section; state findings only.
Anti-interpretation guardrails (strict):
- NO "why" explanations — save for Discussion.
- NO comparisons with prior literature — save for Discussion.
- NO causal language ("caused," "led to," "due to") — use "was associated with."
- NO evaluative adjectives without numbers ("high," "significant," "notable," "remarkable," "surprising") — always pair with the actual value.
- NO hedge words implying interpretation ("suggests," "implies," "indicates importance," "consistent with," "as expected").
- Self-check heuristic (applied to every sentence):
- Does this sentence explain "why"? → Move to Discussion.
- Does it reference another study? → Move to Discussion.
- Does it use "suggests/implies/indicates importance"? → Rewrite as factual statement.
- Does it use an adjective without a number? → Add the number or delete the adjective.
- Does it contain "interestingly/notably/remarkably/surprisingly"? → Delete the word.
Structure:
- Study population (enrollment, exclusions, demographics → Table 1).
- Primary endpoint results (one paragraph per primary outcome).
- Secondary endpoint results.
- Subgroup / sensitivity analyses (if applicable).
Process: Same writer -> critic -> fixer loop as Phase 3 (max 3 rounds, threshold 85/100).
Gate: Present final Results to user. Confirm before proceeding to Discussion.
Phase 5: Discussion
Before writing: Load ${CLAUDE_SKILL_DIR}/references/section_guides/discussion.md for the 4-paragraph structure, word limits, limitation writing guidelines, and Table/Figure citation rules. For the matching study type, also skim the structure model in ${CLAUDE_SKILL_DIR}/references/exemplar_discussion/ (diagnostic-accuracy/STARD, AI-validation/TRIPOD+AI·CLAIM, observational-cohort/STROBE, meta-analysis/PRISMA 2020, RCT/CONSORT 2010) — completing the exemplar trio, each lists what every Discussion paragraph must establish (key finding → interpretation/comparison → limitations → generalizability → conclusion matched to the evidence) plus the element that type most often omits (spectrum/verification bias; evidence-tier separation and optimism caveats; mandatory causal caution; for meta-analysis, GRADE certainty + heterogeneity source + non-independence/overlap caveat; for an RCT, blinding/attrition limitation + clinical-vs-statistical significance vs the MCID). For case reports, use ${CLAUDE_SKILL_DIR}/references/exemplar_case_report.md instead: it controls literature-boundary wording, n=1 causal caution, and bedside teaching-point framing. Model the structure; the exemplars are synthetic, introduce no new results, and are not prose to copy.
Before drafting, collect user input (Discussion Planning Gate).
Step 5a: Discussion Planning (interactive)
Ask the user the following questions (in the user's preferred language). Wait for answers before drafting.
Q1. List the 3-5 key findings of this study in order of importance.
Q2. Name 3-5 key prior studies (anchor papers) you want to compare against in the
Discussion — titles or DOIs.
- Studies consistent with your results: ?
- Studies inconsistent with your results: ?
Q3. Are there methodological or population differences that could explain any disagreement?
Q4. State up to 3 limitations of this study.
(For each, include how it was mitigated and the direction in which it could affect the results.)
Q5. Are there clinical implications you want to emphasize?
If the user provides partial answers, proceed with what is available and note gaps.
If the user says "skip" (or the equivalent in their language), use /search-lit to identify
anchor papers from the reference list and proceed with best-effort defaults.
Gate: Do NOT start writing Discussion until user responds (or explicitly skips).
Autonomous mode: If --autonomous is ON, skip the interactive planning. Use /search-lit to identify anchor papers from the reference list and proceed with best-effort defaults (same as the "skip" path).
Step 5b: Discussion Drafting
Write the Discussion using the inverted funnel structure:
Paragraph structure:
- Summary (1 paragraph): Restate key findings without repeating numbers verbatim. Bridge from Results — the reader should feel continuity.
- Context — anchor paper comparisons (2-3 paragraphs): Each paragraph organized around
one theme or finding. For each anchor paper:
- State the prior finding with citation.
- Compare: agreement or disagreement with our result.
- Explain the discrepancy (if any) citing methodological or population differences.
- Clinical implications (1 paragraph): What does this mean for practice or future research?
- Limitations (1 paragraph): Honest, specific, ordered by severity. For each limitation: (a) what it is, (b) how it was mitigated, (c) direction of residual bias. Do NOT use "our study has several limitations" as an opener.
- Strengths (optional, 1-2 sentences): Only if genuinely novel contribution.
- Conclusion (1-2 sentences): Single most important finding + implication. Must be a citable statement. No "further studies are needed" as final sentence.
Rules:
- Do not introduce new data not presented in Results.
- Avoid overclaiming: language must match evidence level.
- Endpoint↔conclusion scope. The Clinical-implications and Conclusion sentences must not exceed what the design and endpoint support. A cross-sectional / single-visit / prevalence study cannot license a prognostic or surveillance claim (a rescreen interval, disease progression, predicting future risk) — that requires longitudinal follow-up. A binary surrogate endpoint (present/absent, >0, dichotomized) is risk stratification, not a patient-care directive (defer/withhold/initiate therapy).
/self-review§D (check_scope_coherence.py) flagsCROSS_SECTIONAL_PROGNOSTIC/SURROGATE_CARE_DIRECTIVE; keep the conclusion verb inside the design's reach. - Acknowledge alternative explanations for key findings.
- Each comparison with prior work must cite the specific study.
- NO "interestingly," "notably," "it is worth noting" — state the point directly.
Process: Same writer -> critic -> fixer loop (max 3 rounds, threshold 85/100).
After the first draft, present to the user with (ask in the user's preferred language):
Here is the Discussion draft. Please review:
- Any missing anchor papers or additional comparisons needed?
- Anything you want to change in the interpretation?
- Any clinical implications to emphasize more or soften?
Incorporate user feedback before running the critic-fixer loop.
Phase 6: Introduction + Abstract
Write these LAST because they frame the paper and depend on knowing what was actually found.
Before writing: Load ${CLAUDE_SKILL_DIR}/references/section_guides/introduction.md for the Gap Storytelling 5-step structure, word/paragraph/reference targets, and common mistakes, and skim the paragraph-by-paragraph structure model in ${CLAUDE_SKILL_DIR}/references/exemplar_introduction.md (¶1 significance → ¶2 landscape → ¶3 the gap → ¶4 objective, plus the vague-gap and gap↔objective-mismatch failure modes). Also load ${CLAUDE_SKILL_DIR}/references/section_guides/title_abstract.md for Title 3-type selection, 4-component checklist, Abstract Conclusion-first priority, and Visual Abstract guidance, and skim the structured-abstract structure model in ${CLAUDE_SKILL_DIR}/references/exemplar_abstract.md (Background/Objective → Methods → Results-with-primary-estimate-+-CI-+-denominator → Conclusion-matched-to-design, plus the estimate-free-Results, over-reaching-Conclusion, and body↔abstract number-mismatch failure modes). For case reports, use ${CLAUDE_SKILL_DIR}/references/exemplar_case_report.md for the 150-word Introduction / Case Presentation / Conclusion abstract anatomy rather than the IMRAD abstract model. Model the structure; the exemplars are synthetic, with placeholder specifics, not prose to copy.
Introduction structure (3-4 paragraphs):
- Clinical context establishing importance (cite prevalence, burden, current practice).
- Knowledge gap that this study addresses.
- Study objective, stated precisely. Include hypothesis if applicable.
Shortened here. Read the whole file on GitHub.
Signals
- GitHub stars
- 297
- Forks
- 71
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
write-paper- Source
- github.com/aperivue/medsci-skills