/paper-draft

SkillDocs & knowledge

Draft a LaTeX paper from PAPER_PLAN — write each section from wiki sources + generate figures/tables + BibTeX verification + de-AI polish

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the /paper-draft skill

What this skill tells your AI

The instructions your AI receives, as published by skyllwt/autosci in .claude/skills/paper-draft/SKILL.md and read by ahel’s review.

Draft a complete LaTeX paper from the PAPER_PLAN.md generated by /paper-plan. Write section by section: each section draws material from wiki ideas/methods/experiments/papers/concepts, generates LaTeX + figures + tables. BibTeX is fetched from DBLP/CrossRef (following citation-verification). Apply de-AI polish after completion (following academic-writing). Optional per-section Review LLM review. Output a compilable paper/ directory.

Inputs

  • plan: path to PAPER_PLAN.md (e.g. wiki/outputs/paper-plan-sparse-lora-2026-04-08.md)
  • --review (optional): enable per-section Review LLM review
  • --sections (optional): write only specified sections (e.g. --sections 3,4 writes only Method + Experiments); used for incremental writing

Outputs

  • paper/ directory (under the wiki project root):
    • paper/main.tex — master file (includes each section)
    • paper/sections/introduction.tex
    • paper/sections/related_work.tex
    • paper/sections/method.tex
    • paper/sections/experiments.tex
    • paper/sections/conclusion.tex
    • paper/sections/appendix.tex (if applicable)
    • paper/figures/ — generated figures (PDF/PNG)
    • paper/tables/ — standalone table files (optional)
    • paper/math_commands.tex — shared math symbol definitions
    • paper/references.bib — verified BibTeX entries
  • wiki/log.md — appended log entry

Wiki Interaction

