How to install paper-to-code
npx skills add https://github.com/lingzhi227/agent-research-skills --skill paper-to-codeFull instructions (SKILL.md)
Source of truth, from lingzhi227/agent-research-skills.
name: paper-to-code description: Convert an ML research paper into a complete, runnable code repository. 3-stage pipeline from Paper2Code — Planning (UML + dependency graph) → Analysis (per-file logic) → Coding (dependency-ordered generation). Use for reproducing paper methods. argument-hint: [paper-pdf-or-text]
Paper to Code
Convert a research paper into a complete, runnable code repository.
Input
$0— Paper PDF path, paper text, or paper URL
References
- Paper2Code prompts (planning, analysis, coding stages):
~/.claude/skills/paper-to-code/references/paper-to-code-prompts.md
Workflow (from Paper2Code)
Stage 1: Planning
Four-turn conversation to create a comprehensive plan:
- Overall Plan: Extract methodology, experiments, datasets, hyperparameters, evaluation metrics
- Architecture Design: Generate file list, Mermaid classDiagram, sequenceDiagram
- Task Breakdown: Logic analysis per file, dependency-ordered task list, required packages
- Configuration: Extract training details into
config.yaml
Stage 2: Analysis
For each file in the task list (dependency order):
- Conduct detailed logic analysis
- Map paper methodology to code structure
- Reference the config.yaml for all settings
- Follow the UML class diagram interfaces strictly
Stage 3: Coding
For each file in dependency order:
- Generate code with access to all previously generated files
- Follow the design's data structures and interfaces exactly
- Reference config.yaml — never fabricate configuration values
- Write complete code — no TODOs or placeholders
Stage 4: Debugging (if needed)
If execution fails:
- Collect error messages
- Identify root cause using SEARCH/REPLACE diff format
- Apply minimal fixes preserving original intent
- Re-run until successful
Output Structure
reproduced_code/
├── config.yaml # Training configuration
├── main.py # Entry point
├── model.py # Model architecture
├── dataset_loader.py # Data loading
├── trainer.py # Training loop
├── evaluation.py # Metrics and evaluation
├── reproduce.sh # Run script
└── requirements.txt # Dependencies
Key Constraints
- Dependency order: Each file is generated with access to all previously generated files
- Interface contracts: Mermaid diagrams serve as rigid interface definitions across all stages
- No fabrication: Only use configurations explicitly stated in the paper
- Complete code: Every function must be fully implemented
Rules
- Follow the paper's methodology exactly — do not invent improvements
- Generate code in dependency order (data loading → model → training → evaluation → main)
- Use config.yaml for all hyperparameters and settings
- Every class/method in UML diagram must exist in code
- Generate a reproduce.sh script for one-command execution
- If paper details are ambiguous, note them explicitly
Related Skills
- Upstream: literature-search
- Downstream: experiment-code
- See also: code-debugging, algorithm-design
Related skills
More from lingzhi227/agent-research-skills and the wider catalog.
literature-review
Conduct comprehensive literature reviews using multi-perspective dialogue simulation. Generate diverse expert personas, conduct grounded Q&A conversations, and synthesize findings into structured knowledge. Use when starting a new research project or writing a survey section.
literature-search
Search academic literature using Semantic Scholar, arXiv, and OpenAlex APIs. Returns structured JSONL with title, authors, year, venue, abstract, citations, and BibTeX. Use when the user needs to find papers, check related work, or build a bibliography.
figure-generation
Generate publication-quality scientific figures using matplotlib/seaborn with a three-phase pipeline (query expansion, code generation with execution, VLM visual feedback). Handles bar charts, line plots, heatmaps, training curves, ablation plots, and more. Use when the user needs figures, plots, or visualizations for a paper.
citation-management
Manage BibTeX citations for LaTeX papers. Harvest missing citations from a draft using Semantic Scholar, validate cite keys against .bib files, deduplicate entries, and format bibliography. Use when working with references, BibTeX, or citations.
latex-formatting
Handle LaTeX formatting, templates, and styling for academic papers. Set up conference templates (ICML, ICLR, NeurIPS, AAAI, ACL), fix formatting issues, manage packages, and ensure venue-specific compliance. Use when the user needs to set up a paper template, fix LaTeX formatting, or prepare for submission.
data-analysis
Generate statistical analysis code with 4-round review. Select appropriate statistical tests, interpret results, and produce analysis reports with p-values, effect sizes, and confidence intervals. Use when analyzing experimental data for a paper.