paper-writing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Workflow 3: Paper Writing Pipeline

工作流3:论文写作管道

Orchestrate a complete paper writing workflow for: $ARGUMENTS
为以下内容编排完整的论文写作工作流:$ARGUMENTS

Overview

概述

This skill chains five sub-skills into a single automated pipeline:
/paper-plan → /paper-figure → /paper-write → /paper-compile → /auto-paper-improvement-loop
  (outline)     (plots)        (LaTeX)        (build PDF)       (review & polish ×2)
Each phase builds on the previous one's output. The final deliverable is a polished, reviewed
paper/
directory with LaTeX source and compiled PDF.
该技能将五个子技能串联成一个自动化管道:
/paper-plan → /paper-figure → /paper-write → /paper-compile → /auto-paper-improvement-loop
  (大纲)     (图表)        (LaTeX写作)        (生成PDF)       (评审与精修 ×2)
每个阶段的输出作为下一阶段的输入。最终交付物是一个经过精修、评审通过的
paper/
目录,包含LaTeX源码和编译完成的PDF。

Constants

常量

  • VENUE =
    ICLR
    — Target venue. Options:
    ICLR
    ,
    NeurIPS
    ,
    ICML
    . Affects style file, page limit, citation format.
  • MAX_IMPROVEMENT_ROUNDS = 2 — Number of review→fix→recompile rounds in the improvement loop.
  • REVIEWER_MODEL =
    gpt-5.4
    — Model used via Codex MCP for plan review, figure review, writing review, and improvement loop.
  • AUTO_PROCEED = true — Auto-continue between phases. Set
    false
    to pause and wait for user approval after each phase.
  • HUMAN_CHECKPOINT = false — When
    true
    , the improvement loop (Phase 5) pauses after each round's review to let you see the score and provide custom modification instructions. When
    false
    (default), the loop runs fully autonomously. Passed through to
    /auto-paper-improvement-loop
    .
  • ILLUSTRATION =
    gemini
    — AI illustration mode:
    gemini
    (default, needs
    GEMINI_API_KEY
    ),
    mermaid
    (free, no API key), or
    false
    (skip, manual only).
Override inline:
/paper-writing "NARRATIVE_REPORT.md" — venue: NeurIPS, illustration: mermaid
  • VENUE =
    ICLR
    — 目标会议。可选值:
    ICLR
    NeurIPS
    ICML
    。会影响样式文件、页数限制和引用格式。
  • MAX_IMPROVEMENT_ROUNDS = 2 — 优化循环中的评审→修改→重新编译轮次数量。
  • REVIEWER_MODEL =
    gpt-5.4
    — 通过Codex MCP使用的模型,用于大纲评审、图表评审、写作评审和优化循环。
  • AUTO_PROCEED = true — 阶段间自动继续。设置为
    false
    时,每个阶段结束后会暂停并等待用户批准。
  • HUMAN_CHECKPOINT = false — 当设置为
    true
    时,优化循环(第5阶段)在每一轮评审后暂停,让你查看评分并提供自定义修改指令。默认值为
    false
    时,循环完全自主运行。该参数会传递给
    /auto-paper-improvement-loop
  • ILLUSTRATION =
    gemini
    — AI插图模式:
    gemini
    (默认,需要
    GEMINI_API_KEY
    )、
    mermaid
    (免费,无需API密钥)或
    false
    (跳过,仅手动制作)。
内联覆盖示例:
/paper-writing "NARRATIVE_REPORT.md" — venue: NeurIPS, illustration: mermaid

Inputs

输入

This pipeline accepts one of:
  1. NARRATIVE_REPORT.md
    (best) — structured research narrative with claims, experiments, results, figures
  2. Research direction + experiment results — the skill will help draft the narrative first
  3. Existing
    PAPER_PLAN.md
    — skip Phase 1, start from Phase 2
The more detailed the input (especially figure descriptions and quantitative results), the better the output.
该管道接受以下任意一种输入:
  1. NARRATIVE_REPORT.md
    (推荐)—— 包含论点、实验、结果、图表的结构化研究叙事文档
  2. 研究方向 + 实验结果 —— 该技能会先帮助起草叙事内容
  3. 已有的
    PAPER_PLAN.md
    —— 跳过第1阶段,从第2阶段开始
输入内容越详细(尤其是图表描述和量化结果),输出质量越高。