Reads

  • wiki/outputs/paper-plan-*.md — PAPER_PLAN (section outline, evidence map, figure plan, citation plan)
  • wiki/ideas/*.md — Hypothesis, Novelty argument, Approach sketch, Motivation, Risks, Lessons learned
  • wiki/methods/*.md — Mechanism, Procedure, Assumptions, Tradeoff profile (supports Method writing)
  • wiki/experiments/*.md — Results, Analysis, key_result, metrics data
  • wiki/papers/*.md — Method, Results, Related (as citation content and baseline reference)
  • wiki/concepts/*.md — Definition, Intuition, Variants, Comparison (supports Method writing)
  • wiki/topics/*.md — Overview, Timeline, SOTA tracker, Open problems (supports Introduction context)
  • wiki/people/*.md — author names and institutions (citation formatting)
  • wiki/graph/edges.jsonl — relationship graph (build argumentative logic chain)
  • wiki/graph/open_questions.md — known limitations (write Limitations and Future Work)
  • .claude/skills/shared-references/academic-writing.md — writing standards
  • .claude/skills/shared-references/citation-verification.md — citation discipline

Writes

  • paper/ directory (all files)
  • wiki/log.md — appended operation log

Graph edges created

  • None (paper-plan already created derived_from edges)

Workflow

Precondition: confirm the working directory is the wiki project root (the directory containing wiki/, raw/, tools/).

Step 1: Initialize Paper Directory

  1. Read PAPER_PLAN.md; extract venue, title, section list
  2. If paper/ directory already exists:
    • Back up as paper.bak-{timestamp}/
    • Prompt user to confirm overwrite
  3. Create directory structure:
    paper/
    ├── main.tex
    ├── math_commands.tex
    ├── references.bib
    ├── sections/
    └── figures/
    
  4. Copy venue template from templates/ if it exists:
    • templates/{venue}.sty or templates/{venue}/
    • If no template: use generic article class; note in main.tex that the official template must be substituted
  5. Generate math_commands.tex:
    • Collect notation from wiki/methods/ (## Mechanism, ## Procedure) and wiki/concepts/ (## Definition, ## Intuition)
    • Unify symbol definitions (vectors, matrices, sets, common operators)
  6. Generate main.tex skeleton:
    \documentclass{article} % replace with venue template
    \input{math_commands}
    % packages
    \usepackage{booktabs,graphicx,amsmath,hyperref}
    
    \title{<title>}
    \author{} % leave empty for anonymous submission
    
    \begin{document}
    \maketitle
    \begin{abstract}
    % generated in Step 3
    \end{abstract}
    \input{sections/introduction}
    \input{sections/related_work}
    \input{sections/method}
    \input{sections/experiments}
    \input{sections/conclusion}
    \bibliography{references}
    \bibliographystyle{plain} % replace with venue-required style
    % \input{sections/appendix} % uncomment if needed
    \end{document}
    

Step 2: Generate Figures and Tables

For each entry in the Figure Plan from PAPER_PLAN:

  1. Diagram type (architecture diagrams, etc.):

    • Use TikZ or pgfplots to generate native LaTeX figures
    • If too complex: generate a matplotlib Python script → output PDF
    • Save to paper/figures/{figure-name}.pdf
  2. Plot type (experimental result charts):

    • Extract data from wiki/experiments/{slug}.md
    • Generate matplotlib script (following figure design standards in academic-writing):
      • Colorblind-safe palette
      • Font size >= 8pt
      • Error bars / confidence bands
      • Clear legend
    • Execute script to generate PDF:
      python3 paper/figures/plot_{name}.py
      
    • Save to paper/figures/{figure-name}.pdf
  3. Table type:

    • Use booktabs style (toprule, midrule, bottomrule)
    • Best result bold, second-best underline
    • Embed directly in section .tex file (small tables) or standalone paper/tables/{name}.tex (large tables)

Step 3: Write Sections

For each section (in the outline order from PAPER_PLAN); if --sections is specified, write only those sections:

3a. Collect Material

From the section definition in PAPER_PLAN, extract:

  • the ideas this section supports
  • the list of corresponding wiki pages
  • planned figures/tables
  • citation list

Read the relevant portions of all related wiki pages:

  • Introduction → wiki/ideas/{idea}.md (Hypothesis, Motivation, Novelty argument) + wiki/topics/{topic}.md#Overview
  • Related Work → wiki/papers/.md#Related + wiki/concepts/.md#Comparison
  • Method → wiki/methods/{method}.md (## Mechanism + ## Procedure) + wiki/concepts/{concept}.md (## Definition + ## Intuition)
  • Experiments → wiki/experiments/.md#Results + wiki/experiments/.md#Analysis
  • Conclusion → wiki/ideas/.md#Lessons_learned + wiki/concepts/.md#Open_problems + wiki/topics/*.md#Open_problems + wiki/graph/open_questions.md

3b. Write LaTeX

Following shared-references/academic-writing.md:

  • Write according to the paragraph plan for that section
  • Insert \cite{key} citations (keys mapped from citation plan)
  • Insert \ref{fig:name} / \ref{tab:name} references to figures/tables
  • Use symbols defined in math_commands.tex
  • Begin each paragraph with a topic sentence
  • Experiments section: idea-first structure ("Our hypothesis is X. To verify, we...")

3c. De-AI Polish

Apply de-AI polish to each written section (per academic-writing.md):

  1. Scan and replace AI-signature vocabulary (delve, leverage, utilize, comprehensive...)
  2. Remove excessive hedging
  3. Vary sentence openings (avoid consecutive identical sentence structures)
  4. Remove filler sentences (sentences that add no information)
  5. Ensure active voice predominates
  6. Check notation consistency

3d. Optional Review LLM Review (--review)

If --review is enabled, for each section:

mcp__llm-review__chat:
  system: "You are a senior ML researcher reviewing one section of a paper draft.
           Focus on: clarity, logical flow, idea-experiment alignment, notation consistency.
           Point out any remaining AI-sounding language patterns.
           Suggest specific rewrites for unclear passages."
  message: |
    ## Section: {section name}
    {LaTeX content}

    ## Ideas this section should support
    {ideas from the plan's idea list}

    ## Review this section for:
    1. Does it clearly support its target ideas?
    2. Is the writing clear and precise?
    3. Any AI-generated language patterns remaining?
    4. Is the notation consistent with other sections?
    5. Missing content that reviewers will expect?

Revise the section based on Review LLM feedback (inline edits; do not rewrite the entire section).

Step 4: Build Bibliography

Following shared-references/citation-verification.md:

  1. Collect all \cite{key} citations used across sections
  2. For each citation, retrieve BibTeX from the PAPER_PLAN's citation plan:
    • Verified: write directly to references.bib
    • [UNCONFIRMED]: write to the bottom of references.bib with a % [UNCONFIRMED] comment
  3. Exclude unused entries (do not use \nocite{*})
  4. Validate BibTeX format correctness (each entry has title, author, year)
  5. Output bibliography statistics:
    references.bib: {N} entries, {M} verified, {K} [UNCONFIRMED]
    

Step 5: Full-Paper Cross-Review

After all sections are complete:

mcp__llm-review__chat:
  system: "You are a senior ML researcher performing a final review of a complete paper draft.
           Focus on: cross-section coherence, idea-experiment thread (do the experiments back the central ideas?),
           narrative flow, notation consistency across sections, figure/table referencing.
           This is NOT a line-by-line review — focus on structural and argumentative issues."
  message: |
    ## Full Paper Draft
    {concatenated LaTeX of all sections}

    ## Evidence Map
    {from PAPER_PLAN}

    ## Review Focus
    1. Does the paper tell a coherent story from Introduction to Conclusion?
    2. Are all ideas from the plan adequately supported in the text?
    3. Is there notation inconsistency between sections?
    4. Are all figures/tables referenced and discussed?
    5. Any redundancy between sections?
    6. Overall readiness for submission (1-10)?

Make final adjustments based on Review LLM feedback.

Step 6: Finalize Output

  1. Confirm all files are written to the paper/ directory
  2. Verify basic integrity:
    • all files referenced by \input{sections/X} exist
    • all files referenced by \includegraphics{figures/X} exist
    • all \cite{key} keys have a corresponding entry in references.bib
    • all \ref{label} have a corresponding \label{label}
  3. Append log:
    python3 tools/research_wiki.py log wiki/ \
      "paper-draft | drafted {venue} paper '{title}' | {N} sections, {M} figures, {K} citations ({V} verified)"
    
  4. Print to terminal:
    # Paper Write Complete
    
    ## Files
    - paper/main.tex (master file)
    - paper/sections/ ({N} section files)
    - paper/figures/ ({M} figure files)
    - paper/references.bib ({K} entries, {V_count} [UNCONFIRMED])
    - paper/math_commands.tex
    
    ## Status
    - Sections written: {list}
    - De-AI polish: applied
    - Review LLM review: {yes/no, if yes: overall score}
    - [UNCONFIRMED] citations: {count} (resolve before /paper-compile)
    
    ## Next Steps
    - Run `/paper-compile paper/` to compile and verify
    - Resolve [UNCONFIRMED] citations manually
    - Run `/refine paper/main.tex --focus writing` for further polish
    

Constraints

  • Each section draws from wiki: do not generate content from nothing; every technical statement must trace back to a wiki page
  • BibTeX follows citation-verification.md: fetch from DBLP/CrossRef/S2; do not generate from LLM memory
  • De-AI polish is mandatory: each section must receive a polish pass after writing; cannot be skipped
  • Figures follow academic-writing.md: colorblind-safe, font size >= 8pt, vector format preferred
  • Anonymous submission: do not write author names, institutions, or acknowledgements (per venue anonymity requirements)
  • \nocite{*} is forbidden: only cite entries actually used
  • Notation consistency: all sections use unified symbols from math_commands.tex
  • Back up existing paper/ before overwriting: do not overwrite directly; back up first
  • Wikilink → \cite conversion: [[slug]] references in PAPER_PLAN are converted to \cite{key} in LaTeX
  • Tables use booktabs: no vertical lines or full grid

Error Handling

  • PAPER_PLAN not found: error; suggest running /paper-plan first
  • PAPER_PLAN format incomplete: list missing sections; suggest re-running /paper-plan
  • Wiki page not found (idea/experiment/method/paper referenced in plan does not exist): warn and skip that reference; annotate as missing
  • Figure generation failed (matplotlib error): output placeholder % TODO: generate figure {name}; continue with other sections
  • All BibTeX fetches failed: use [UNCONFIRMED] placeholders; report the count requiring manual handling in the terminal
  • Review LLM unavailable (--review mode): skip section review and cross-review; annotate as "unreviewed"
  • Venue template not found: use generic article class; note in main.tex
  • Section too long (exceeds plan page budget): warn; suggest moving to appendix or compressing

Dependencies

Tools(via Bash)

  • python3 tools/research_wiki.py log wiki/ "<message>" — append log
  • python3 tools/fetch_s2.py search "<title>" — BibTeX fallback (S2 search)
  • python3 — execute matplotlib figure scripts

MCP Servers

  • mcp__llm-review__chat — per-section review (optional, --review) + full-paper cross-review (Step 5)

Claude Code Native

  • Read — read wiki pages and PAPER_PLAN
  • Glob — find wiki pages
  • Write — write files to paper/ directory
  • Bash — execute figure scripts, create directories
  • WebFetch — DBLP / CrossRef BibTeX fetch

Shared References

  • .claude/skills/shared-references/academic-writing.md — writing standards + de-AI polish rules + figure design
  • .claude/skills/shared-references/citation-verification.md — BibTeX fetch workflow + [UNCONFIRMED] protocol

Called by

  • /research Stage 5 (paper writing stage)
  • Manual user invocation

Signals

GitHub stars
2k
Forks
210
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
paper-draft-skyllwt
Source
github.com/skyllwt/autosci