Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Converts an arxiv paper into a minimal, citation-anchored Python implementation. Trigger when user runs /paper2code with an arxiv URL or paper ID, says "implement this paper", or pastes an arxiv link asking for implementation. Flags all ambiguities honestly. Never invents implementation details not stated in the paper.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | -17% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 52% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 58% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 20% | 0% |
You are executing the paper2code skill. This file governs the high-level flow. Each stage dispatches to a detailed reasoning protocol in pipeline/. Do NOT skip stages. Do NOT combine stages. Execute them in order.
Extract from the user's input:
ARXIV_ID: the arxiv paper ID (e.g., 2106.09685). Strip any URL prefix.MODE: one of minimal (default), full, educational.FRAMEWORK: one of pytorch (default), jax, numpy.If the user provided a full URL like https://arxiv.org/abs/2106.09685, extract the ID 2106.09685. If the user provided a versioned ID like 2106.09685v2, keep the version.
Create a temporary working directory: .paper2code_work/{ARXIV_ID}/ This is where intermediate artifacts go. The final output goes in the current directory under {paper_slug}/.
Run via Bash:
bashpip install pymupdf4llm pdfplumber requests pyyaml
Read and follow: pipeline/01_paper_acquisition.md
Run the helper script to fetch and parse the paper:
bashpython skills/paper2code/scripts/fetch_paper.py {ARXIV_ID} .paper2code_work/{ARXIV_ID}/
Then run structure extraction:
bashpython skills/paper2code/scripts/extract_structure.py .paper2code_work/{ARXIV_ID}/paper_text.md .paper2code_work/{ARXIV_ID}/
Verify the outputs exist before proceeding. If extraction failed, follow the fallback protocol in pipeline/01_paper_acquisition.md.
The script also searches for official code repositories (in the paper text and on the arxiv page) and saves any found links to paper_metadata.json under the official_code key. Verify these links before relying on them — see Step 8 in pipeline/01_paper_acquisition.md.
Read and follow: pipeline/02_contribution_identification.md
Read the parsed paper sections. Identify the single core contribution. Classify the paper type. Write the contribution statement. Save it to .paper2code_work/{ARXIV_ID}/contribution.md.
Read and follow: pipeline/03_ambiguity_audit.md
Before reading this stage, also read: guardrails/hallucination_prevention.md
Go through every implementation-relevant detail. Classify each as SPECIFIED, PARTIALLY_SPECIFIED, or UNSPECIFIED. Save the audit to .paper2code_work/{ARXIV_ID}/ambiguity_audit.md.
Read and follow: pipeline/04_code_generation.md
Before writing code, read:
guardrails/scope_enforcement.md — to determine what's in and out of scopeguardrails/badly_written_papers.md — if the paper is vague or inconsistentknowledge/ for the paper's domainscaffolds/ for the expected file structureDetermine the paper_slug from the paper title (lowercase, underscores, no special chars). Generate all files under {paper_slug}/ in the current working directory.
Read and follow: pipeline/05_walkthrough_notebook.md
Generate the walkthrough notebook that connects paper sections to code with runnable sanity checks. Save to {paper_slug}/notebooks/walkthrough.ipynb.
Remove the .paper2code_work/ directory after successful completion.
Print a summary:
✓ paper2code complete for: {paper_title}
Output directory: {paper_slug}/
Files generated: {list of files}
Unspecified choices: {count} (see REPRODUCTION_NOTES.md)
Mode: {MODE} | Framework: {FRAMEWORK}PAPER_GUIDE.md that walks through the paper section by section.These apply at ALL stages. Read them if you haven't already:
guardrails/hallucination_prevention.md — the most important file in this skillguardrails/scope_enforcement.md — what to implement and what to skipguardrails/badly_written_papers.md — what to do when the paper is unclearBefore implementing any of these components, read the corresponding knowledge file:
knowledge/transformer_components.mdknowledge/training_recipes.mdknowledge/loss_functions.mdknowledge/paper_to_code_mistakes.mdOther measured skills in the registry, with their headline benchmark lift.