Free SKILL.md scraped from GitHub. Clone the repo or copy the file directly into your Claude Code skills directory.
npx versuz@latest install vivekkarmarkar-claude-code-os-skills-reproduce-basic-paper-pdfgit clone https://github.com/VivekKarmarkar/claude-code-os.gitcp claude-code-os/SKILL.MD ~/.claude/skills/vivekkarmarkar-claude-code-os-skills-reproduce-basic-paper-pdf/SKILL.md--- name: reproduce-basic-paper-pdf description: Reproduce an entire research paper as a compiled PDF. Asks the user for paper context (name, PDF path, reconstruction directory, stem), checks whether the merged `<stem>_full.tex` source already exists, invokes `reproduce-basic-paper-tex` to generate it if not, then compiles the merged source to `<stem>_full.pdf` via pdflatex and opens it with `xdg-open`. This is the top of the reproduce-page-basic family — the only whole-paper skill that produces a durable PDF as the deliverable, not just a verification artifact. Use when the user invokes `/reproduce-basic-paper-pdf` and wants a single end-to-end "give me the paper as a readable PDF" command. --- # reproduce-basic-paper-pdf Produce a **compiled PDF** of an entire research paper reconstruction. This is the **Layer 4 cap** of the reproduce-page-basic family — the only whole-paper skill whose deliverable is a PDF file, not a `.tex` source. ## The family at a glance | Layer | Skill | Granularity | Deliverable | |---|---|---|---| | 0 | `reproduce-page-basic` | one page | `.tex` + `.pdf` + opens viewer | | 1 | `reproduce-page-basic-tex` | one page | `.tex` only | | 1 | `reproduce-multiple-pages-basic-tex` | contiguous range | per-page `.tex` files only | | 2 | `reproduce-all-pages-basic-tex` | whole paper | per-page `.tex` files only | | 3 | `reproduce-basic-paper-tex` | whole paper | **merged** `<stem>_full.tex` only | | 4 | **`reproduce-basic-paper-pdf`** (this skill) | **whole paper** | **merged** `<stem>_full.pdf` **+ viewer** | Each `-tex` skill produces source without compiling; each non-`-tex` skill compiles and opens. Layer 4 is the non-`-tex` analogue of Layer 3. ## Arguments (optional — skill asks for missing pieces) - `<pdf_path>` — absolute path to the source PDF of the paper to reconstruct (optional if the merged `<stem>_full.tex` already exists and no per-page generation is needed). - `<stem>` — filename prefix (defaults to PDF basename without extension). - `<reconstruction_dir>` — directory containing the per-page and merged files (defaults to `<stem>_reconstruction/` under CWD). **Interactive mode**: if invoked with no arguments, the skill asks the user for whatever context is missing, falling back to sensible defaults and confirming them explicitly before proceeding. ## Pipeline ### Step 1 — Gather context Same as Layer 3 (`reproduce-basic-paper-tex`). If any argument is missing, ask the user in a single consolidated question. Accept defaults for anything they omit. **Edge case**: if no PDF is supplied AND neither `<stem>_full.tex` nor any per-page files exist, report that nothing can be done and STOP. ### Step 2 — Check whether the merged source exists Check for the existence of `<reconstruction_dir>/<stem>_full.tex`. - **If it exists**: skip directly to Step 4 (compile). This is the happy path for papers that have already been reconstructed — the skill just compiles the existing source. - **If it does not exist**: proceed to Step 3 (delegate). Report the check result to the user in one line: ``` <stem>_full.tex: found → skip generation, compile directly ``` or ``` <stem>_full.tex: not found → delegating to reproduce-basic-paper-tex ``` ### Step 3 — Delegate to `reproduce-basic-paper-tex` if needed Execute the full pipeline described in `~/.claude/skills/reproduce-basic-paper-tex/SKILL.md` with the same `<pdf_path>`, `<stem>`, and `<reconstruction_dir>`. That skill will: 1. Determine the total page count 2. Detect which per-page `.tex` files exist and classify the missing-page set 3. Dispatch to the appropriate downstream skill (`reproduce-all-pages-basic-tex`, `reproduce-multiple-pages-basic-tex`, or `reproduce-page-basic-tex`) 4. Wait for all per-page files to be generated 5. Concatenate them into `<stem>_full.tex` 6. Verify coherence by compiling to a temp directory (its internal coherence check) 7. Report success or halt on failure **Do not re-implement any part of Layer 3's pipeline inline here.** This skill is a thin wrapper around Layer 3 that adds the "compile the merged source to a durable PDF and open it" step. **Failure handling**: if Layer 3 halts with a reason (per-page failure, merged-source parse error, coherence-check failure), propagate that failure verbatim and STOP without attempting to compile. A `.tex` source that failed Layer 3's own coherence check will fail in this skill's compile too, and there's no value in a second compile attempt. ### Step 4 — Compile to a durable PDF At this point, `<reconstruction_dir>/<stem>_full.tex` is guaranteed to exist (either it was there already, or Layer 3 just produced it and coherence-checked it). Compile it to produce `<reconstruction_dir>/<stem>_full.pdf`. Use a temp directory for the pdflatex working files so only the PDF lands in the reconstruction directory (the `.aux`, `.log`, `.out`, `.toc` files stay in the temp dir and get discarded): ```bash TMPDIR=$(mktemp -d) pdflatex -interaction=nonstopmode -output-directory="$TMPDIR" \ "<reconstruction_dir>/<stem>_full.tex" > /tmp/<stem>_pdf_compile.log 2>&1 ``` Then move just the PDF out of the temp dir to the reconstruction dir: ```bash mv "$TMPDIR/<stem>_full.pdf" "<reconstruction_dir>/<stem>_full.pdf" rm -rf "$TMPDIR" ``` **Failure handling**: if pdflatex reports fatal errors (lines matching `^!` in the log), surface the first 10 error lines to the user, note that the merged `.tex` file exists at `<reconstruction_dir>/<stem>_full.tex` for manual inspection, and STOP. Do NOT move any partial PDF out of the temp directory. In practice this failure should be rare because Layer 3's coherence check would have caught it already — but if this skill is invoked on a pre-existing `<stem>_full.tex` that was generated before the canonical preamble was expanded (or by some other skill), the compile could legitimately fail. ### Step 5 — Open the PDF Once `<reconstruction_dir>/<stem>_full.pdf` is in place, open it with the system default viewer: ```bash xdg-open "<reconstruction_dir>/<stem>_full.pdf" 2>/dev/null & ``` The `2>/dev/null &` suppresses viewer noise and backgrounds the process so the skill can continue (and STOP) without waiting for the user to close the viewer. ### Step 6 — Report and STOP Report a single summary block: ``` Paper: <paper_name> PDF source: <pdf_path> (N pages) Reconstruction dir: <reconstruction_dir> Source status: <stem>_full.tex (existed / regenerated by Layer 3) Merged PDF: <reconstruction_dir>/<stem>_full.pdf (<size>, N physical pages) Viewer: launched via xdg-open ``` Then STOP. Do NOT: - Copy the PDF elsewhere - Ask "should I do anything else?" - Run another coherence check (Layer 3 already did one, and Step 4's compile IS a de facto second check) - Append to any NOTES.md ## Failure semantics | Step | Failure mode | Response | |---|---|---| | 1 | Nothing to operate on | "No PDF and no existing reconstruction — nothing to do." STOP. | | 3 | Layer 3 halts with a reason | Propagate Layer 3's error verbatim. STOP. | | 4 | `pdflatex` reports fatal errors | Show first 10 `^!` lines + note that the `.tex` source is preserved. STOP (do not move any partial PDF out of temp). | | 5 | `xdg-open` fails (no viewer available, wrong MIME type, etc.) | Report that the PDF was compiled successfully but couldn't be opened automatically, and give the user the full path so they can open it manually. Do NOT treat this as a hard failure — the PDF exists; the viewer is a convenience. | The skill's success criterion is: `<stem>_full.pdf` is written to `<reconstruction_dir>`. The viewer launch is a best-effort follow-on. ## Resources in this skill - **`NOTES.md`** (symlink → base `reproduce-page-basic/NOTES.md`) — shared judgment-call reference. Consulted transitively by downstream skills. - **`examples/`** (symlink → base) — 11 worked Wei examples. - **No helpers.** This skill's entire logic is bash orchestration (existence check, delegation, `pdflatex`, `mv`, `xdg-open`). No Python helper earns its keep for ~10 lines of bash. ## When to use this skill vs. the others | If you want… | Use | |---|---| | A single page, source + compiled PDF + viewer | `reproduce-page-basic` | | A single page, source only | `reproduce-page-basic-tex` | | A contiguous range of pages, source only | `reproduce-multiple-pages-basic-tex` | | Every page of a paper, source only | `reproduce-all-pages-basic-tex` | | A single merged `.tex` document for the whole paper, source only | `reproduce-basic-paper-tex` | | **The whole paper as a readable PDF, end to end, opened in your viewer** | **`reproduce-basic-paper-pdf`** (this skill) | | Pixel-perfect publisher layout | None — out of scope for this family | The "already reconstructed, just give me the PDF again" use case is unique to this skill: it skips Layer 3 entirely when `<stem>_full.tex` already exists. That's the cheapest path through the family — a single pdflatex invocation and a viewer launch, no per-page work at all. ## Do-not-touch rules - NEVER modify the input PDF (the source paper). It is read-only. - NEVER modify any existing `<stem>_page<N>.tex` or `<stem>_full.tex` file. This skill only reads the source; regeneration is Layer 3's job (and Layer 3 has its own `.bak` idempotency rule). - NEVER write `.aux`/`.log`/`.out` files to the reconstruction directory. All pdflatex working files go to a temp directory; only the final PDF is moved out. - NEVER leave a partial `<stem>_full.pdf` in place if compilation fails. If Step 4 errors, the temp directory is rm-rf'd and no PDF is moved. - NEVER skip the check in Step 2. Even if you "know" the source exists from earlier in the conversation, file state may have changed. - NEVER re-run Layer 3 if `<stem>_full.tex` already exists. The user invoking this skill is asking for "a PDF of the current state," not "a PDF of a freshly regenerated state." If they want to force regeneration, they can delete `<stem>_full.tex` first (or invoke Layer 3 directly).