Draft a LaTeX paper from PAPER_PLAN — write each section from wiki sources + generate figures/tables + BibTeX verification + de-AI polish
Scanned 9/7/2026
Install to Claude Code
npx -y skills add Lambenthan/empiricalwiki --skill paper-draft --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Paper Draft?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/lambenthan-paper-draft-empiricalwiki)More formats (shields.io, HTML) on the badges page.
---
description: Draft a LaTeX paper from PAPER_PLAN — write each section from wiki sources + generate figures/tables + BibTeX verification + de-AI polish
argument-hint: <paper-plan-path> [--review] [--sections <section-numbers>]
---
# /paper-draft
> Draft a complete LaTeX paper from the PAPER_PLAN.md generated by /paper-plan.
> Write section by section: each section draws material from wiki claims/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/claims/*.md` — Statement, Evidence summary, Conditions of target claims
- `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, Formal notation, Variants (supports Method writing)
- `wiki/topics/*.md` — Overview, Timeline, SOTA tracker (supports Introduction context)
- `wiki/ideas/*.md` — Motivation, Hypothesis (supports gap narrative in Introduction)
- `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 all Formal notation from wiki/concepts/
- Unify symbol definitions (vectors, matrices, sets, common operators)
6. Generate `main.tex` skeleton:
```latex
\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:
```bash
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 claims 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#Motivation + wiki/topics/{topic}.md#Overview
- Related Work → wiki/papers/*.md#Related + wiki/concepts/*.md#Comparison
- Method → wiki/concepts/*.md#Formal_notation + wiki/claims/{claim}.md#Statement
- Experiments → wiki/experiments/*.md#Results + wiki/experiments/*.md#Analysis
- Conclusion → wiki/graph/open_questions.md + wiki/claims/*.md#Open_questions
**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: claim-first structure ("We claim 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, claim-evidence alignment, notation consistency.
Point out any remaining AI-sounding language patterns.
Suggest specific rewrites for unclear passages."
message: |
## Section: {section name}
{LaTeX content}
## Claims this section should support
{claims from matrix}
## Review this section for:
1. Does it clearly support its target claims?
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, claim-evidence thread (does the paper prove what it claims?),
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 claims from the matrix 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:
```bash
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:
```markdown
# 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 claim 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** (claim/experiment/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
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!