Skip to content

steverozen/insert-reference-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

insert-reference-skill

A Claude Code skill that enforces fetch-and-verify before any URL reference is written into a file. Before inserting a citation, preprint link, repo link, or any URL that comes with descriptive text (author, year, title, venue), the skill fetches the target and checks that every descriptor matches.

Built after a real incident where a research report named the wrong first author for a paper cited by URL. The model can remember a URL incorrectly; the fetched page is authoritative.

How it works

Two Python scripts (stdlib-only, no pip install) do the heavy lifting:

  • scripts/verify_reference.py — verify one reference. Takes a URL plus any of --author, --year, --title, --venue. Emits a JSON report with a verdict of match, mismatch, or unverified.
  • scripts/batch_verify.py — verify many references in parallel. Takes a JSON array from stdin or a file.

Target types supported:

URL pattern Metadata source
arxiv.org/abs/* arXiv API (export.arxiv.org/api/query)
DOI / doi.org/* Crossref (api.crossref.org/works/<DOI>)
pubmed.ncbi... NCBI E-utilities (esummary.fcgi)
bioRxiv / medRxiv api.biorxiv.org/details/<server>/<doi>
github.com/o/r GitHub API (api.github.com/repos/o/r)
any other URL HTML <meta name="citation_*"> + <title> scrape

Installation

Clone or symlink into your Claude Code user skills directory:

git clone git@github.com:steverozen/insert-reference-skill.git ~/github/insert-reference-skill
ln -s ~/github/insert-reference-skill ~/.claude/skills/insert-reference-skill

skill.md is the entry point Claude Code reads.

Manual use

# single reference
python3 scripts/verify_reference.py https://arxiv.org/abs/2402.03776 \
  --author Pancotti --year 2024 --title MUSE-XAE

# batch
python3 scripts/batch_verify.py <<'EOF'
[
  {"url": "https://arxiv.org/abs/2402.03776",
   "first_author": "Pancotti", "year": "2024"},
  {"url": "https://doi.org/10.1038/s41586-020-1943-3",
   "first_author": "Alexandrov", "year": "2020"}
]
EOF

Exit codes: 0 match (or unverified with no expected fields), 1 mismatch, 2 fetch failed.

License

MIT. See LICENSE.

About

Fetch-and-verify gate for URL references in Claude Code — checks authors, year, title, venue against arXiv/Crossref/PubMed/bioRxiv/GitHub before any citation is written.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages