latex-safe-build
防止编译过程修改源树,适合学术排版与多人协作场景。
在隔离目录编译 LaTeX,避免污染源码并报告未解析引用与页数。
把 LaTeX 编译放到隔离的临时副本里跑,避免编译产生的 .aux/.bcf 等中间文件污染源码或被并发修改导致构建坏掉。会报告未解析的引用和真正有意义的页数(文字页),支持 latexmk、pdflatex、xelatex、lualatex、biber 等工具。每次想“编译我的论文/重建 PDF”或遇到奇怪的未定义引用时就用它。
▸ 展开 SKILL.md 英文原文
Compile LaTeX documents in an isolated scratch copy so a build can never corrupt the source tree, then report unresolved references and the page counts that actually matter (text pages, not just PDF pages). Use this skill whenever compiling or building any LaTeX document (latexmk, pdflatex, xelatex, lualatex, biber), whenever a build fails with corrupted .aux/.bcf files, "File ended while scanning", or phantom undefined-reference storms, whenever more than one session, agent, or person might touch the same LaTeX tree, or when asked how long a thesis, report, or paper is in pages. Even a plain "compile my thesis" or "rebuild the PDF" should go through this skill. Not for writing or editing LaTeX content itself (equations, wording, structure); it governs builds and build diagnostics only.
帮我安装这个 skill:https://raw.githubusercontent.com/molanocortes/latex-safe-build/main/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/molanocortes/latex-safe-build/main/SKILL.md"# latex-safe-build Build LaTeX documents without ever running the compiler inside the working tree. ## Why builds are isolated `latexmk` writes dozens of intermediates (`.aux`, `.bcf`, `.toc`, `.fls`, ...) into the directory it runs in. If anything touches that directory during the build (an editor saving a chapter, another agent session, a file sync tool, a second build), the intermediates end up half-written, and the failures look like source bugs: `File ended while scanning use of ...`, biber crashing on a malformed `.bcf`, sudden storms of undefined references, a PDF assembled from a stale table of contents. So: **snapshot the tree to a scratch location, build there, copy only the fin