Pipeline

管道流程

Phase 1: Paper Plan

阶段1:论文大纲生成

Invoke
/paper-plan
to create the structural outline:
/paper-plan "$ARGUMENTS"
What this does:
  • Parse NARRATIVE_REPORT.md for claims, evidence, and figure descriptions
  • Build a Claims-Evidence Matrix — every claim maps to evidence, every experiment supports a claim
  • Design section structure (5-8 sections depending on paper type)
  • Plan figure/table placement with data sources
  • Scaffold citation structure
  • GPT-5.4 reviews the plan for completeness
Output:
PAPER_PLAN.md
with section plan, figure plan, citation scaffolding.
Checkpoint: Present the plan summary to the user.
📐 Paper plan complete:
- Title: [proposed title]
- Sections: [N] ([list])
- Figures: [N] auto-generated + [M] manual
- Target: [VENUE], [PAGE_LIMIT] pages

Shall I proceed with figure generation?
  • User approves (or AUTO_PROCEED=true) → proceed to Phase 2.
  • User requests changes → adjust plan and re-present.
调用
/paper-plan
创建结构化大纲:
/paper-plan "$ARGUMENTS"
该阶段的作用:
  • 解析NARRATIVE_REPORT.md,提取论点、证据和图表描述
  • 构建论点-证据矩阵 —— 每个论点对应证据,每个实验支撑一个论点
  • 设计章节结构(根据论文类型分为5-8个章节)
  • 规划图表/表格的位置及数据源
  • 搭建引用结构框架
  • GPT-5.4评审大纲的完整性
输出: 包含章节规划、图表规划、引用框架的
PAPER_PLAN.md
检查点: 向用户展示大纲摘要。
📐 论文大纲已完成:
- 标题:[拟定标题]
- 章节:[N]个([列表])
- 图表:[N]个自动生成 + [M]个手动制作
- 目标会议:[VENUE],[页数限制]页

是否继续生成图表?
  • 用户批准(或AUTO_PROCEED=true)→ 进入第2阶段。
  • 用户要求修改 → 调整大纲后重新展示。

Phase 2: Figure Generation

阶段2:图表生成

Invoke
/paper-figure
to generate data-driven plots and tables:
/paper-figure "PAPER_PLAN.md"
What this does:
  • Read figure plan from PAPER_PLAN.md
  • Generate matplotlib/seaborn plots from JSON/CSV data
  • Generate LaTeX comparison tables
  • Create
    figures/latex_includes.tex
    for easy insertion
  • GPT-5.4 reviews figure quality and captions
Output:
figures/
directory with PDFs, generation scripts, and LaTeX snippets.
调用
/paper-figure
生成数据驱动的图表和表格:
/paper-figure "PAPER_PLAN.md"
该阶段的作用:
  • 读取PAPER_PLAN.md中的图表规划
  • 从JSON/CSV数据生成matplotlib/seaborn图表
  • 生成LaTeX对比表格
  • 创建
    figures/latex_includes.tex
    以便于插入
  • GPT-5.4评审图表质量和说明文字
输出: 包含PDF文件、生成脚本和LaTeX代码片段的
figures/
目录。

Phase 2b: AI Illustration Generation

阶段2b:AI插图生成

