Paper write nature docx

From FOURTEEN1416/academic-agent-toolkit · View interactive version

Paper write nature docx is an AI agent skill from the GitHub repository FOURTEEN1416/academic-agent-toolkit. Draft a Nature-style paper as Markdown for Word export. Use when params.output_format == 'docx';区别于 paper-write-docx:只用于 Nature 风格 docx 模式。

How to use this skill

Skill file

Nature-Style Paper Writing — Markdown for Word (docx mode)

Draft a Nature-quality paper as Markdown: $ARGUMENTS

docx-mode counterpart of paper-write-nature. Keeps hourglass structure, claim-evidence-boundary paragraph architecture, reader-first ordering. Produces paper/main.md only.

⛔ NEVER produce .tex, run XeLaTeX, or use LaTeX commands.

Constants

Inputs

  1. PAPER_PLAN.md — outline with claims-evidence matrix
  1. RESULTS.md / experiment_results.md / figures/all_results.json
  1. figures/ — .png / .pdf (Nature figure aesthetics from paper-figure-nature step)

Core Architecture

1. Identify paper type first

Before writing, determine:

Don't use one narrative for all paper types.

2. Reader-first writing order

Write for the reader's cognitive sequence:

  1. Is this relevant? (Introduction hook)
  1. What's new? (Contribution)
  1. Do I trust it? (Results + Methods)
  1. Can I reuse it? (Methods detail + Data Availability)
  1. What does it mean? (Discussion)

3. Productive writing order

  1. Results — anchor in evidence
  1. Introduction — frame the gap
  1. Title — crystallize contribution
  1. Discussion — interpret + bound
  1. Methods — reproducibility
  1. Abstract — last

4. Hourglass structure

5. Paragraph architecture: Claim-Evidence-Boundary

Every paragraph:

6. Boundary language

Express limitations honestly:

Section Responsibilities

Title

Abstract (150–200 words)

Mini-paper structure: context/problem → gap → approach → key result with numbers → implication

Introduction (~600–800 words for Nature)

Results

Discussion

Materials and Methods

Data Availability Statement

Generate using Nature data policy principles:

Failure Mode Diagnosis

Before editing any section, diagnose the main problem in priority order:

  1. Paper type — wrong narrative logic for this paper type?
  1. Section job — section not fulfilling its rhetorical responsibility?
  1. Paragraph logic — claim without evidence? evidence without claim? missing boundary?
  1. Sentence polish — clutter, passive voice, overclaim?

Fix from top down. Do not polish sentences while reasoning is broken.

Nature-Specific Style Rules

Sentence control

Paragraph control

De-AI Polish Rules

Remove or replace these AI-typical words:

Hedging (Academic Phrasebank patterns)

Transitions

Limitations acknowledgment

⛔⛔⛔ Output Contract (highest priority)

Single artifact: paper/main.md (UTF-8, ≥ 5KB)

Never produce: .tex / .bib / .cls / .aux / any LaTeX command.

Mandatory verification:


PASS=true

[ -f paper/main.md ] && SZ=$(wc -c < paper/main.md) || SZ=0

[ "$SZ" -ge 5120 ] && echo "✅ paper/main.md ($SZ)" || { echo "❌ paper/main.md missing"; PASS=false; }



if grep -qE '\\(begin|end|input|cite|ref|label|includegraphics|section|chapter)\{' paper/main.md; then

    echo "❌ LaTeX residue:"

    grep -nE '\\(begin|end|input|cite|ref|label|includegraphics|section|chapter)\{' paper/main.md | head -5

    PASS=false

fi



