Validate bib

From pedrohcgs/claude-code-my-workflow · View interactive version

Validate bib is an AI agent skill from the GitHub repository pedrohcgs/claude-code-my-workflow. Validate bibliography entries against citations in all lecture files. Structural checks (missing/unused entries, malformed fields) by default; `--semantic` adds citation-drift detection, DOI verification, and style-consistency checks.

How to use this skill

Skill file

Validate Bibliography

Cross-reference citations in lecture files against bibliography entries. Two modes:

Report saved to quality_reports/bib_audit_[structural|semantic].md.

Mode 1: Structural (default)

Steps

  1. Read the bibliography file and extract all citation keys.
  1. Scan lecture files for citation keys:
  1. Cross-reference:
  1. Check entry quality:
  1. Write report to quality_reports/bib_audit_structural.md.

Files scanned

Slides/*.tex
Quarto/*.qmd
guide/*.qmd
master_supporting_docs/**/*.tex

Bibliography location

Bibliography_base.bib at repo root by default; override via CLAUDE.md.

Mode 2: Semantic (`--semantic`)

Everything in Mode 1, plus:

2a. Citation drift detection

Multiple .bib entries describing the same paper under different keys. Symptoms:

Detection heuristics (any → FLAG):

| Check | Signal |

|---|---|

| Same DOI across keys | Hard-duplicate (CRITICAL) |

| Same title (case-insensitive, punct-stripped) | Likely duplicate (CRITICAL) |

| Same author+year+journal | Probable duplicate (MEDIUM) |

| Title Jaccard > 0.85 on tokens ≥ 4 chars | Soft-duplicate (LOW) |

For each flagged pair: list both keys, where each is cited, and recommend a canonical key (prefer most-cited, then alphabetically first).

2b. DOI verification (optional; network)

For each entry with a doi, fetch https://api.crossref.org/works/{doi} and compare:

Severity:

Rate limit: cap 50 lookups per run, 0.5s delay between calls. Cache in quality_reports/.doi_cache.json.

Opt-out: --skip-doi for offline or no-WebFetch environments.

2c. Style consistency within each file

For each file, count citation commands (\citet vs \citep vs \cite; @key vs [@key]). FLAG files with mixed styles without an obvious pattern (e.g., 20× \citep and 3× \cite in the same deck). Low-severity.

2d. Cite-claim sanity (flag-only)

Gated behind --cite-claim. For the top-10 most-cited works per file, WebFetch the crossref abstract and surface it beside the in-text context. No auto-judgment — humans decide if the claim matches.

This is existence/structure, not appropriateness. Deciding whether the cited paper actually says what the in-text claim attributes to it is CODE0's job — it reads the source and grounds a supports / partial / contradicts verdict in quotes + pages (with the EXPLAINED escape for a defensible named alternative). --cite-claim only surfaces the abstract; for the verdict, run /verify-claims.

Report structure (`quality_reports/bib_audit_semantic.md`)

# Bibliography Semantic Audit

**Date:** YYYY-MM-DD
**Bibliography:** Bibliography_base.bib (N entries)
**Files scanned:** [list]

## Summary

| Check | Critical | Medium | Low |
|---|---|---|---|
| Structural | | | |
| Citation drift | | | |
| DOI verification | | | |
| Style consistency | 0 | 0 | |

## Critical Issues

### Duplicate entries
| Keys | Signal | Citations | Recommended canonical |
|---|---|---|---|

### DOI mismatches
| Key | Field | .bib value | crossref value |
|---|---|---|---|

## Medium / Low issues
…

## Next steps
1. Resolve duplicates — pick canonical key, update citations, remove orphans.
2. Fix DOI mismatches — verify paper in crossref or strip the wrong DOI.
3. Review style-consistency notes.

Exit behavior

Cross-references

What this skill does NOT do

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.