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-all-pages-basic-texgit clone https://github.com/VivekKarmarkar/claude-code-os.gitcp claude-code-os/SKILL.MD ~/.claude/skills/vivekkarmarkar-claude-code-os-skills-reproduce-all-pages-basic-tex/SKILL.md--- name: reproduce-all-pages-basic-tex description: Reproduce EVERY page of a research-paper PDF as standalone LaTeX source files (`.tex` only — NO compile, NO open, NO viewer launch). Reads the total page count from the PDF itself via `pdfinfo`, then delegates to `reproduce-multiple-pages-basic-tex` over the full range `[1, total_pages]`. Use when the user invokes `/reproduce-all-pages-basic-tex` with a PDF path and wants the entire paper reconstructed in one command. --- # reproduce-all-pages-basic-tex Produce `.tex` source files for **every page** of a single PDF, without requiring the user to know or type the page count. This is the **whole-paper** variant of `reproduce-multiple-pages-basic-tex` — it derives the range `[1, total_pages]` from `pdfinfo` and then delegates to the multi-pages skill to do the work. **Scope boundary** (inherited transitively from `reproduce-page-basic` → `reproduce-multiple-pages-basic-tex` → here): figures become placeholder boxes with prose descriptions; citations stay as literal `[N]` markers; output uses standard `article` class; not pixel-perfect; no BibTeX; no scanned PDFs. ## When to use this skill vs. the other variants | If you want… | Use | |---|---| | A single page, `.tex` + compiled PDF + viewer | `reproduce-page-basic` | | A single page, `.tex` only | `reproduce-page-basic-tex` | | A contiguous range of pages, `.tex` only | `reproduce-multiple-pages-basic-tex` | | **The whole paper, every page, `.tex` only, no manual page count** | **`reproduce-all-pages-basic-tex`** (this skill) | | Pixel-perfect publisher layout | None of the current skills — out of scope | The "all" variant is just a 2-line ergonomic wrapper over the "multiple" variant: it saves you the step of running `pdfinfo paper.pdf | grep Pages:` before calling the multi-pages skill. If you already know the page count, or want a partial range, use `reproduce-multiple-pages-basic-tex` directly. ## Arguments - `<pdf_path>` — absolute path to the source PDF (must have a text layer; scanned PDFs won't work) - `[<out_dir>]` — optional; defaults to the current working directory ## Pipeline (execute these steps in order, autonomously) **Execute all steps without pausing for permission.** The skill's contract is: PDF in, `.tex` files for every page out, no interactive pauses. ### Step 1 — Derive the page range Run the skill's `get_total_pages.py` helper, which wraps `pdfinfo`: ```bash TOTAL=$(python3 ~/.claude/skills/reproduce-all-pages-basic-tex/helpers/get_total_pages.py <pdf_path>) ``` - **Exit code 0** → stdout is a bare integer; capture it as `TOTAL`. Proceed to Step 2 with the derived range `[1, TOTAL]`. - **Exit code 1** → `pdfinfo` failed. Report the stderr message verbatim to the user and STOP. Common causes: file not found, not a PDF, encrypted without password, corrupted. - **Exit code 2** → usage error or unexpected `pdfinfo` output (no `Pages:` line). Report and STOP. **Do not try to recover from a validation failure by guessing a range.** If `pdfinfo` cannot read the PDF, this skill cannot handle it and the user needs to know. ### Step 2 — Delegate to `reproduce-multiple-pages-basic-tex` Execute the full pipeline described in `~/.claude/skills/reproduce-multiple-pages-basic-tex/SKILL.md` with: - `<pdf_path>` = the same PDF path passed to this skill - `<p_start>` = 1 - `<p_end>` = `TOTAL` (from Step 1) - `<out_dir>` = the same out_dir passed to this skill (or CWD if omitted) That skill's pipeline will: 1. Run **its own** validation helper (`validate_page_range.py`) against the derived range. Since `TOTAL` came from the PDF itself, validation is guaranteed to pass — but DO NOT skip the step. Running the documented pipeline end-to-end preserves the guarantee that both skills follow the same contract. 2. Loop the per-page pipeline from `reproduce-page-basic-tex` for each page in `[1, TOTAL]`: - Extract prose via `extract_pdf_text.py` → `<stem>_pageN_raw.txt` - Visual Read of page N - Write `<stem>_pageN.tex` combining prose + equations + figure/table placeholders, following all rules in `NOTES.md` 3. Apply the equation-counter continuity rule across consecutive pages. 4. Apply the `.bak` idempotency rule for any pre-existing files. 5. Apply continue-and-report failure semantics per page. 6. Produce the batch summary at the end. **Do not re-implement the loop here.** The multi-pages skill is the authoritative home of the loop logic. This skill is deliberately a thin wrapper — if the multi-pages skill changes (adds a new helper, changes a convention, etc.), that change applies here for free. ### Step 3 — Report summary When the delegated multi-pages pipeline finishes, present its summary to the user with a one-line prefix noting the derived range: ``` PDF has <TOTAL> pages. Reproducing all of them as a batch: <multi-pages skill's summary output here> ``` ### Step 4 — STOP - Do NOT run `pdflatex` on any of the produced files. - Do NOT run `xdg-open` or any viewer. - Do NOT ask the user any follow-up questions. ## Failure semantics This skill inherits the multi-pages skill's **continue-and-report** per-page failure semantics. If an individual page fails during the delegated loop, the batch continues with the next page and reports the failure at the end. The only skill-local failure mode is "Step 1 couldn't determine the page count" — that aborts the whole invocation (there's no range to loop over in that case). ## Composition with other tools Because this skill still has no side effects beyond writing files, it composes cleanly with downstream workflows: ```bash # 1. Reconstruct the entire paper as .tex files in one command /reproduce-all-pages-basic-tex paper.pdf # 2. Compile them all in a separate pass for f in paper_page*.tex; do pdflatex -interaction=nonstopmode "$f"; done # 3. Merge into a single PDF pdfunite paper_page*.pdf paper_full_reconstruction.pdf ``` Step 1 is what this skill provides; steps 2 and 3 are standard shell/Unix operations that live at the user level. ## Resources in this skill - **`NOTES.md`** (symlink → base `reproduce-page-basic/NOTES.md`) — judgment-call reference, shared with all other reproduce-page-basic-* skills. - **`preamble_stable.tex`** (symlink → base) — the stable LaTeX preamble. - **`helpers/`** (real directory) — contains symlinks to the four base helpers (`extract_pdf_text.py`, `clean_soft_hyphens.py`, `reflow_paragraphs.py`, `escape_latex.py`) plus one **skill-local** helper: - **`get_total_pages.py`** — new; runs `pdfinfo <pdf>` and prints the total page count as a bare integer to stdout. Tri-state exit codes (0 = OK, 1 = pdfinfo failure, 2 = usage/parse error). Designed to be captured by shell `$(...)` syntax. Duplicates ~15 lines of logic from `reproduce-multiple-pages-basic-tex/helpers/validate_page_range.py`'s `get_total_pages()` function — the duplication is intentional per the skill's design notes. - **`examples/`** (symlink → base `reproduce-page-basic/examples`) — 11 worked Wei-page reconstructions. ## Do-not-touch rules - NEVER modify the input PDF. It is read-only. - NEVER skip Step 1 (the page-count derivation). Even if you think you know the page count from earlier in the conversation, file state may have changed. - NEVER bypass the multi-pages skill by re-implementing the loop inline. This skill is a wrapper, not a competitor. - NEVER compile or open any `.tex`/`.pdf`. That is the `reproduce-page-basic` skill's job. - NEVER "fix" typesetting anomalies in the source paper. Reproduce verbatim (inherited from NOTES.md §5). - NEVER retype prose from memory. It must come from `pdftotext` output (inherited from NOTES.md §6).