Skip this step entirely if
illustration
is
false
.
If the paper plan includes architecture diagrams, pipeline figures, or method illustrations:
When
illustration: gemini
(default) — invoke
/paper-illustration
:
/paper-illustration "[method description from PAPER_PLAN.md or NARRATIVE_REPORT.md]"
  • Claude plans → Gemini optimizes → Nano Banana Pro renders → Claude reviews (score ≥ 9)
  • Output:
    figures/ai_generated/*.png
  • Requires
    GEMINI_API_KEY
    environment variable
When
illustration: mermaid
— invoke
/mermaid-diagram
:
/mermaid-diagram "[method description from PAPER_PLAN.md]"
  • Generates Mermaid syntax diagrams (flowchart, sequence, class, etc.)
  • Output:
    figures/*.mmd
    +
    figures/*.png
  • Free, no API key needed
When
illustration: false
— skip entirely. Architecture diagrams must be created manually (draw.io, Figma, TikZ).
Checkpoint: List generated vs manual figures.
📊 Figures complete:
- Data plots (auto): [list]
- AI illustrations (auto): [list, if illustration ≠ false]
- Manual (need your input): [list]
- LaTeX snippets: figures/latex_includes.tex

[If manual figures needed]: Please add them to figures/ before I proceed.
[If all auto]: Shall I proceed with LaTeX writing?
如果
illustration
设置为
false
,则完全跳过此步骤。
如果论文大纲包含架构图、管道流程图或方法示意图:
illustration: gemini
(默认)时 —— 调用
/paper-illustration
/paper-illustration "[来自PAPER_PLAN.md或NARRATIVE_REPORT.md的方法描述]"
  • Claude规划 → Gemini优化 → Nano Banana Pro渲染 → Claude评审(评分≥9)
  • 输出:
    figures/ai_generated/*.png
  • 需要
    GEMINI_API_KEY
    环境变量
**当
illustration: mermaid
**时 —— 调用
/mermaid-diagram
/mermaid-diagram "[来自PAPER_PLAN.md的方法描述]"
  • 生成Mermaid语法图(流程图、序列图、类图等)
  • 输出:
    figures/*.mmd
    +
    figures/*.png
  • 免费,无需API密钥
**当
illustration: false
**时 —— 完全跳过。架构图必须手动制作(draw.io、Figma、TikZ)。
检查点: 列出已生成的图表和需要手动制作的图表。
📊 图表已完成:
- 数据图表(自动生成):[列表]
- AI插图(自动生成):[列表,若illustration≠false]
- 手动制作(需用户输入):[列表]
- LaTeX代码片段:figures/latex_includes.tex

[若需要手动制作图表]:请在继续前将其添加到figures/目录。
[若全部为自动生成]:是否继续进行LaTeX写作?

Phase 3: LaTeX Writing

阶段3:LaTeX写作

Invoke
/paper-write
to generate section-by-section LaTeX:
/paper-write "PAPER_PLAN.md"
What this does:
  • Write each section following the plan, with proper LaTeX formatting
  • Insert figure/table references from
    figures/latex_includes.tex
  • Build
    references.bib
    from citation scaffolding
  • Clean stale files from previous section structures
  • Automated bib cleaning (remove uncited entries)
  • De-AI polish (remove "delve", "pivotal", "landscape"...)
  • GPT-5.4 reviews each section for quality
Output:
paper/
directory with
main.tex
,
sections/*.tex
,
references.bib
,
math_commands.tex
.
Checkpoint: Report section completion.
✍️ LaTeX writing complete:
- Sections: [N] written ([list])
- Citations: [N] unique keys in references.bib
- Stale files cleaned: [list, if any]

Shall I proceed with compilation?
调用
/paper-write
逐章节生成LaTeX内容:
/paper-write "PAPER_PLAN.md"
该阶段的作用:
  • 按照大纲撰写每个章节,使用正确的LaTeX格式
  • figures/latex_includes.tex
    插入图表/表格引用
  • 从引用框架构建
    references.bib
  • 清理之前章节结构留下的过期文件
  • 自动清理bib文件(移除未引用的条目)
  • 去AI化润色(移除“delve”“pivotal”“landscape”等典型AI用词)
  • GPT-5.4评审每个章节的质量
输出: 包含
main.tex
sections/*.tex
references.bib
math_commands.tex
paper/
目录。
检查点: 报告章节完成情况。
✍️ LaTeX写作已完成:
- 章节:[N]个已撰写([列表])
- 引用:references.bib中有[N]个唯一引用键
- 已清理的过期文件:[列表,若有]

是否继续进行编译?

Phase 4: Compilation

阶段4:编译

Invoke
/paper-compile
to build the PDF:
/paper-compile "paper/"
What this does:
  • latexmk -pdf
    with automatic multi-pass compilation
  • Auto-fix common errors (missing packages, undefined refs, BibTeX syntax)
  • Up to 3 compilation attempts
  • Post-compilation checks: undefined refs, page count, font embedding
  • Precise page verification via
    pdftotext
  • Stale file detection
Output:
paper/main.pdf
Checkpoint: Report compilation results.
🔨 Compilation complete:
- Status: SUCCESS
- Pages: [X] (main body) + [Y] (references) + [Z] (appendix)
- Within page limit: YES/NO
- Undefined references: 0
- Undefined citations: 0

Shall I proceed with the improvement loop?
调用
/paper-compile
生成PDF:
/paper-compile "paper/"
该阶段的作用:
  • 使用
    latexmk -pdf
    进行自动多轮编译
  • 自动修复常见错误(缺失包、未定义引用、BibTeX语法错误)
  • 最多尝试3次编译
  • 编译后检查:未定义引用、页数、字体嵌入
  • 通过
    pdftotext
    进行精确页数验证
  • �检测过期文件
输出:
paper/main.pdf
检查点: 报告编译结果。
🔨 编译已完成:
- 状态:成功
- 页数:[X](主体)+ [Y](参考文献)+ [Z](附录)
- 符合页数限制:是/否
- 未定义引用:0
- 未定义引用条目:0

是否继续进行优化循环?

Phase 5: Auto Improvement Loop

阶段5:自动优化循环

Invoke
/auto-paper-improvement-loop
to polish the paper:
/auto-paper-improvement-loop "paper/"
What this does (2 rounds):
Round 1: GPT-5.4 xhigh reviews the full paper → identifies CRITICAL/MAJOR/MINOR issues → Claude Code implements fixes → recompile → save
main_round1.pdf
Round 2: GPT-5.4 xhigh re-reviews with conversation context → identifies remaining issues → Claude Code implements fixes → recompile → save
main_round2.pdf
Typical improvements:
  • Fix assumption-model mismatches
  • Soften overclaims to match evidence
  • Add missing interpretations and notation
  • Strengthen limitations section
  • Add theory-aligned experiments if needed
Output: Three PDFs for comparison +
PAPER_IMPROVEMENT_LOG.md
.
Format check (included in improvement loop Step 8): After final recompilation, auto-detect and fix overfull hboxes (content exceeding margins), verify page count vs venue limit, and ensure compact formatting. Any overfull > 10pt is fixed before generating the final PDF.
调用
/auto-paper-improvement-loop
精修论文:
/auto-paper-improvement-loop "paper/"
该阶段的流程(共2轮):
第1轮: GPT-5.4 xhigh评审完整论文 → 识别关键/主要/次要问题 → Claude Code实现修改 → 重新编译 → 保存
main_round1.pdf
第2轮: GPT-5.4 xhigh结合对话上下文重新评审 → 识别剩余问题 → Claude Code实现修改 → 重新编译 → 保存
main_round2.pdf
典型优化内容:
  • 修复假设与模型不匹配的问题
  • 弱化与证据不符的过度断言
  • 添加缺失的解释和符号说明
  • 强化局限性章节
  • 必要时添加与理论一致的实验
输出: 用于对比的三个PDF +
PAPER_IMPROVEMENT_LOG.md
格式检查(包含在优化循环的第8步中):最终重新编译后,自动检测并修复内容超出边距的问题(overfull hboxes),验证页数是否符合会议限制,并确保格式紧凑。任何超过10pt的内容溢出问题都会在生成最终PDF前修复。

Phase 6: Final Report

阶段6:最终报告

markdown
undefined
markdown
undefined

Paper Writing Pipeline Report

论文写作管道报告

Input: [NARRATIVE_REPORT.md or topic] Venue: [ICLR/NeurIPS/ICML] Date: [today]
输入:[NARRATIVE_REPORT.md 或研究主题] 目标会议:[ICLR/NeurIPS/ICML] 日期:[今日]

Pipeline Summary

管道摘要

PhaseStatusOutput
1. Paper PlanPAPER_PLAN.md
2. Figuresfigures/ ([N] auto + [M] manual)
3. LaTeX Writingpaper/sections/*.tex ([N] sections, [M] citations)
4. Compilationpaper/main.pdf ([X] pages)
5. Improvement[score0]/10 → [score2]/10
阶段状态输出
1. 论文大纲生成PAPER_PLAN.md
2. 图表生成figures/ ([N]个自动生成 + [M]个手动制作)
3. LaTeX写作paper/sections/*.tex ([N]个章节, [M]个引用)
4. 编译paper/main.pdf ([X]页)
5. 优化[score0]/10 → [score2]/10

Improvement Scores

优化评分

RoundScoreKey Changes
Round 0X/10Baseline
Round 1Y/10[summary]
Round 2Z/10[summary]
轮次评分主要修改
第0轮X/10基线版本
第1轮Y/10[摘要]
第2轮Z/10[摘要]

Deliverables

交付物

  • paper/main.pdf — Final polished paper
  • paper/main_round0_original.pdf — Before improvement
  • paper/main_round1.pdf — After round 1
  • paper/main_round2.pdf — After round 2
  • paper/PAPER_IMPROVEMENT_LOG.md — Full review log
  • paper/main.pdf — 最终精修论文
  • paper/main_round0_original.pdf — 优化前版本
  • paper/main_round1.pdf — 第1轮优化后版本
  • paper/main_round2.pdf — 第2轮优化后版本
  • paper/PAPER_IMPROVEMENT_LOG.md — 完整评审日志

Remaining Issues (if any)

剩余问题(若有)

  • [items from final review that weren't addressed]
  • [最终评审中未解决的问题]

Next Steps

后续步骤

  • Visual inspection of PDF
  • Add any missing manual figures
  • Submit to [venue] via OpenReview / CMT / HotCRP
undefined
  • 可视化检查PDF
  • 添加缺失的手动制作图表
  • 通过OpenReview / CMT / HotCRP提交至[目标会议]
undefined

Key Rules

核心规则

  • Large file handling: If the Write tool fails due to file size, immediately retry using Bash (
    cat << 'EOF' > file
    ) to write in chunks. Do NOT ask the user for permission — just do it silently.
  • Don't skip phases. Each phase builds on the previous one — skipping leads to errors.
  • Checkpoint between phases when AUTO_PROCEED=false. Present results and wait for approval.
  • Manual figures first. If the paper needs architecture diagrams or qualitative results, the user must provide them before Phase 3.
  • Compilation must succeed before entering the improvement loop. Fix all errors first.
  • Preserve all PDFs. The user needs round0/round1/round2 for comparison.
  • Document everything. The pipeline report should be self-contained.
  • Respect page limits. If the paper exceeds the venue limit, suggest specific cuts before the improvement loop.
  • 大文件处理:如果写入工具因文件大小失败,立即使用Bash(
    cat << 'EOF' > file
    )分块写入进行重试。无需询问用户权限 —— 直接静默执行。
  • 不要跳过阶段:每个阶段都基于前一阶段的输出,跳过会导致错误。
  • AUTO_PROCEED=false时的阶段检查点:展示结果并等待用户批准。
  • 先完成手动图表:如果论文需要架构图或定性结果图表,用户必须在第3阶段前提供。
  • 编译成功后再进入优化循环:先修复所有错误。
  • 保留所有PDF:用户需要第0/1/2轮的版本进行对比。
  • 完整记录所有内容:管道报告应包含所有必要信息。
  • 遵守页数限制:如果论文超出会议页数限制,在优化循环前建议具体的删减内容。

Composing with Other Workflows

与其他工作流组合使用

/idea-discovery "direction"         ← Workflow 1: find ideas
implement                           ← write code
/run-experiment                     ← deploy experiments
/auto-review-loop "paper topic"     ← Workflow 2: iterate research
/paper-writing "NARRATIVE_REPORT.md"  ← Workflow 3: you are here
                                         submit! 🎉

Or use /research-pipeline for the Workflow 1+2 end-to-end flow,
then /paper-writing for the final writing step.
/idea-discovery "研究方向"         ← 工作流1:寻找研究思路
实现                           ← 编写代码
/run-experiment                     ← 部署实验
/auto-review-loop "论文主题"     ← 工作流2:迭代研究
/paper-writing "NARRATIVE_REPORT.md"  ← 工作流3:当前所在位置
                                         提交!🎉

或者使用/research-pipeline完成工作流1+2的端到端流程,
然后使用/paper-writing完成最终的写作步骤。

Typical Timeline

典型时间线

PhaseDurationCan sleep?
1. Paper Plan5-10 minNo
2. Figures5-15 minNo
3. LaTeX Writing15-30 minYes ✅
4. Compilation2-5 minNo
5. Improvement15-30 minYes ✅
Total: ~45-90 min for a full paper from narrative report to polished PDF.
阶段耗时可后台运行?
1. 论文大纲生成5-10分钟
2. 图表生成5-15分钟
3. LaTeX写作15-30分钟是 ✅
4. 编译2-5分钟
5. 优化15-30分钟是 ✅
总耗时:约45-90分钟,从叙事报告到精修完成的PDF的完整论文流程。