Four-phase iterative protocol for academic writing and document production. Covers outline → draft → self-review → polish with Stop Points, material supplementation loops, version comparison, and mechanical self-check. Includes IMRaD, LaTeX, docx/markdown, citation formatting, and md2pdf.
Read this skill when the user asks to:
CRITICAL — READ THIS FIRST
You MUST follow this four-phase protocol for ALL writing tasks longer than one paragraph. NEVER produce a complete draft in a single pass and call it done. Each phase has explicit steps. Complete them IN ORDER.
所有超过一段的写作任务必须遵循四阶段迭代流程。不得一次性写完就结束。
Phase 1 材料审查与大纲 Material Review & Outline ⏸ STOP → wait for user
Phase 2 初稿生成 First Draft Generation (continuous, mid-draft search if needed)
Phase 3 自检与修订 Self-Review & Revision ⏸ STOP → present review results
Phase 4 精修与导出 Polish & Export ⏸ STOP → present final + diff
Version Tagging: Every workspace_save MUST use version tags:
{topic}-v1.md, {topic}-v2.md, {topic}-final.md.
Goal: Confirm requirements, audit materials, produce outline with per-section citation needs. Identify gaps BEFORE writing.
MUST ask (skip items already answered by user):
MUST execute:
workspace_list — check outputs/drafts/ and outputs/reports/ for existing worklibrary_search — search local library for relevant papersworkspace_read — read any existing notes/outlines the user mentionsMUST produce this table for EACH section:
| Section | Key Points | Citations Needed | Available | Gap? |
|---|---|---|---|---|
| Introduction | Research gap, RQ, contributions | 5-8 | 3 | YES |
| Methods | ... | ... | ... | ... |
IF any section has Gap? = YES:
web_search or academic search toolslibrary_add_paper or library_import_bibtexNEVER proceed to Phase 2 with known gaps unless user explicitly approves.
MUST present: (1) outline table, (2) materials summary, (3) remaining gaps, (4) estimated length.
MUST say: "Please review this outline. Reply with changes, or confirm to proceed."
MUST WAIT. Do NOT proceed to Phase 2 automatically.
Goal: Write section by section per outline. Save versioned draft.
For EACH section in order:
workspace_save to outputs/figures/ → embed reference ("See Figure N") → continueworkspace_save → outputs/drafts/{topic}-v1.md
library_export_bibtex → outputs/exports/bibliography-{topic}.bib (if BibTeX)
Tell user: "First draft (v1) saved. Moving to self-review." List any sections with improvised material.
Do NOT wait for input here. Proceed to Phase 3.
Goal: Execute mechanical checklist. Fix issues. Save v2. Present results.
MUST check ALL 10 items. Record PASS or FAIL for each.
| # | Check Item | Verify By |
|---|---|---|
| 1 | Structure complete — follows IMRaD or target format? | Compare headings vs outline |
| 2 | Every claim cited — no unsupported assertions? | Scan each paragraph |
| 3 | Citation format consistent — same style throughout? | Spot-check 5+ citations |
| 4 | No fabricated references — all papers real? | library_search cross-check |
| 5 | Logical flow — transitions between paragraphs? | Read endings→beginnings |
| 6 | Academic tone — no casual language? | Scan for colloquialisms |
| 7 | Data/figures labeled — numbered, captioned, referenced? | Check each table/figure |
| 8 | Abstract ≤250 words (if applicable)? | Word count |
| 9 | No orphaned sections — every header has content? | Scan structure |
| 10 | Length ±20% of target? | Word count |
For EACH failed item:
If fixing requires new citations → trigger search (same as Phase 1 Step 4).
workspace_save → outputs/drafts/{topic}-v2.md
MUST present:
{topic}-v2.md. Reply with changes, or confirm for final polish."MUST WAIT. Do NOT proceed to Phase 4 automatically.
Goal: Apply feedback, final polish, export, show version diff.
For each piece of feedback: locate section → make change → verify consistency. If "no changes" → skip to Step 2.
MUST apply these 5 passes (details in Appendix F):
workspace_save → outputs/drafts/{topic}-final.md
Export per user request:
| Format | Action |
|---|---|
| docx | workspace_export({ source: "…-final.md", format: "docx" }) |
workspace_export(…, format: "pdf") or md2pdf pipeline (Appendix E) | |
| LaTeX | Save as .tex with preamble (Appendix D) |
| BibTeX | library_export_bibtex |
If no format specified, ask user.
MUST present diff summary: structural changes, content changes, quality fixes, word counts (v1 / v2 / final).
MUST present: (1) all saved file paths, (2) version diff, (3) all 10 checks PASS, (4) caveats.
Writing task complete.
| Style | In-text | Reference Format |
|---|---|---|
| APA 7 | (Author, Year) | Author, A. A. (Year). Title. Journal, vol(issue), pp. |
| MLA 9 | (Author page) | Author. "Title." Journal, vol. X, no. Y, Year, pp. Z. |
| Chicago | Footnote / (Author Year) | Author. Title. Place: Publisher, Year. |
| IEEE | [1] | [1] A. Author, "Title," Journal, vol. X, no. Y, pp. Z, Year. |
| Vancouver | (1) | 1. Author AA. Title. Journal. Year;Vol(Issue):Pages. |
| Harvard | (Author Year) | Author, A.A. Year. Title. Journal, Vol(Issue), pp. |
| Nature | Superscript^1 | 1. Author, A. A. Title. Journal Vol, Pages (Year). |
| ACM | [Author Year] | Author. Year. Title. In Proc. Conf., Pages. |
Default: APA 7. For CSL/GB/T 7714-2015, read Citation Styles skill.
Other sections: Literature Review (humanities), Theory/Model (econ/physics), Related Work (CS), Case Study (law/business).
Compilation: xelatex → biber/bibtex → xelatex ×2 → output.pdf
Use exec: cd <dir> && xelatex -interaction=nonstopmode main.tex
| Template | Use Case | Package |
|---|---|---|
| article/revtex | Journal | revtex4-2, elsarticle |
| beamer | Presentations | beamer |
| thesis | Graduation | THUThesis, SJTUThesis, ustcthesis |
| IEEE conf | CS/EE | IEEEtran |
| ACM | CS | acmart |
Formulas: Inline $...$, display \[...\] or equation, align align/aligned.
Numbering: equation auto, equation* suppresses. Cross-ref: \label{eq:x} + \eqref{eq:x}.
Overleaf: Use \input{} to split; switch to xelatex for CJK.
| Format | Tool | Use Case |
|---|---|---|
BibTeX .bib | library_export_bibtex | LaTeX, Overleaf, JabRef |
RIS .ris | library_export_bibtex(format:'ris') | EndNote, Mendeley, Zotero |
| CSV/JSON/MD | workspace_save | Spreadsheet, API, docs |
| Format | Tool |
|---|---|
| BibTeX | library_import_bibtex |
| RIS | library_import_ris |
library_add_paper (extract DOI) | |
| DOI list | library_batch_add |
| CSV | Parse + library_batch_add |
pandoc input.md -o output.docx --reference-doc=template.docx # md→docx
pandoc input.md -o output.pdf --pdf-engine=xelatex -V CJKmainfont="Noto Serif CJK SC" # md→pdf
pandoc input.docx -o output.md --extract-media=./media # docx→md
pandoc input.md -o output.pdf --citeproc --bibliography=refs.bib --csl=apa.csl # +bib
For CJK: always specify CJK fonts. Use --reference-doc for consistent docx styling.
Use md2pdf-export skill's Puppeteer pipeline. Setup: bash skills/md2pdf-export/scripts/setup-env.sh.
Convert: node skills/md2pdf-export/scripts/md2pdf.js input.md [--format A4 --toc --theme github]
Present changes as tracked edits (original vs. revised).
| Task | Tool | Pattern |
|---|---|---|
| Save draft | workspace_save | outputs/drafts/{topic}-v1.md |
| Save revision | workspace_save | outputs/drafts/{topic}-v2.md |
| Save final | workspace_save | outputs/drafts/{topic}-final.md |
| Review draft | workspace_read | outputs/drafts/{file} |
| List workspace | workspace_list | Check existing materials |
| Export Word | workspace_export | { source: "…", format: "docx" } |
| Export PDF | workspace_export | { source: "…", format: "pdf" } |
| Export bib | library_export_bibtex | .bib subset |
| Search library | library_search | Check available citations |
| Add paper | library_add_paper | Add found paper |
| Link to task | task_link_file | Link file to task |
| Compile LaTeX | exec | cd {dir} && xelatex -interaction=nonstopmode main.tex |
| Pandoc | exec | pandoc {in} -o {out} [opts] |
writing/composition/ — academic structure, ML paper writing, abstract craftingwriting/citation/ — Zotero, BibTeX management, APA/MLA/Chicagowriting/latex/ — LaTeX syntax, Overleaf, formula renderingwriting/templates/ — thesis templates (THUThesis, SJTUThesis), conferencewriting/polish/ — language polishing, tone, grammar toolstools/document/ — PDF parsing (GROBID), format conversion, large docs