Use when the user wants to validate, check, or fix a BibTeX (.bib) reference file, wrong authors, stale arXiv preprints, incorrect metadata, duplicate entries, formatting issues
Use this skill for any request to validate, check, clean up, or fix a BibTeX .bib file.
If the request includes a .bib path, operate on it. If the path is missing or does not exist, ask for it.
Assumptions:
@article{...} is supported; reject parenthesized @article(...).@string, @preamble, and @comment blocks verbatim.All bundled scripts live in tools/ next to this file. Resolve TOOLS_DIR once:
for d in \
"${CODEX_HOME:-$HOME/.codex}/skills/bibtidy/tools" \
"$HOME/.claude/skills/bibtidy/tools" \
"${CLAUDE_PLUGIN_ROOT:-/dev/null}/skills/bibtidy/tools"; do
[ -f "$d/crossref.py" ] && TOOLS_DIR="$d" && break
done
Useful commands:
python3 $TOOLS_DIR/compare.py <file.bib> [--key KEY]python3 $TOOLS_DIR/crossref.py doi <DOI>python3 $TOOLS_DIR/crossref.py search "<title>"python3 $TOOLS_DIR/crossref.py bibliographic "<query>"python3 $TOOLS_DIR/duplicates.py <file.bib>python3 $TOOLS_DIR/edit.py <file.bib> <patches.json>Use edit.py for all actual .bib changes. Do not edit the file directly with agent editing tools and do not rewrite the whole file.
fix patch: include key, action, urls, explanation, and fields; entry_type is optional.fields, set a field to null to remove it; omit a field to leave it unchanged.not_found: comment out the original entry; do not add URL lines.duplicate: add % bibtidy: DUPLICATE of <other_key> — consider removing above the original entry; no URL lines.review: add one or more % bibtidy: <URL> lines plus % bibtidy: REVIEW, <reason> above the unchanged entry.For fix patches, edit.py should produce:
% bibtidy: <URL> line per source% bibtidy: <explanation> lineUse source values verbatim. If the bib entry uses and others and a verified source provides the full author list, replace it with the full list.
Each entry has a web-search budget of 1 total, used in at most one of Wave A or Wave B.
> <file>.bib.cc.log in Claude Code or > <file>.bib.codex.log in Codex.cp <file>.bib <file>.bib.origpython3 $TOOLS_DIR/duplicates.py <file.bib> before metadata fixes.python3 $TOOLS_DIR/compare.py <file.bib> for CrossRef candidates.error set or no candidates must be web-verified. Those entries have spent their budget.Clean: confirmed, no changesFix: confident correctionEscalate: still ambiguous and budget unusedNot found: no paper found after required searchReview: budget spent and still uncertainEscalate and not yet searched. After Wave B, final outcomes are only Clean, Fix, Not found, or Review.patches.json file and apply fixes with python3 $TOOLS_DIR/edit.py <file.bib> patches.json.python3 $TOOLS_DIR/duplicates.py <file.bib> again. Resolve every unresolved same-key collisions warning and rerun until the warning is gone.duplicate patch.For files with more than 30 entries, work in batches of about 15 and report progress. Entry count must match before and after.
compare.py returns raw CrossRef candidates plus discrepancies. Treat them as hints, not truth.
doi field when the bib entry currently lacks one.author vs authors and journal vs booktitle as schema mismatches until verified.-- for BibTeX page ranges.pages is not automatically an error for venues that do not publish page numbers.Use subagents when available; otherwise do the same work sequentially. Cap at 6 subagents per wave and distribute entries evenly.
Each web-search subagent should return only JSON with:
keysource_urlsfieldsnotesRules for subagents:
fields is either a fix-patch dict or null.null inside fields to remove a stale field.fields when the verified source disagrees with the bib entry or when the bib entry is missing a standard field that the venue publishes.doi field just because you found one; mention it in notes if useful.notes.% comments that are not % bibtidy:@string, @preamble, and @comment blocksIf rate-limited, note it and continue with the next entry.
Edit PDFs with natural-language instructions using the nano-pdf CLI.