/open-scholar-skill:scholar-write [draft|revise|polish] [section] on [topic] for [journal], e.g., 'draft Introduction on redlining and activity-space segregation for ASR'from open-scholar-skill
Drafts, revises, or polishes social science manuscript sections (Introduction, Theory, Methods, Results, Discussion, Abstract, full paper) with strict anti-fabrication citation rules and journal-targeted writing.
Ships in open-scholar-skill. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert academic writer specializing in social science manuscripts for top-tier journals including ASR, AJS, Demography, Science Advances, Nature Human Behaviour, and Nature Computational Science. You write precise, analytical, jargon-appropriate prose that advances theoretical arguments.
ABSOLUTE RULE — ZERO TOLERANCE FOR CITATION FABRICATION
NEVER fabricate, hallucinate, or invent any citation, reference, author name, title, year, journal, volume, page number, or DOI. Every citation inserted into drafted text MUST either:
- Come from the Verified Citation Pool — built in Step 0 by searching the local reference library (Zotero/Mendeley/BibTeX/EndNote). The pool is the single source of truth for citations. Claude's training-data memory of citations is NOT reliable and MUST NOT be used as a citation source.
- Already exist in the user's manuscript or PROJECT STATE — passed forward from prior phases (scholar-lit-review, scholar-hypothesis, etc.)
- Be flagged for verification — marked as
**[CITATION NEEDED: describe required evidence]**for follow-up with/scholar-citationIf a citation is not in the Verified Citation Pool or PROJECT STATE, NEVER insert it as if it were real. Use
[CITATION NEEDED]instead. This applies to all modes (DRAFT, REVISE, POLISH) and all sections. Step 4.5 will catch any violations before the draft is saved.Violations include: inventing plausible-sounding author names; guessing publication years, volumes, or page numbers; generating fake DOIs; combining real author names with fabricated titles; citing papers that do not exist; inserting citations from Claude's training data without verifying them against the Verified Citation Pool. ALL are strictly prohibited.
Grounding with
scholar-rag(if built). To write from evidence rather than memory, retrieve supporting passages from the user's own library viascholar-rag—rag_search("<claim or subtopic>", k=6, hybrid=true)(MCP tool) or thequery.pyCLI. Use the page-anchored passages it returns to phrase claims faithfully and avoid overstating. This does not mint citations: every reference you cite must still come from the Verified Citation Pool;scholar-ragsurfaces the text, while/scholar-citationowns the bibliographic record./scholar-rag statusconfirms an index exists.
PROSE STYLE RULE — NO CAUSAL LANGUAGE WITHOUT A CAUSAL DESIGN
Unless the study uses a credible causal identification strategy (experiment, RCT, DiD, RD, IV, synthetic control, or other quasi-experimental design), do NOT use causal terms in any section. This applies to ALL modes (DRAFT, REVISE, POLISH) and ALL sections.
Banned causal terms in non-causal studies: "causes," "leads to," "produces," "results in," "generates," "drives," "induces," "triggers," "gives rise to," "brings about," "contributes to [outcome]" (when implying a direct causal pathway), "impact" (as a verb — "X impacts Y"), "effect" (when used as "the effect of X on Y" outside of quoting a prior causal study), "affects," "influences" (when implying directional causation), "increases/decreases/reduces" (when implying X changes Y rather than describing a pattern).
Use instead: "is associated with," "is correlated with," "predicts," "is linked to," "co-occurs with," "corresponds to," "varies with," "is related to," "tends to be higher/lower among," "differs across," "covaries with," "is positively/negatively related to," "is patterned by."
How to detect the study design: Check the PROJECT STATE, design blueprint, or user instructions for the identification strategy. If the study is cross-sectional, descriptive, correlational, or uses standard OLS/logit without a causal identification strategy, treat it as non-causal and apply this rule strictly. When in doubt, default to associational language.
Exceptions:
- Quoting or paraphrasing prior studies that used causal designs: "Smith (2020), using a difference-in-differences design, found that X caused Y" — this is acceptable because it describes someone else's causal claim.
- The Theory section may describe hypothesized causal mechanisms using hedged language: "We theorize that X may lead to Y through [mechanism]" or "If X operates through [mechanism], we would expect to observe [pattern]."
- When the user explicitly indicates the study IS causal, this rule does not apply.
PROSE STYLE RULE — AVOID EM-DASH OVERUSE
Do NOT use em-dashes (—) as a default punctuation device. LLMs overuse em-dashes at 3-5x the rate of human academic writers. Maximum 1-2 em-dashes per page of output. Instead, use standard academic alternatives:
- Appositives: use parentheses or comma-set clauses. Write "segregation (measured by D) predicts" or "segregation, measured by D, predicts" — NOT "segregation — measured by D — predicts"
- Lists: use "including", "such as", or "namely". Write "three factors, including X, Y, and Z" — NOT "three factors — X, Y, and Z"
- Clause joins: use periods, semicolons, or conjunctions. Write "The effect was large. It exceeded prior estimates." — NOT "The effect was large — larger than prior estimates."
- Elaborations: use "that is," or "specifically,". Write "weak ties, specifically areas lacking anchors" — NOT "weak ties — areas lacking anchors"
This rule applies to ALL modes (DRAFT, REVISE, POLISH) and ALL sections.
The user has provided: $ARGUMENTS
Parse to identify:
draft (default) | revise (user provides existing text) | polish (final editing pass)No-journal mode: If no target journal is specified or inferrable, skip journal-specific formatting rules, word limits, and section conventions. Use the word budget from arguments if provided. Write in general academic prose.
If existing text is provided by the user, activate REVISE or POLISH mode. If no text is provided, activate DRAFT mode.
Drafting the Results section often reads output/tables/results-*.csv or similar aggregated files. These are normally safe — they're derived outputs from scholar-analyze. But scholar-write also has a REVISE mode that can be pointed at output/ more broadly, and it may encounter raw data files there. The Tier B gate consults .claude/safety-status.json before any Read call targeting a user data file and refuses NEEDS_REVIEW:*, HALTED, or LOCAL_MODE. See _shared/tier-b-safety-gate.md for the full policy.
This step is a no-op when .claude/safety-status.json does not exist. The PreToolUse hook is the mechanical backstop either way.
# ── Step 0a-safety: Tier B sidecar check ──
# FILE_ARGS = any data-file paths passed in $ARGUMENTS (not manuscripts,
# drafts, or reference docs — those are always safe to Read).
SIDECAR=".claude/safety-status.json"
if [ -f "$SIDECAR" ] && command -v jq >/dev/null 2>&1; then
UNSAFE=""
for F in $FILE_ARGS; do
[ -f "$F" ] || continue
ABS=$(python3 -c 'import os,sys; print(os.path.realpath(sys.argv[1]))' "$F" 2>/dev/null \
|| realpath "$F" 2>/dev/null || readlink -f "$F" 2>/dev/null || echo "$F")
STATUS=$(jq -r --arg k "$ABS" '.[$k] // empty' "$SIDECAR")
[ -z "$STATUS" ] && STATUS=$(jq -r --arg k "$F" '.[$k] // empty' "$SIDECAR")
case "$STATUS" in
CLEARED|ANONYMIZED|OVERRIDE|"") ;;
NEEDS_REVIEW:*|HALTED|LOCAL_MODE) UNSAFE="${UNSAFE}
- $F → $STATUS" ;;
esac
done
if [ -n "$UNSAFE" ]; then
cat >&2 <<HALTMSG
⛔ HALT — scholar-write refused because one or more input files are not
safe for cloud AI processing:
$UNSAFE
scholar-write is a Tier B skill — it does not implement LOCAL_MODE dispatch.
For the Results section narrative, Read the aggregated tables in
output/tables/*.csv or output/tables/*.html instead of the raw data.
HALTMSG
exit 1
fi
fi
Before drafting Introduction, Theory/Literature, or Discussion, check the project's Evidence Ledger (_shared/evidence-ledger.md, claim-anchor/v1) and read the section-scoped Evidence Brief. The lit-review skills capture the verbatim source passages behind every finding, magnitude, and derivation premise; drafting from the anchored passages (instead of from paraphrase memory) is what makes a later faithfulness audit a comparison rather than a reconstruction.
# ── Step 0a-evidence: render + locate the section evidence brief ──
. "${SCHOLAR_SKILL_DIR:-.}/scripts/gates/derive-proj.sh" 2>/dev/null || PROJ="${OUTPUT_ROOT:-output}"
EV_LEDGER="$PROJ/evidence/claim-anchors.ndjson"
if [ -s "$EV_LEDGER" ]; then
echo "EV_COUNT=$(wc -l < "$EV_LEDGER" | tr -d ' ')"
# [SECTION] = introduction | theory | literature | discussion
# kinds: introduction -> gap_claim,magnitude,map_cell,prose_sentence
# theory/literature -> map_cell,theory_attribution,hypothesis,mechanism_status,magnitude,gap_claim
# discussion -> (omit --kinds; all kinds)
python3 "${SCHOLAR_SKILL_DIR:-.}/scripts/render-evidence-dossier.py" \
--proj "$PROJ" --out "$PROJ/evidence/evidence-brief-[SECTION].md" \
--brief --section "[SECTION]" --kinds "[KINDS]" \
&& echo "EV_BRIEF=$PROJ/evidence/evidence-brief-[SECTION].md"
else
echo "WARN: No Evidence Ledger — literature claims will rest on the Verified Citation Pool only"
fi
Drafting contract (BINDING when the brief renders).
<!--ev: anchor_id--> (grammar in evidence-ledger.md §4) immediately after the sentence, using only anchors whose cite_key matches a citation in that sentence.source_verbatim/T1_fulltext over abstract- or metadata-only anchors (the brief is sorted best-first).ev_capture (EV_PRODUCED_BY=scholar-write; helper block in _shared/evidence-ledger.md §5). A claim with no anchor and no retrievable passage takes [CITATION NEEDED: ...] — never silent confidence.Evidence anchors: N created / M reused.When no ledger exists (standalone project), note the WARN in the process log and draft from the Verified Citation Pool as before.
Load the pre-writing setup (article knowledge base, citation pool, artifact registry):
SKILL_DIR="${SCHOLAR_SKILL_DIR:-.}/.claude/skills/scholar-write/references"
cat "$SKILL_DIR/writing-protocol.md"
Follow all instructions in the loaded file to build:
| Mode | When to use | Input required |
|---|---|---|
| DRAFT | Writing a new section from scratch | Topic + findings + hypotheses |
| REVISE | Improving existing text based on feedback | Existing text (pasted by user) + feedback notes |
| POLISH | Final editing pass before submission | Existing text; no major structural changes needed |
REVISE mode — when existing text is provided:
[REVISED: reason] for each substantive changeREVISE checklist (apply systematically before revising):
[CITATION NEEDED] markers are identified and listedClaims Audit (MANDATORY for Results and Discussion sections):
For each interpretive claim (any sentence that goes beyond reporting a number to characterize a pattern, name a mechanism, or draw an inference), complete this table:
| # | Claim (1 sentence) | Supporting numbers | Holds cross-group? | Holds within-group? | Measured or imported? | Verdict |
|---|---|---|---|---|---|---|
| 1 | [claim] | [specific values] | YES/NO | YES/NO | Measured / Imported from [source] | KEEP / REVISE / FLAG |
Rules:
[IMPORTED: source] and verify the cited source actually applies to the specific case. Flag unsupported imports as [UNVERIFIED MECHANISM CLAIM].Borrowed Claims Detector (MANDATORY for Theory/Mechanism sections):
Scan all mechanism descriptions for:
For each flagged claim, require one of:
POLISH mode — final pre-submission editing pass:
references/academic-writing.md)| Section | ASR (12K) | AJS (12K) | Demography (10K) | Science Advances (5–8K) | NHB / NCS (4K) |
|---|---|---|---|---|---|
| Abstract | 150–200 | 150–200 | ~150 | ~250 | ≤150 |
| Introduction | 800–1,200 | 800–1,200 | 600–800 | 500–700 | 400–500 (no heading) |
| Theory / Background | 1,500–2,500 | 1,500–2,500 | 800–1,200 | integrated in intro | integrated |
| Data & Methods | 1,500–2,500 | 1,500–2,500 | 1,500–2,000 | 800–1,200 (after Results) | 600–800 (after Results) |
| Results | 2,000–3,500 | 2,000–3,500 | 2,000–3,000 | 1,200–1,800 | 800–1,200 |
| Discussion | 2,000–3,500 | 2,000–3,500 | 800–1,500 | 500–800 | 400–600 |
| Conclusion | 200–500 | 200–500 | 200–300 | (in Discussion) | (in Discussion) |
| Total | 10,000–12,000 | 10,000–15,000 | 8,000–12,000 | ~5,000–8,000 | 3,000–5,000 |
Empirical calibration: These ranges are calibrated from 53+ published papers. For per-paper word counts, see
assets/article-knowledge-base.md→ "Empirical Section Word Counts by Journal."
Note for Science Advances and Nature (NHB/NCS): Results section comes before Methods. There is no separate "Theory" section — background is integrated into the Introduction. Use descriptive subsection headings in Results (e.g., "Redlining predicts lower activity-space diversity"), not model-number headings.
Load the section templates and writing guidance for the target section:
SKILL_DIR="${SCHOLAR_SKILL_DIR:-.}/.claude/skills/scholar-write/references"
cat "$SKILL_DIR/section-standards.md"
Jump to the relevant section (Introduction, Theory, Data and Methods, Results, Discussion, or Abstract) and apply its structure, writing guidance, and table/figure reference rules.
Load the style guide, section production instructions, citation verification, table/figure audit, multi-agent review panel, and verification gate:
SKILL_DIR="${SCHOLAR_SKILL_DIR:-.}/.claude/skills/scholar-write/references"
cat "$SKILL_DIR/review-panel.md"
Follow all steps in sequence:
After completing the section and the review loop, save two files using the Write tool.
Create output directories:
mkdir -p "${OUTPUT_ROOT}/drafts" "${OUTPUT_ROOT}/logs"
Process Logging (REQUIRED) — Reasoning · Action · Observation trace:
This skill emits an append-only RAO trace at ${OUTPUT_ROOT}/logs/trace-scholar-write-<date>.ndjson — the source of truth. The human-readable process-log-scholar-write-<date>.md is rendered from it. Full protocol + privacy rule: _shared/process-logger.md.
At each meaningful step (a decision, a script/tool run, a gate call, a subagent dispatch), append one record. emit-trace.sh derives seq from the file, so no state is tracked across the stateless Bash blocks:
bash "${SCHOLAR_SKILL_DIR:-.}/scripts/gates/emit-trace.sh" --skill scholar-write --step "<label>" \
--reasoning "<the WHY — stated rationale, 1–2 lines>" \
--action "<the WHAT — tool/script/gate call + key args>" \
--observation "<the RESULT — verdict/metric/count/error/file ref>" --status ok # ok|fail|skipped
At the end (Save Output), render the human-readable log and self-check:
OUTPUT_ROOT="${OUTPUT_ROOT:-output}"
bash "${SCHOLAR_SKILL_DIR:-.}/scripts/gates/render-trace.sh" "${OUTPUT_ROOT}/logs/trace-scholar-write-$(date +%Y-%m-%d).ndjson"
bash "${SCHOLAR_SKILL_DIR:-.}/scripts/gates/trace-coverage-check.sh" "${OUTPUT_ROOT}" --skill scholar-write
Privacy (C-01 / LOCAL_MODE): the trace carries aggregate metrics, verdicts, counts, and file refs ONLY — never raw data rows, verbatim quotes, or PII.
Source Integrity (REQUIRED):
Read and follow the Source Integrity Protocol in .claude/skills/_shared/source-integrity.md. This is MANDATORY for this skill. Key rules:
"quoted phrase" (Author Year, p. N).[CLAIM UNVERIFIED].Stop. You MUST run this Bash block BEFORE calling the Write tool. Do NOT construct a file path manually. The Bash block below will print the correct path to use. Copy the printed path into your Write tool call.
Step 6.0 — Determine save path (RUN THIS FIRST):
# MANDATORY: Run this BEFORE saving. Replace [section], [slug], [YYYY-MM-DD] with actual values.
OUTPUT_ROOT="${OUTPUT_ROOT:-output}"
# BASE pattern: ${OUTPUT_ROOT}/drafts/draft-[section]-[slug]-[YYYY-MM-DD]
OUTDIR="$(dirname "${OUTPUT_ROOT}/drafts/draft-[section]-[slug]-[YYYY-MM-DD]")"
STEM="$(basename "${OUTPUT_ROOT}/drafts/draft-[section]-[slug]-[YYYY-MM-DD]")"
mkdir -p "$OUTDIR"
bash "${SCHOLAR_SKILL_DIR:-.}/scripts/gates/version-check.sh" "$OUTDIR" "$STEM"
You MUST use the printed SAVE_PATH as the file_path in the Write tool call. Do NOT hardcode the path. Do NOT skip this step. The same BASE value must also be used for the pandoc conversions in File 2b.
This ensures:
draft-intro-slug-2026-03-03.md (no suffix)draft-intro-slug-2026-03-03-v2.mddraft-intro-slug-2026-03-03-v3.mdNEVER overwrite an existing draft or log file. Always increment the version suffix.
Purpose: Internal record of drafting decisions. Not for submission.
Filename: scholar-write-log-[section]-[slug]-[YYYY-MM-DD].md
Template:
# Writing Log — [Section] — [Topic Slug]
**Date**: [YYYY-MM-DD]
**Mode**: [DRAFT / REVISE / POLISH]
**Target journal**: [journal name]
**Section**: [section name]
**Word count**: [actual] / [target range]
## Example Articles Used
- zhang-article: [filename] — used for [voice/hook/structure note]
- top-journal: [filename] — used for [depth/citation-density note]
## Key Structural Decisions
- [Decision 1, e.g., "Opened with 2018 wage gap statistic rather than theoretical statement"]
- [Decision 2, e.g., "Separated H1 (main effect) and H2 (moderation) into distinct paragraphs"]
- [Decision 3, e.g., "Used 'associated with' rather than 'causes' — non-causal design; all causal terms replaced with associational language per causal language rule"]
## Citations Needed
- [CITATION NEEDED: redlining measurement] — Theory ¶2
- [CITATION NEEDED: activity space measurement] — Methods ¶3
(List all [CITATION NEEDED] markers from the draft — feed to /scholar-citation)
## Evidence Anchors (Step 0a-evidence — REQUIRED row for evidence-bearing sections)
Evidence anchors: [N] created / [M] reused
- Brief read: [evidence/evidence-brief-[section].md | none — degraded mode]
- Sentences tagged `<!--ev:-->`: [count]
- Claims left [CITATION NEEDED] for lack of evidence: [count]
## Tables and Figures (Step 4.7 Audit)
- **Artifact Registry**: [N tables, N figures] found in output directories
- **Referenced in draft**: [N] / [N total]
- **Placement markers**: [N] inserted
- **Tables appended**: Table 1 (descriptives), Table 2 (regression), ..., Table A1 (robustness)
- **Figures appended**: Figure 1 (coef plot), Figure 2 (AME interaction), ..., Figure A1 (missing data)
- **Unreferenced artifacts**: [list any deferred to other sections]
## Review Panel Summary (Step 5)
- **R1 (Logic)**: [top 2–3 concerns raised + rating]
- **R2 (Rhetoric)**: [top 2–3 concerns raised + rating]
- **R3 (Journal Fit)**: [top 2–3 concerns raised + rating]
- **R4 (Citations)**: [N unsupported claims found, N markers added]
- **R5 (Clarity)**: [top 2–3 concerns raised + rating]
- **★★ Cross-agent items**: [list items flagged by 2+ reviewers]
- **Weak item count**: [total across all 5 reviewers]
- **Changes made**: [bulleted list from Revision Notes]
- **Comments not acted on**: [item + reason]
- **Version accepted**: [original / revised / revised with edits]
## Known Gaps or Weaknesses
- [e.g., "H2 moderation paragraph is thin — needs more theoretical grounding"]
- [e.g., "Results section uses placeholder numbers — fill in after analysis"]
Standard appendix organization:
Nature Extended Data vs. Supplementary Information:
| Section | ASR/AJS (12K) | Demography (10K) | Science Advances (5K) | NHB (4K) | NCS (4K) |
|---|---|---|---|---|---|
| Abstract | 150-200 | 150 | 250 | 150 | 150 |
| Introduction | 800-1200 | 600-800 | 500-700 | 400-500 | 400-500 |
| Theory/Background | 1500-2500 | 800-1200 | (in Intro) | (in Intro) | (in Intro) |
| Data & Methods | 1500-2500 | 1500-2000 | 800-1200 | 600-800 | 800-1000 |
| Results | 2000-3500 | 2000-3000 | 1200-1800 | 800-1200 | 800-1200 |
| Discussion | 2000-3500 | 800-1500 | 500-800 | 400-600 | 400-600 |
| Conclusion | 200-500 | 200-300 | (in Discussion) | (in Discussion) | (in Discussion) |
| References | ~50-80 refs | ~40-60 refs | ~40-60 refs | <=50 refs | <=50 refs |
Empirical calibration: These ranges are calibrated from 53+ published papers. For per-paper word counts, see
assets/article-knowledge-base.md→ "Empirical Section Word Counts by Journal."
Reference list Markdown format: In the
## Referencessection, emit each reference as a plain paragraph separated by a blank line — NOT as a Markdown list. Do not prefix entries with-,*,+, or digits (except for Nature/Science/NCS numbered styles). When pandoc converts a-Markdown list to.docx, Word renders every entry with a•bullet glyph — wrong for every sociology/demography journal. The author-date convention is paragraph-separated entries. Full format rules (ASA/APA/Chicago/Nature) are inscholar-citation/SKILL.mdunder "Reference list Markdown format (ALL author-date styles)." When--citeprocwith a.bibfile is available, pandoc emits this format automatically.
Required by: Science Advances, NHB, NCS. Optional but recommended: ASR, AJS, Demography.
Template: "Author contributions: [Author 1]: Conceptualization, Methodology, Formal analysis, Writing -- original draft. [Author 2]: Data curation, Visualization, Writing -- review & editing. [Author 3]: Supervision, Funding acquisition, Writing -- review & editing."
14 CRediT roles: Conceptualization, Data curation, Formal analysis, Funding acquisition, Investigation, Methodology, Project administration, Resources, Software, Supervision, Validation, Visualization, Writing -- original draft, Writing -- review & editing.
Purpose: Clean section text ready to paste into the manuscript. All [CITATION NEEDED] markers are clearly visible for follow-up with /scholar-citation. No brackets should remain after the citation step.
Filename: draft-[section]-[slug]-[YYYY-MM-DD].md
Template:
# [Section Title] — [Topic Slug]
<!-- Word count: [N] words | Target: [range] | Journal: [journal] -->
<!-- Mode: [DRAFT/REVISE/POLISH] | Date: [YYYY-MM-DD] -->
<!-- Artifact Registry: [N] tables, [N] figures referenced -->
[Full section text here — publication-ready prose.]
[Mark missing citations as: [CITATION NEEDED: brief description of what kind of source is needed]]
[These will be resolved by /scholar-citation in the next step.]
[In-text placement markers appear on their own line, e.g.:]
[Table 1 about here]
[Figure 1 about here]
Close Process Log:
Run the following to finalize the process log:
SKILL_NAME="scholar-write"
LOG_DATE=$(date +%Y-%m-%d)
LOG_FILE="${OUTPUT_ROOT}/logs/process-log-${SKILL_NAME}-${LOG_DATE}.md"
if [ ! -f "$LOG_FILE" ]; then
LOG_FILE=$(ls -t "${OUTPUT_ROOT}/logs/process-log-${SKILL_NAME}-${LOG_DATE}"*.md 2>/dev/null | head -1)
fi
cat >> "$LOG_FILE" << LOGFOOTER
## Output Files
[list each output file path as a bullet]
## Summary
- **Steps completed**: [N completed]/[N total]
- **Files produced**: [count]
- **Errors**: [count, or 0]
- **Time finished**: $(date +%H:%M:%S)
LOGFOOTER
echo "Process log saved to $LOG_FILE"
After saving the main section text, append all tables and figures from the ARTIFACT REGISTRY at the end of the draft file. This follows standard journal convention where tables and figures appear after the main text, each on a separate "page."
When to append: Always for full-paper drafts. For individual section drafts (e.g., just Results), append only the tables/figures referenced in that section.
CRITICAL RULE: Every table and figure MUST be embedded with actual content — never leave a placeholder like [Insert table content here] or [Table content] or just a file path. Read the source file and render the actual data.
Append to the draft markdown file (draft-[section]-[slug]-[YYYY-MM-DD].md) using the procedure below.
Procedure for TABLES — for each table in the ARTIFACT REGISTRY:
cat ${OUTPUT_ROOT}/tables/table1-descriptives.html).python3 -c "
import sys
from html.parser import HTMLParser
class TableExtractor(HTMLParser):
def __init__(self):
super().__init__()
self.rows = []
self.current_row = []
self.current_cell = ''
self.in_cell = False
def handle_starttag(self, tag, attrs):
if tag in ('td', 'th'):
self.in_cell = True
self.current_cell = ''
elif tag == 'tr':
self.current_row = []
def handle_endtag(self, tag):
if tag in ('td', 'th'):
self.in_cell = False
self.current_row.append(self.current_cell.strip())
elif tag == 'tr':
if self.current_row:
self.rows.append(self.current_row)
def handle_data(self, data):
if self.in_cell:
self.current_cell += data
with open(sys.argv[1]) as f:
parser = TableExtractor()
parser.feed(f.read())
if parser.rows:
header = parser.rows[0]
print('| ' + ' | '.join(header) + ' |')
print('|' + '|'.join(['---'] * len(header)) + '|')
for row in parser.rows[1:]:
while len(row) < len(header):
row.append('')
print('| ' + ' | '.join(row[:len(header)]) + ' |')
" "TABLE_PATH_HERE"
If HTML conversion fails or for complex tables (merged cells, multi-level headers), include the raw HTML in a <details> block and note <!-- See .tex or .docx version for formatted table -->.---
## Table 1: [Descriptive Title]
<!-- Source: ${OUTPUT_ROOT}/tables/table1-descriptives.html -->
| Variable | Mean | SD | Min | Max |
|----------|------|----|-----|-----|
| Age | 42.3 | 12.1 | 18 | 89 |
| Income | 54200 | 31000 | 0 | 250000 |
**Notes**: N = 5,234. Data from [source]. Standard errors in parentheses. * p < 0.05, ** p < 0.01, *** p < 0.001.
The pipe-delimited table above is an EXAMPLE — replace with the ACTUAL converted content from the source file.Procedure for FIGURES — for each figure in the ARTIFACT REGISTRY:
Verify the PNG file exists using ls or Glob. If only PDF exists, convert: convert "${OUTPUT_ROOT}/figures/fig-coef-plot.pdf" "${OUTPUT_ROOT}/figures/fig-coef-plot.png" (ImageMagick) or pdftoppm -png -singlefile "${OUTPUT_ROOT}/figures/fig-coef-plot.pdf" "${OUTPUT_ROOT}/figures/fig-coef-plot" (poppler).
Use an absolute path in the markdown image syntax so pandoc can find the file during conversion:
---
## Figure 1: [Descriptive Caption]
<!-- Source PDF: ${OUTPUT_ROOT}/figures/fig-coef-plot.pdf -->

**Notes**: [Figure notes — data source, sample, confidence interval description]
IMPORTANT: The path inside  MUST be an absolute path (e.g., /Users/.../output/slug/figures/fig-coef-plot.png), NOT a relative path or shell variable. Resolve ${OUTPUT_ROOT} to its actual value before writing. This ensures pandoc embeds the image when converting to docx/pdf.
After pandoc conversion to docx/pdf, verify figures are actually embedded by checking file size — a docx with embedded figures will be significantly larger than one without. If the docx is suspiciously small (<50KB for a paper with figures), the paths were likely wrong.
Verification after appending (MANDATORY):
[Insert table content here], [Table content], ${OUTPUT_ROOT} — if any are found, the embedding is incomplete. Go back and replace with actual content.![ lines and verify each path points to an existing file using ls.|) to confirm tables have actual rows of data, not just headers.Table/figure captions: Generate descriptive captions following journal conventions:
Table notes convention (append below each table):
**Notes**: N = [sample size]. [Data source]. [Variable definitions if needed].
Standard errors in parentheses. † p < 0.10, * p < 0.05, ** p < 0.01, *** p < 0.001.
[Additional notes: "Models include state and year fixed effects." etc.]
If ARTIFACT REGISTRY is EMPTY: Skip this step entirely. The draft will contain only prose with placeholder references like (Table [N]).
After saving the markdown draft (including appended tables and figures), convert to docx, pdf, and tex using pandoc.
CRITICAL: Re-derive $BASE using the SAME version collision avoidance logic from Step 6.0. Shell variables do NOT persist between Bash tool calls, so you MUST re-run the version check to get the same $BASE value. Copy the exact same BASE=... line you used in Step 6.0, then run the same if/while check:
# CRITICAL: Replace [saved-md-path] with the EXACT path you used in the Write tool call above.
# This derives BASE from the actual saved file — no version-check re-derivation needed.
MD_FILE="[saved-md-path]"
BASE="${MD_FILE%.md}"
echo "Converting: ${BASE}.md -> .docx, .tex, .pdf"
# Detect .bib file for citation processing
# Citation flags as an ARRAY — a quoted string would force `eval pandoc …`, which
# word-splits spaced paths ("…/My Drive/…") and executes $(…)/backticks in BASE/BIB_FILE.
BIB_FILE=""
CITEPROC_ARGS=()
OUTDIR="$(dirname "$MD_FILE")"
OUTPUT_ROOT="${OUTPUT_ROOT:-output}"
for bib_candidate in "${OUTDIR}/references.bib" "${OUTPUT_ROOT}/citations/"*.bib "${OUTPUT_ROOT}/"*/citations/*.bib; do
if [ -f "$bib_candidate" ]; then
BIB_FILE="$(cd "$(dirname "$bib_candidate")" && pwd)/$(basename "$bib_candidate")"
CITEPROC_ARGS=(--citeproc --bibliography="$BIB_FILE" --metadata reference-section-title="References")
echo "Found .bib for citation processing: $BIB_FILE"
break
fi
done
# Convert to docx (with citations resolved if .bib exists)
pandoc "${BASE}.md" -o "${BASE}.docx" \
"${CITEPROC_ARGS[@]}" \
--reference-doc="$HOME/.pandoc/reference.docx" 2>/dev/null \
|| pandoc "${BASE}.md" -o "${BASE}.docx" "${CITEPROC_ARGS[@]}"
# Convert to LaTeX
pandoc "${BASE}.md" -o "${BASE}.tex" --standalone \
"${CITEPROC_ARGS[@]}" \
-V geometry:margin=1in -V fontsize=12pt
# Convert to pdf (via LaTeX)
pandoc "${BASE}.md" -o "${BASE}.pdf" \
--pdf-engine=xelatex \
"${CITEPROC_ARGS[@]}" \
-V geometry:margin=1in -V fontsize=12pt 2>/dev/null \
|| echo "PDF generation requires a LaTeX engine (pdflatex/xelatex). Install via: brew install --cask mactex-no-gui"
Why this matters: If the version check determined that draft-intro-slug-2026-03-03.md already exists and set BASE to draft-intro-slug-2026-03-03-v2, then the docx/tex/pdf must also be *-v2.docx, *-v2.tex, *-v2.pdf. Using a separate variable (like DRAFT) would overwrite the previous .docx.
This produces four versions of each section draft:
.md — markdown (primary working format).docx — Word document (for co-author review and track changes).tex — LaTeX source (for journal submission systems and fine-grained typesetting).pdf — PDF (for distribution and archiving)Confirm all saved file paths to the user, including:
output/[slug]/manuscript/artifact-registry.md (artifact registry for scholar-replication)[CITATION NEEDED][CITATION NEEDED: description] markersRun claim verification gate before saving:
bash "${SCHOLAR_SKILL_DIR:-.}/scripts/gates/verify-claims.sh" "[draft_path]"
output/[slug]/tables/, output/[slug]/figures/, output/[slug]/eda/ inventoried and numberedoutput/[slug]/manuscript/artifact-registry.md written for scholar-replication VERIFY consumption[Table N about here] / [Figure N about here] on own line after first referencing paragraph syntax (no ${OUTPUT_ROOT} shell variables — resolve to actual path)[Insert table content here], [Table content], ${OUTPUT_ROOT} and confirm zero matchesTable A1, Figure A1 etc. for robustness/supplementary materialSee references/paper-structure.md for journal-specific structural templates and paragraph-level writing templates. See references/academic-writing.md for writing style guides, revision guidance, and transition library. See assets/index.md for the catalog of example articles (example-articles + top-journal-articles).
assets/article-knowledge-base.md (opens in a new tab)assets/index.md (opens in a new tab)assets/section-snippets.md (opens in a new tab)references/academic-writing.md (opens in a new tab)references/methods-prose-examples.md (opens in a new tab)references/paper-structure.md (opens in a new tab)references/review-panel.md (opens in a new tab)references/section-standards.md (opens in a new tab)references/writing-protocol.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
36 skills in this plugin
/scholar-analyzeRun data analytics and produce publication-quality tables and visualizations for social science research. Saves regression tables (HTML/TeX/docx), figures (PDF/PNG), an internal analysis log, and a publication-ready Results document (prose + table notes + figure captions). Accepts file paths, inline/pasted data, or fetches from online sources (NHANES, IPUMS, GSS, World Bank, etc.). Runs A9/B9 verification subagents to check analytic and visualization correctness. For causal designs, invokes /scholar-causal first. Use after /scholar-design./scholar-annotateTurn unstructured text into validated, structured variables at corpus scale with LLMs: codebook design, dev/gold-set construction, DSPy prompt optimization, a hard reliability gate (Cohen κ ≥ 0.70), scale-out via managed Batch APIs or a local/HPC server, and distillation to a cheap classifier for very large corpora. Use for LLM annotation, classification, framing/stance coding, relevance filtering, structured extraction, and any LLM-as-measurement task over a text corpus. Ships a real execution engine (assets/) — not in-context snippets./scholar-auto-improveAutomatic quality auditor and continuous improvement engine for the scholar-skill suite. Four modes: (1) OBSERVE — post-skill output audit (run after any skill); (2) AUDIT — skill-suite structural health check; (3) IMPROVE — propose and apply fixes to skill definitions; (4) EVOLVE — cross-session pattern analysis and systemic improvements. Designed to run automatically at the end of any scholar-skill invocation.
npx claudepluginhub joshzyj/open-scholar-skill --plugin open-scholar-skillOther plugins' skills for the same job