ls paper/*.tex paper/sections/*.tex 2>/dev/null | head -1 | grep -q . && { echo "❌ .tex files detected"; PASS=false; } || true



[ "$PASS" != true ] && { echo "⛔ verification FAILED"; exit 1; }

docx-cn-engine markdown conventions

(Same as paper-write-docx — see that SKILL or the brief recap below.)

Workflow

Step 0: Upstream check + resume


for f in PAPER_PLAN.md RESULTS.md; do

    [ -f "$f" ] && echo "✅ $f" || echo "  $f not found"

done

[ -f figures/all_results.json ] && echo "✅ figures/all_results.json" || true

ls figures/*.png figures/*.pdf 2>/dev/null | head -10



[ -f paper/main.md ] && cp paper/main.md "paper/main-backup-$(date +%s).md.bak"

Step 1: Identify paper type and target venue

Read PAPER_PLAN.md and TARGET_VENUE. Choose:

Step 1.5: Figure inventory

Before drafting, build inventory of available figures:


echo "=== Available figures ==="

ls -la figures/*.png figures/*.pdf 2>/dev/null

echo ""

echo "=== Available tables ==="

ls -la figures/TABLE_*.md 2>/dev/null

echo ""

echo "=== latex_includes.tex (caption reference only) ==="

cat figures/latex_includes.tex 2>/dev/null

Build mapping: figure ID → file → target section. Only embed figures whose files exist. Each figure needs ≥ 5 lines analysis after it before next visual.

⛔ Nature standard: Fig. 1 (overview/hero), Figs. 2-4 (main findings).

Step 2: Pre-fetch verified reference pool

⛔ Build verified pool BEFORE writing any citations.


PYTHON=""; for _c in "$MH_PYTHON" python python3; do [ -z "$_c" ] && continue; if $_c -c "import sys" >/dev/null 2>&1; then PYTHON="$_c"; break; fi; done; [ -z "$PYTHON" ] && PYTHON=python

mkdir -p _tmp



# Use descriptive citation keys: LastName_Year_topic_keywords

# Examples:

#   - vaswani_2017_attention_transformer

#   - lecun_2015_deep_learning_review

#   - TODO__crispr_cas9_off_target  (author/year unclear)



# Search by topic:

#   $PYTHON "$SCHOLAR_SCRIPT" bibtex "transformer attention mechanism" --max 5

Save verified entries to _tmp/_verified_refs.txt. Use ONLY verified entries while drafting.

Step 2.5: BibTeX verification (after body draft is done)


PYTHON=""; for _c in "$MH_PYTHON" python python3; do [ -z "$_c" ] && continue; if $_c -c "import sys" >/dev/null 2>&1; then PYTHON="$_c"; break; fi; done; [ -z "$PYTHON" ] && PYTHON=python

# List descriptive citation keys to _tmp/_topics.txt

while IFS= read -r key; do

    query=$(echo "$key" | sed 's/^TODO__//; s/_/ /g')

    echo "--- Fetching: $key (query: $query) ---"

    $PYTHON "$SCHOLAR_SCRIPT" bibtex "$query" --max 3

    sleep 0.5

done < _tmp/_topics.txt

For each result:

  1. match_label: "good" → use; "partial" → verify; "low" → retry or use WebSearch.
  1. match_score: < 0.3 → don't blindly trust.
  1. Format as [N] Author A, Author B. Title. Journal Year, vol(issue): pages. under ## References.
  1. References ordered by first-appearance in body.

Fallback: WebSearch on Google Scholar / PubMed / Semantic Scholar to verify title + authors + year manually.

⛔ References 参考区间: Nature 30–40; Nature Methods/Communications 50–60; Cell 70–80(经验参考区间,非硬下限)。⛔ Authenticity over count: these are targets for 真实检索到的 references — NEVER fabricate entries to hit the number. If real retrieval falls short, keep the real ones and note the gap; do not invent citations.

Step 3: Draft Results first

Anchor in evidence. Each subsection:

⛔ Cross-section context + figure-data binding (prevents the "two-layers" disconnect):

Required figures (Nature standard): Fig. 1 (overview), Fig. 2-4 (main findings). Each figure embedded with full caption.

Step 4: Draft Introduction

After Results, write Intro with hourglass:

Step 5: Title + Discussion

Step 6: Methods (reproducibility)

Step 7: Abstract last

150-200 words. Single paragraph. Cover: context → gap → method → finding → implication.

Step 8: Final structure


# [Title]



[Authors and affiliations]



## Abstract



[150-200 words single paragraph]



## Introduction



[Hourglass]



## Results



### [Result 1 subheading]



![Figure 1: ...](figures/fig1.png)



[Claim-Evidence-Boundary paragraph + ≥5 lines analysis]



### [Result 2 subheading]



...



## Discussion



[Widen + connect + bound]



## Methods



### Data and materials



### Analysis



### Statistics



### Data availability



### Code availability



## References



[1] ...

[2] ...

Step 9: Cross-review


mkdir -p _tmp

cat << 'EOF' > _tmp/_review_prompt.txt

Nature-style paper review. Focus on:

1. Hourglass structure

2. Claim-evidence-boundary in each paragraph

3. Title/abstract clarity

4. Reader-first ordering

5. Score (1-10) + top-3 improvements

## Paper:

EOF

cat paper/main.md >> _tmp/_review_prompt.txt

PYTHON=""; for _c in "$MH_PYTHON" python python3; do [ -z "$_c" ] && continue; if $_c -c "import sys" >/dev/null 2>&1; then PYTHON="$_c"; break; fi; done; [ -z "$PYTHON" ] && PYTHON=python

$PYTHON "$REVIEWER_SCRIPT" --prompt-file _tmp/_review_prompt.txt --thread-file _tmp/_reviewer_thread.json 2>&1 | tee _tmp/_cross_review.txt

Step 9.5: Self-review checklist

Run failure mode diagnosis on each section. Check (every box must be ✅):

If any box is ❌, fix before proceeding.

Step 10: Final verification

Re-run the Output Contract block. All ✅ before ending.

Writing Discipline (apply throughout drafting)

⛔ Style rules:

⛔ Numbers from data only.

⛔ NEVER cat figures/*_results.json. These result files often contain full-precision time-series arrays (tens of MB / hundreds of thousands of lines); reading them whole blows up the context — local models fail outright, and GPT-via-transit chokes on protocol translation of the oversized payload and stalls on repeated api_retry. The paper text only uses scalar values; the giant arrays are for figures, not prose. Before writing any results section, run the summarize script below for a KB-level overview (scalars shown verbatim — zero precision loss — only big arrays compressed to "length + range + first 3 samples"):


PYTHON=""; for _c in "$MH_PYTHON" python python3; do [ -z "$_c" ] && continue; if $_c -c "import sys" >/dev/null 2>&1; then PYTHON="$_c"; break; fi; done; [ -z "$PYTHON" ] && PYTHON=python

[ -f RESULTS.md ] && cat RESULTS.md

$PYTHON - <<'PY'

import json, os, glob

def summarize(v, depth=0):

    if isinstance(v, list):

        n=len(v); nums=[x for x in v if isinstance(x,(int,float))]

        if nums: return f'list[{n}] range=[{min(nums):.4g},{max(nums):.4g}] sample={v[:3]}'

        if v and isinstance(v[0], (list,dict)): return f'list[{n}] of {type(v[0]).__name__}, first_shape={len(v[0]) if hasattr(v[0],"__len__") else "?"}'

        return f'list[{n}] sample={str(v[:3])[:80]}'

    if isinstance(v, dict) and depth<2:

        return 'dict{'+', '.join(f'{k}: {summarize(x,depth+1)}' for k,x in list(v.items())[:6])+'}'

    return f'{type(v).__name__}={str(v)[:60]}'

for f in sorted(glob.glob('figures/*_results.json')):

    sz=os.path.getsize(f); d=json.load(open(f,encoding='utf-8'))

    print(f'\n=== {os.path.basename(f)} ({sz//1024}KB) ===')

    if isinstance(d, dict):

        for k,v in d.items(): print(f'  {k}: {summarize(v)}')

    else: print(f'  {summarize(d)}')

PY

Every scalar you need is in RESULTS.md or the range/sample above. If one scalar isn't fully shown, fetch just that value with $PYTHON -c "import json;d=json.load(open('figures/all_results.json'));print(d['key'])" — still never read the whole file. Copy exact numbers. No memory-based estimation.

Expansion strategies (substantive, not padding)

Key Rules (docx mode)


⛔ Figure embedding verification (MUST pass before finishing — file existence + actual reference in paper/main.md both required)

已并入共享脚本 paper_write_audit.sh(paper-write 族单一实现,_utils/ 与 shared-scripts/ 双副本)。怎么跑:

bash _utils/paper_write_audit.sh --mode docx   # 本目录无 _utils 时: bash skills/shared-scripts/paper_write_audit.sh --mode docx

怎么读结果:任何 MISSING: / ❌ 行或 Total missing embeddings > 0 都表示有图/表未嵌入 paper/main.md——逐项补齐后重跑至 0;⛔ DO NOT finish until missing = 0.。题注过长(>14 词)会报 Captions too long,把判据/参数/结论移入正文后重跑。该脚本同时执行下方 FIGURE_MANIFEST audit 与 universal paper audit;审计留痕由程序采集,不再手写 AUDIT_REPORT 审计文件;有引擎 finish 时以 output_contract/paper_write_gate 自动核验为准,本脚本为无引擎合同场景的兜底预检。

⛔ FIGURE_MANIFEST audit (run before finishing — must produce + embed every planned figure)

已并入共享脚本 paper_write_audit.sh(见上节,随 bash _utils/paper_write_audit.sh --mode docx 一并执行)。怎么读结果:✅ FIGURE_MANIFEST fully embedded = 通过;❌ MANIFEST: ... / ⛔ FIGURE_MANIFEST audit failed (N missing) = 计划图缺文件(.png/.pdf/.drawio)或未嵌入 paper/main.md——补产/补嵌后重跑。判据与原内联版逐项一致。

⛔ Universal paper-stage audit (shared across all writing steps)

已并入共享脚本 paper_write_audit.sh(见上节,随 bash _utils/paper_write_audit.sh --mode docx 一并执行;内部调 _utils/facts_audit.py --stage paper,无 PROBLEM_FACTS.json 时自动走简化模式)。检查项:[13] 正文结论与 results.json 一致(防"最优解 X 但正文写 Y");[14] 事件源归属。怎么读结果:输出 ❌ Universal paper-stage audit failed = 修正正文/results.json 后重跑。审计输出由程序采集留痕,不再手写 AUDIT_REPORT 审计文件。

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.