ワンクリックで
code-writer
Generate implementation code scaffolding from paper descriptions when no source code exists.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Generate implementation code scaffolding from paper descriptions when no source code exists.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Beamer LaTeX slide workflow: create, compile, review, and polish academic presentations. Use this skill whenever the user works on Beamer .tex slide decks, or asks to create slides, make a presentation, prepare a lecture, build a talk, or generate Beamer slides from a paper. Covers: creation, editing, compilation, proofreading, visual audit, pedagogical review, TikZ diagrams, figure extraction, and comprehensive quality checks. Trigger on: beamer, slides, lecture, presentation, seminar talk, conference talk, defense slides, tikz, compile latex, proofread slides, slide review, 讨论班, 论文讲解. Do NOT trigger on: powerpoint, pptx, PPT, 做PPT — use the powerpoint-slides skill instead.
Compare reproduced results against paper-reported values. Generate Markdown/JSON/Beamer reports.
Deep analysis of ML source code repositories — AST call graphs, training loop dissection, reproducibility scoring.
Convert LaTeX math formulas from papers into executable PyTorch/NumPy code.
Automate paper reproduction on remote GPU servers via mcp-ssh, using code-analyzer's reports.
Prepare structured presentation materials from parsed papers for beamer-skill's create workflow.
| name | code-writer |
| description | Generate implementation code scaffolding from paper descriptions when no source code exists. |
When a paper has no source code, this skill generates a complete project scaffolding with model, training, data loading, and evaluation code — ready to fill in and run.
paper-parser has extracted the paper content but paper-finder found no codepaper-parser JSON/MD, or user description)formula2code skill (for converting paper equations to code)code-analyzer skill (for analyzing reference implementations)paper-finder skill (for searching reference code)Paper Content (JSON/MD/description)
│
▼
Phase 0: Reference Code Discovery ← KEY INNOVATION
│ "Papers don't exist in a vacuum — find code for what they build on"
│ → paper-finder: search for base methods' implementations
│ → code-analyzer: analyze found repos for reusable components
▼
Phase 1: Paper Info Extraction
│ → extractors/paper_info.py: title, abstract, sections
│ → extractors/architecture.py: model components, layer types
│ → extractors/equations.py: LaTeX formulas
│ → extractors/experiment.py: hyperparameters, datasets, metrics
▼
Phase 2: Code Generation (with reference code guidance)
│ → generate.py: fill templates with extracted info
│ → formula2code: convert equations to loss/model code
▼
Phase 3: Output
project/
├── configs/default.yaml # Hyperparameters from paper
├── src/
│ ├── model.py # Architecture skeleton with TODOs
│ ├── train.py # Training loop (standard PyTorch)
│ ├── data.py # Data loading skeleton
│ └── evaluate.py # (generated when metrics detected)
├── references/
│ └── search_plan.md # What code to search for
├── implementation_checklist.md # Step-by-step guide
├── requirements.txt
└── README.md
# From paper-parser JSON
python code-writer/generate.py --paper workspace/<paper>/paper_content.json -o workspace/<paper>/implementation/
# From markdown
python code-writer/generate.py --markdown workspace/<paper>/paper.md -o workspace/<paper>/implementation/
# From text description
python code-writer/generate.py --describe "A transformer-based model for image classification with self-attention" -o project/
This is the most important section. Follow this methodology step by step.
The paper you're implementing is NOT invented from nothing. It builds on existing methods. Find their code first.
Read the paper (from paper-parser output) and identify:
Run generate.py to get the scaffold AND the references/search_plan.md
Execute the search plan using paper-finder:
paper-finder: search "ResNet PyTorch implementation" on GitHub
paper-finder: search base paper on Papers With Code
Clone & analyze the most relevant reference repo:
git clone <reference_repo> workspace/<paper>/references/<name>
code-analyzer: analyze workspace/<paper>/references/<name>
Study the reference code — pay attention to:
Why first? Because wrong data = nothing else matters.
src/data.py with actual data loadingprint(next(iter(loader))) should match expected shapesWhy bottom-up? Build small, test small, then compose.
nn.Module# Test with dummy tensor
block = MyBlock()
x = torch.randn(2, 64, 32, 32) # (batch, channels, h, w)
print(block(x).shape) # Should match expected output
formula2code for any mathematical operations:
python formula2code/convert.py "<latex from paper>" --to pytorch -v
model(dummy_input).shape should match paper's output descriptionformula2code to convert the paper's loss equation# If loss doesn't approach ~0, you have a bug
python src/train.py --epochs 1000 --batch-size 5
| Problem | Symptom | Fix |
|---|---|---|
| Wrong normalization | Training doesn't converge | Check if paper uses [0,1] or [-1,1] |
| Missing weight init | Poor performance | Check paper appendix for init method |
| Wrong norm layer | NaN losses | BatchNorm vs LayerNorm matters! |
| No LR schedule | Can't match paper results | Add warmup + cosine decay |
| Wrong loss function | Loss doesn't decrease | Verify with formula2code |
| Dimension mismatch | Runtime crash | Test each component with dummy tensors |
pip install -r code-writer/requirements.txt
# Requires: jinja2, pyyaml
See code-writer/examples/ for runnable demos:
| Example | What it Shows |
|---|---|
01_generate_from_description.py | Full project generation from paper-like data |
02_extractors_demo.py | Each extractor running independently |
from extractors.architecture import extract_architecture
sections = [{'title': 'Method', 'content': 'We use a U-Net with self-attention...'}]
arch = extract_architecture(sections)
# → {'components': ['attention', 'unet'], 'architecture_type': 'attention'}
from extractors.experiment import extract_experiment
sections = [{'title': 'Experiments', 'content': 'Adam optimizer lr 1e-4, batch 64, 200 epochs on CIFAR-10'}]
exp = extract_experiment(sections)
# → {'hyperparameters': {'learning_rate': '1e-4', 'batch_size': '64', ...}, 'datasets': ['CIFAR-10']}
from extractors.reference_finder import find_reference_code
paper_info = {'title': 'My DDPM Paper', 'abstract': 'diffusion model using U-Net...', ...}
refs = find_reference_code(paper_info)
# → {'base_methods': ['U-Net', 'DDPM'], 'search_queries': [...], 'strategy': '...'}
When stuck, the agent should fetch these URLs for guidance:
| Topic | URL |
|---|---|
| Jinja2 template syntax | https://jinja.palletsprojects.com/en/3.1.x/templates/ |
| PyYAML documentation | https://pyyaml.org/wiki/PyYAMLDocumentation |
| PyTorch model best practices | https://pytorch.org/tutorials/beginner/introyt/modelsyt_tutorial.html |
| PyTorch training loop | https://pytorch.org/tutorials/beginner/introyt/trainingyt.html |
| PyTorch data loading | https://pytorch.org/tutorials/beginner/basics/data_tutorial.html |
| Papers With Code methods | https://paperswithcode.com/methods |
| torchvision datasets | https://pytorch.org/vision/stable/datasets.html |
| Hugging Face datasets | https://huggingface.co/docs/datasets/ |
| Common training recipes | https://github.com/pytorch/examples |
When modifying Jinja2 templates:
# Fetch Jinja2 template syntax docs:
fetch_url("https://jinja.palletsprojects.com/en/3.1.x/templates/")
When implementing data loading:
# Fetch PyTorch data loading tutorial:
fetch_url("https://pytorch.org/tutorials/beginner/basics/data_tutorial.html")
# Fetch torchvision available datasets:
fetch_url("https://pytorch.org/vision/stable/datasets.html")