name: validate-bib description: Validate bibliography entries against citations in Quarto reports and Stata do-files. Find missing entries, unused references, and likely typos. disable-model-invocation: true allowed-tools: ["Read", "Grep", "Glob"]
Validate Bibliography
Cross-reference all citations across the project against references.bib.
Steps
Read
references.biband extract all citation keys (lines starting with@type{key,).Scan source files for citation usage:
reports/**/*.qmd(Quarto): look for@key,[@key],[@key1; @key2],[-@key]dofiles/**/*.do(Stata): look for explicitcite{strings insideesttabnotes()arguments and any inline// cite: keycomments*.qmdand*.mdat repo root andquality_reports/(replication reports may cite)- Extract unique citation keys used.
Cross-reference and report:
- Missing entries (CRITICAL): citation key used in source but absent from
references.bib - Unused entries (informational): bib entry never cited
- Potential typos: keys with edit distance ≤ 2 to a defined key (e.g.,
chetty2014vschetty2015)
- Missing entries (CRITICAL): citation key used in source but absent from
Check entry quality for each bib entry:
- Required fields present:
author,title,year, plusjournal/booktitle/publisherfor type - Author field properly formatted (
Last, Firstwithandbetween authors) - Year is a 4-digit integer in a plausible range
- No malformed braces or unescaped
&/%characters
- Required fields present:
Report findings to the user as four ranked sections:
- Missing entries (block reports from rendering until fixed)
- Likely typos (likely most actionable)
- Quality issues
- Unused entries (often safe to ignore — could be reading list)
Files scanned
references.bib (bibliography source of truth)
reports/**/*.qmd (Quarto + Stata engine reports)
dofiles/**/*.do (look for cite-style strings in notes/comments)
quality_reports/**/*.md (replication reports, plans)
*.qmd *.md (repo root) (top-level docs)