Converts scholarly PDFs or arXiv LaTeX sources into structured markdown repositories with indexed sections, README, and token counts. Useful for researchers reading papers in LLM-friendly formats.
Ships in document-authoring-and-visualization. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Convert a scholarly reference into a git-initialized repository of well-organized markdown files. Accepts a bibliographic citation plus local PDF path(s), producing modular section files, a TOC index, and a README with token counts.
Parse $ARGUMENTS for:
~/projects/ (e.g. modeling-workspace)~/projects/modeling-workspace/modeling-references).
When provided, the completed repo is added as a subtree to the aggregate after GitHub publish.If arguments are ambiguous or incomplete, ask the user to clarify before proceeding.
Extract from the reference: title, authors, year, DOI and/or arXiv ID.
Derive the repo name in lowercase kebab-case as short-title-or-author-year-descriptor.
Examples: effective-theories-in-physics, arruda-2025-compositional-amortized-inference, ventre-2023-one-model-fits-all.
Check for arXiv preprint availability. If an arXiv ID is provided or discoverable from the DOI, Path A (LaTeX source) is available. Otherwise, use Path B (PDF-only).
Present the resolved inputs, chosen pathway, and target path ~/projects/<workspace>/<repo-name>/ to the user for confirmation before proceeding.
git-lfs must be installed and available on PATH.
All binary file types used in scholarly documents are tracked via git-lfs to keep repository sizes manageable and avoid GitHub's 100 MB file size limit.
The comprehensive tracking list covers: *.pdf, *.jpeg, *.jpg, *.png, *.eps, *.gif, *.webp, *.tiff, *.svg.
When arXiv LaTeX source is available, download and convert.
mkdir -p ~/projects/<workspace>/<repo-name> && cd "$_"
git init && git commit --allow-empty -m "initial commit (empty)"
git lfs install --local
cat > .gitattributes << 'GITATTR'
*.pdf filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.eps filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.tiff filter=lfs diff=lfs merge=lfs -text
*.svg filter=lfs diff=lfs merge=lfs -text
GITATTR
git add .gitattributes && git commit -m "chore: configure git-lfs for binary files"
curl -L "https://arxiv.org/e-print/<arxiv-id>" -o arxiv-source.tar.gz
mkdir -p latex && tar -xzf arxiv-source.tar.gz -C latex/
rm arxiv-source.tar.gz
git add latex/ && git commit -m "feat: add arXiv LaTeX source"
Identify the main .tex file (the one containing \documentclass or \begin{document}).
Handle common obstacles: custom style files, missing bibliography, or macro-heavy documents.
pandoc latex/<main>.tex -o <repo-name>.md \
--wrap=none \
--standalone \
--from=latex \
--to=markdown
git add <repo-name>.md && git commit -m "feat: convert LaTeX to markdown via pandoc"
If pandoc fails on complex LaTeX (custom macros, missing packages), fall back to marker on the PDF as in Path B. Note the fallback in the README if this occurs.
If a local PDF was also provided, rename to lowercase kebab-case on copy (see Path B for naming convention):
mkdir -p pdfs && cp "<pdf-path>" "pdfs/<first-author>-<year>-<title-fragment>.pdf"
git add pdfs/ && git commit -m "feat: add source PDF"
When only PDF(s) are available, convert via marker.
mkdir -p ~/projects/<workspace>/<repo-name> && cd "$_"
git init && git commit --allow-empty -m "initial commit (empty)"
git lfs install --local
cat > .gitattributes << 'GITATTR'
*.pdf filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.eps filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.tiff filter=lfs diff=lfs merge=lfs -text
*.svg filter=lfs diff=lfs merge=lfs -text
GITATTR
git add .gitattributes && git commit -m "chore: configure git-lfs for binary files"
Rename PDFs to lowercase kebab-case on copy: <first-author>-<year>-<title-fragment>.pdf.
For multiple PDFs from the same reference, append a disambiguating suffix like -supplement.
Example: gorin-2022-rna-velocity-unraveled.pdf and gorin-2022-rna-velocity-unraveled-supplement.pdf.
mkdir -p pdfs
cp "<original-path>" "pdfs/<first-author>-<year>-<title-fragment>.pdf"
git add pdfs/ && git commit -m "feat: add source PDFs"
marker-pdf requires Python 3.12 or earlier (incompatible with 3.13+).
Pin the version explicitly to avoid build failures from the system Python.
uv init --name doc-convert --python 3.12
uv python pin 3.12
uv add "marker-pdf>=1.7.4,<1.11" tiktoken
Use uv run to invoke marker rather than activating the venv, since shell state does not persist between tool calls.
Add a .gitignore:
.venv/
__pycache__/
git add .gitignore pyproject.toml uv.lock && git commit -m "chore: add uv project for PDF conversion"
Marker conversion can be slow, especially on CPU fallback (potentially hours for long documents).
Run marker in the background using the Bash tool's run_in_background: true parameter to avoid the 10-minute timeout limit, then poll for completion.
# run in background:
cd <repo-dir> && uv run marker_single pdfs/<main>.pdf --output_dir ./ --output_format markdown
Check progress by reading the background task output. Once complete:
git add <output-dir>/ && git commit -m "feat: convert main PDF via marker"
If a supplement PDF exists, run it the same way (background, then commit):
# run in background:
cd <repo-dir> && uv run marker_single pdfs/<supplement>.pdf --output_dir ./ --output_format markdown
The surya-ocr layout model used by marker can fail with torch tensor index errors on the MPS (Metal Performance Shaders) backend.
These errors typically manifest as IndexError or RuntimeError inside torch/nn/modules/module.py during the layout recognition step.
If marker_single crashes, apply these fallbacks in order, stopping at the first one that succeeds.
Both PYTORCH_MPS_DISABLE=1 and TORCH_DEVICE=cpu are needed — torch 2.10+ may ignore PYTORCH_MPS_DISABLE alone.
CPU fallbacks are significantly slower (potentially hours for long documents).
Always run these in the background using run_in_background: true and poll for completion.
Fallback 1 — force CPU backend (slower but avoids MPS bugs):
cd <repo-dir> && PYTORCH_MPS_DISABLE=1 TORCH_DEVICE=cpu uv run marker_single pdfs/<file>.pdf --output_dir ./ --output_format markdown
Fallback 2 — CPU with reduced batch sizes and no multiprocessing:
cd <repo-dir> && PYTORCH_MPS_DISABLE=1 TORCH_DEVICE=cpu uv run marker_single pdfs/<file>.pdf \
--output_dir ./ --output_format markdown \
--disable_multiprocessing \
--layout_batch_size 1 \
--detection_batch_size 1 \
--recognition_batch_size 1
Fallback 3 — skip the layout model entirely by forcing all pages to be treated as text blocks (fastest, loses layout fidelity for tables and figures):
cd <repo-dir> && PYTORCH_MPS_DISABLE=1 TORCH_DEVICE=cpu uv run marker_single pdfs/<file>.pdf \
--output_dir ./ --output_format markdown \
--force_layout_block Text
Note which fallback was required in the README so the user understands any quality tradeoffs in the conversion.
Do not substitute alternative PDF extraction tools (e.g. pymupdf4llm, pdfplumber, pdfminer) for marker-pdf.
Marker's Surya OCR pipeline is the only open-source option here that extracts mathematical notation as LaTeX ($...$ and $$...$$).
Alternatives output Unicode approximations or render equations as images, which destroys math fidelity for scholarly content.
If all three marker fallbacks fail, stop and report the issue to the user rather than switching tools.
Inspect the monolithic markdown to identify section boundaries.
Using pandoc JSON AST (preferred when the markdown is well-formed):
pandoc <source>.md -t json | python3 -c "
import json, sys
doc = json.load(sys.stdin)
for i, block in enumerate(doc['blocks']):
if block['t'] == 'Header':
level = block['c'][0]
inlines = block['c'][2]
text = ''.join(
i.get('c', '') if isinstance(i.get('c', ''), str) else ''
for i in inlines
)
print(f'{i:4d} H{level}: {text}')
"
Fallback when pandoc cannot parse (common with marker output):
rg '^#{1,6} ' <source>.md --line-number
chapters/ directory, files named NN-chapter-title.mdsections/ directory, files named NN-section-title.md00-front-matter.mdNN-back-matter.mdDynamically create scripts/split-sections.py (or split-chapters.py) tailored to the document.
The script should:
00-index.md with a table mapping filenames to brief descriptionsmkdir -p scripts
# (write the generated script to scripts/split-sections.py)
python3 scripts/split-sections.py
git add scripts/ chapters/ && git commit -m "feat: split into modular section files"
Use chapters/ for books, sections/ for papers.
Verify no empty files were produced and that all content from the source is accounted for.
Count tokens per file using tiktoken with cl100k_base encoding:
import tiktoken
enc = tiktoken.get_encoding("cl100k_base")
token_count = len(enc.encode(text))
If tiktoken is not available, use ttok from the command line:
cat <file>.md | ttok
Document title as h1, then a table mapping each numbered file to a one-line description.
git add README.md chapters/00-index.md && git commit -m "docs: add README and section index"
Before presenting results to the user, verify:
$...$, display $$...$$).venv/ and __pycache__/ are gitignored (if uv project was created)pdfs/git lfs ls-files lists all binary files; .gitattributes contains filter/diff/merge entries)Report the final tree --du -ah output and any quality issues to the user.
When --aggregate is provided, add the new repo to the subtree aggregate repository and update its README.
All operations in this phase are local and require no user approval.
Skip this phase if no aggregate path was specified.
Fetch from the local repo path rather than GitHub so the subtree add completes without requiring the individual repo to be published first. The LFS smudge filter must be skipped during subtree add to prevent pointer/blob mismatches in the working tree.
cd <aggregate-path>
export GIT_LFS_SKIP_SMUDGE=1
git remote add <repo-name> ~/projects/<workspace>/<repo-name> 2>/dev/null || true
git fetch <repo-name> main
git subtree add --prefix=<repo-name> <repo-name> main -m "subtree: add <repo-name>"
unset GIT_LFS_SKIP_SMUDGE
The aggregate's README.md organizes all constituent repos into topical categories, each with a section heading, a brief description, and a table of directory-to-reference mappings.
Read the existing README.md to understand the current categories and their scope.
Determine where the new repo belongs by considering the document's subject matter against the existing categories.
Three outcomes are possible:
Each table row follows the format:
| `<repo-name>` | Authors (Year). Title. |
Commit the README update separately from the subtree add:
cd <aggregate-path>
git add README.md && git commit -m "docs: add <repo-name> to README"
All commands in this phase interact with GitHub and will be intercepted by Claude Code hooks requesting permission. The ntfy notification fires first so the user sees a summary of completed local work before the approval prompts arrive.
ntfy-send "doc-to-md: <repo-name> complete"
cd ~/projects/<workspace>/<repo-name> && gh repo create cameronraysmith/<repo-name> --private --push -r github -s .
The remote name -r github matches the convention used across existing doc-to-md repos.
After the individual repo exists on GitHub, update the subtree remote in the aggregate from the local path to the GitHub URL for future git subtree pull and git subtree push operations.
GitHub's server-side GH008 pre-receive hook rejects pushes containing LFS pointer references when the corresponding LFS objects are not yet in the target repo's LFS storage. LFS objects must be transferred before pushing the aggregate's refs.
cd <aggregate-path>
git remote set-url <repo-name> "https://github.com/cameronraysmith/<repo-name>.git"
cd ~/projects/<workspace>/<repo-name>
git remote add aggregate "https://github.com/cameronraysmith/<aggregate-repo-name>.git" 2>/dev/null || true
git lfs push aggregate --all
cd <aggregate-path>
git push github main
cd <aggregate-path>
git lfs ls-files --include="<repo-name>/**" | wc -l
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
arxiv, pdf-conversion, markdown, research-papers, document-processing
5 skills in this plugin
/doc-to-md-cmdSession-priming skill for batch construction of /doc-to-md invocations. Invoke once at session start, then provide citation and PDF path pairs repeatedly to get formatted commands copied to clipboard./scientific-visualizationPerceptually and cognitively grounded guidance for designing and reviewing scientific figures, tables, diagrams, and other visual displays of data. Synthesized from Ware (2020) Information Visualization 4th ed. and Schloss (2025) Annual Review of Vision Science. Use when creating new visualizations, choosing chart types, selecting color palettes, reviewing figure quality, auditing accessibility, or evaluating any scientific display for adherence to perception research best practices. Supports two modes: design (proactive guidance for new visualizations) and review (systematic audit of existing ones).
/text-to-visual-iterationMechanical workflow for iterative compilation and refinement of text-based visual specifications (tikz/pgf, typst/cetz, d2, mermaid, plantuml, graphviz, and similar text-to-visual languages) into rendered output (SVG, PNG, PDF). Covers the compile-inspect-refine iteration loop using both SVG text inspection and multimodal bitmap vision for dual-channel feedback. Use when authoring, compiling, or iteratively refining any text-to-visual pipeline, choosing output formats, setting up build artifact directories, post-processing SVG output (svgo, resvg, rsvg-convert), or optimizing layout and graphical properties through successive compilation cycles.
/document-authoring-and-visualization:doc-to-md <reference> [--pdf <path>...] [--workspace <name>] [--aggregate <path>]from document-authoring-and-visualization
npx claudepluginhub cameronraysmith/vanixiets --plugin document-authoring-and-visualizationOther plugins' skills for the same job