agentleFS
BuildHarborBuildHarbor/sciagent-skills/skills/citation-management/SKILL.md

citation-management

Skill1 starsChanged 3 months agoMITView on GitHub

Build, edit, and convert bibliographies across BibTeX, RIS, CSL-JSON, and EndNote. Use for Zotero and Mendeley automation, DOI and Crossref lookup, in-text citation parsing, CSL style rendering, and deduplication of reference libraries. Triggers include "BibTeX", "Zotero", "Mendeley", "CSL", "anystyle", "DOI lookup", "pyzotero", "bibtexparser".

  • Reads credentials
  • Installs packages

30 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use venue-templates, scientific-critical-thinking and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ZanderRussSkill

    venue-templates

    Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.

    Also in 5 projects that use this

  • ZanderRussSkill

    scientific-critical-thinking

    Evaluate research rigor. Assess methodology, experimental design, statistical validity, biases, confounding, evidence quality (GRADE, Cochrane ROB), for critical analysis of scientific claims.

    Also in 6 projects that use this

  • Hongyu-yuSkill

    latex-posters

    Create professional research posters in LaTeX using beamerposter, tikzposter, or baposter. Support for conference presentations, academic posters, and scientific communication. Includes layout design, color schemes, multi-column formats, figure integration, and poster-specific best practices for visual communication.

    Also in 3 projects that use this

  • garri333Skill

    scholar-evaluation

    Systematically evaluate scholarly work using the ScholarEval framework, providing structured assessment across research quality dimensions including problem formulation, methodology, analysis, and writing with quantitative scoring and actionable feedback.

    Also in 3 projects that use this

  • AnthropicSkill

    statistical-analysis

    Apply statistical methods including descriptive stats, trend analysis, outlier detection, and hypothesis testing. Use when analyzing distributions, testing for significance, detecting anomalies, computing correlations, or interpreting statistical results.

    Also in 5 projects that use this

  • garri333Skill

    hypothesis-generation

    Structured hypothesis formulation from observations. Use when you have experimental observations or data and need to formulate testable hypotheses with predictions, propose mechanisms, and design experiments to test them. Follows scientific method framework. For open-ended ideation use scientific-brainstorming; for automated LLM-driven hypothesis testing on datasets use hypogenic.

    Also in 3 projects that use this

  • +4 more from ZanderRuss

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 5 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 26 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do NOT use this skill for systematic search/screening — use the literature-review skill.

    line 52
  2. Distinctive:

    Use the DOI as the primary key for every record.

    line 156
  3. Very specific:

    Run habanero.content_negotiation once per record on import to fetch authoritative metadata and overwrite your hand-typed fields.

    line 162
  4. Very specific:

    Keep authors in familyName/givenName pairs in CSL-JSON.

    line 164
  5. Distinctive:

    Use the Zotero group library for shared projects (read/write for co-authors, public read for reviewers).

    line 166
  6. Distinctive:

    Citation accuracy is a moral obligation: Always verify a DOI resolves to the work you intend.

    line 279
  7. Distinctive:

    No citation cartels: Never agree to reciprocal or coerced citation.

    line 281
  8. Distinctive:

    Author name disambiguation: Use ORCID iDs in CSL-JSON.

    line 289
  9. Very specific:

    Data sharing: When you submit the manuscript, share the underlying .bib/CSL-JSON file under a permissive license so reviewers and future …

    line 291
  10. Very specific:

    No metadata fabrication: If a field is unknown, leave it blank rather than inventing volume/issue/page numbers.

    line 294

“Common” is measured: kept by at least 6 in 10 of the 26 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Citation Management

Overview

A citation manager is the spine of a reproducible writing workflow. It stores references with stable identifiers (DOI, PMID, ORCID, ISBN), renders them in any of thousands of styles, and inserts in-text citations and reference lists into manuscripts written in LaTeX, Word, Markdown, or Quarto. This skill covers the programmatic side of that pipeline:

  • Reading and writing BibTeX, RIS, CSL-JSON, and EndNote XML.
  • Automating Zotero via pyzotero (collections, items, attachments, notes, tags).
  • Looking up and verifying DOIs via habanero (Crossref) and the Crossref ContentNegotiation API (returns CSL-JSON directly).
  • Parsing free-text reference lists with anystyle into structured fields.
  • Rendering references with Citation Style Language (CSL) via citeproc-py.
  • Deduplicating libraries by fuzzy title + year + first-author.
  • Integrating ORCID to disambiguate authors.

Outputs are stable, version-controlled bibliographies that any word processor or typesetting system can consume.

When to use this skill

  • You need to build or curate a Zotero/Mendeley library from a list of DOIs or PMIDs.
  • You need to convert between BibTeX, RIS, CSL-JSON, or EndNote XML for journal or preprint submission.
  • You need to render references in a specific journal style (Nature, APA 7, Chicago, IEEE, Vancouver) using CSL.
  • You need to parse unstructured reference lists (PDF bibliography, pasted text) into structured records.
  • You need to deduplicate a merged library before submission.
  • You need to verify that every DOI in your manuscript resolves and points to the right work.
  • You need to attach author ORCIDs to references.

Do NOT use this skill for systematic search/screening — use the literature-review skill. The two compose: search in literature-review, manage the resulting library here.

Prerequisites

  • Python 3.10 or newer.
  • Install canonical libraries:
    pip install bibtexparser pyzotero habanero citeproc-py anystyle
    pip install requests rapidfuzz
  • Accounts / keys:
    • Zotero user ID (numeric, https://www.zotero.org/settings/keys) and a private API key with library read/write; set ZOTERO_USER_ID and ZOTERO_API_KEY.
    • Crossref polite-pool email; set CROSSREF_EMAIL.
    • ORCID public API requires no key for reads; the member API needs credentials.
  • The anystyle CLI also needs Ruby (gem install anystyle) for full accuracy; the Python wheel includes a basic model.

Core workflows

1. Round-trip a BibTeX file with bibtexparser

import bibtexparser
from bibtexparser.bwriter import BibTexWriter
with open("refs.bib") as fh:
    db = bibtexparser.load(fh)
# Normalize all DOIs to lowercase, add a checksum-friendly key
for e in db.entries:
    if "doi" in e:
        e["doi"] = e["doi"].lower().lstrip("https://doi.org/")
        e["ID"] = e["doi"].replace("/", "_")
writer = BibTexWriter()
writer.indent = "  "
with open("refs_normalized.bib", "w") as fh:
    fh.write(writer.write(db))

2. Add items to a Zotero collection via pyzotero

from pyzotero import zotero
import os
z = zotero.Zotero(os.environ["ZOTERO_USER_ID"], "user",
                  os.environ["ZOTERO_API_KEY"])
col = [c for c in z.collections() if c["data"]["name"] == "Project X"][0]
template = z.item_template("journalArticle")
template.update({
    "title": "A Phase 3 Trial of Drug X in Chronic Disease",
    "creators": [{"creatorType": "author", "firstName": "Ada",
                  "lastName": "Lovelace"}],
    "DOI": "10.1000/xyz123", "date": "2025-04-01",
    "publicationTitle": "NEJM", "volume": "372", "pages": "1-10",
    "collections": [col["key"]],
})
resp = z.create_items([template])
print("created:", resp["success"]["0"])

3. Resolve DOIs via Crossref and fetch CSL-JSON

from habanero import Crossref
import requests, os
cr = Crossref(mailto=os.environ["CROSSREF_EMAIL"])
work = cr.works(ids="10.1038/s41586-021-03819-2")["message"]
print(work["title"][0], work.get("DOI"))

# ContentNegotiation -> CSL-JSON directly (no parsing needed)
headers = {"Accept": "application/vnd.citationstyles.csl+json"}
csl = requests.get("https://doi.org/10.1038/s41586-021-03819-2",
                   headers=headers, timeout=30).json()

4. Parse a free-text reference list with anystyle

# CLI: anystyle -f json parse references.txt
# Python (basic model):
import anystyle
refs = anystyle.parse("Lovelace, A. (2025). A Phase 3 Trial of Drug X. NEJM, 372(1), 1-10.",
                      format="csl")  # list of dicts

5. Render references with a CSL style (citeproc-py)

from citeproc import CitationStylesStyle, CitationItem, formatter
from citeproc.source.json import CiteProcJSON
import json
src = CiteProcJSON(json.load(open("refs.csl.json")))
style = CitationStylesStyle("styles/apa.csl", validate=False)
bib = style.bibliography()
items = [CitationItem(doi) for doi in [r["id"] for r in src.data]]
for k, v in bib.make_bibliography(items).items():
    print(v[0])

Best practices

  • Use the DOI as the primary key for every record; never invent a key from the title — collides and breaks dedup.
  • Pick one canonical format per project (CSL-JSON internally; export to BibTeX/RIS for submission). Convert on the way out, not in storage.
  • Version the bibliography in git — .bib files diff cleanly, .ris and JSON do too.
  • Run habanero.content_negotiation once per record on import to fetch authoritative metadata and overwrite your hand-typed fields.
  • Keep authors in familyName/givenName pairs in CSL-JSON; BibTeX author = {Lovelace, Ada} round-trips cleanly when Last, First is used.
  • Use the Zotero group library for shared projects (read/write for co-authors, public read for reviewers).
  • Tag records with the project name and acquisition date so re-runs are auditable.
  • Validate CSL-JSON against the CSL schema before submission.
  • Pin CSL style versions by commit hash in your repo; styles change and silently alter formatting.
  • For ORCID integration, store author.orcid as a CSL-JSON extension field; the CSL-JSON spec reserves this for round-tripping.

Common pitfalls

  • Mixing entry types (@article vs @inproceedings) for the same work — the journal name ends up in the booktitle slot and the style prints garbage.
  • Brace-balanced but unprotected titles in BibTeX break case preservation; wrap proper nouns: {YouTube}, {pH}.
  • Double-encoded HTML entities (&) in fields after multiple round-trips — sanitize with html.unescape on import.
  • The Zotero API rate limit (≈ 1 request/8 s for writes); batch create_items and back off on 429.
  • Treating Mendeley's deprecated API as current — Elsevier retired the public Mendeley API in 2024; export to BibTeX and migrate to Zotero.
  • Trusting anystyle on full-text references without spot-checking; the model is 90-95% accurate, so plan a manual pass.
  • Forgetting to deduplicate before submission — same DOI twice under two different keys renders as two list items in many CSL styles.
  • Hard-coding style names ("apa") instead of CSL file paths; the resolved style may differ from what your journal actually requires.

Worked example

End-to-end: take a list of DOIs, build a Zotero collection, then export a BibTeX file and an APA-formatted bibliography.

# 1) Resolve DOIs to CSL-JSON via Crossref ContentNegotiation
import requests, json
dois = ["10.1038/s41586-021-03819-2", "10.1126/science.abc1234",
        "10.1016/j.cell.2024.01.010"]
hdrs = {"Accept": "application/vnd.citationstyles.csl+json"}
records = []
for doi in dois:
    r = requests.get(f"https://doi.org/{doi}", headers=hdrs, timeout=30)
    if r.status_code == 200:
        records.append(r.json())
json.dump(records, open("refs.csl.json", "w"), indent=2)

# 2) Push to Zotero collection
from pyzotero import zotero
import os
z = zotero.Zotero(os.environ["ZOTERO_USER_ID"], "user",
                  os.environ["ZOTERO_API_KEY"])
col = z.create_collections([{"name": "DOI ingest",
                             "parentCollection": False}])
colkey = z.last_modified_collection_version
template = z.item_template("journalArticle")
for rec in records:
    item = dict(template)
    item["title"] = rec.get("title", "")
    item["DOI"] = rec["DOI"]
    item["date"] = rec.get("published", {}).get("date-parts", [[""]])[0][0]
    item["creators"] = rec.get("author", [])
    item["publicationTitle"] = rec.get("container-title", "")
    z.create_items([item])

# 3) Export BibTeX for LaTeX submissions
import bibtexparser
from bibtexparser.bwriter import BibTexWriter
db = bibtexparser.bibdatabase.BibDatabase()
db.entries = [{
    "ENTRYTYPE": "article", "ID": r["DOI"].replace("/", "_"),
    "title": "{" + r.get("title","") + "}",
    "author": " and ".join(f"{a.get('family','')}, {a.get('given','')}"
                           for a in r.get("author",[])),
    "journal": r.get("container-title", ""),
    "year": str(r.get("published",{}).get("date-parts",[[None]])[0][0] or ""),
    "doi": r["DOI"],
} for r in records]
w = BibTexWriter()
open("refs.bib","w").write(w.write(db))

Tools & libraries

ToolPurposeInstall
bibtexparserRead/write BibTeX, normalize entriespip install bibtexparser
pyzoteroZotero API: collections, items, attachments, notespip install pyzotero
habaneroCrossref works, ContentNegotiation, DataCitepip install habanero
citeproc-pyRender CSL-JSON with .csl style sheetspip install citeproc-py
anystyleParse free-text references into CSL-JSONgem install anystyle or pip install anystyle
requestsDOI resolution and ContentNegotiationpip install requests
rapidfuzzFuzzy-title dedup of merged librariespip install rapidfuzz
CSL style repository10,000+ journal styles (Zotero styles)https://www.zotero.org/styles
Mendeley (reference-only)GUI-only now (public API retired)desktop client
ORCID public APIAuthor disambiguation by ORCID iDhttps://api.orcid.org
BibTeX-tidyFormat and sort .bib filesnpm i -g bibtex-tidy
JabRefCross-platform BibTeX editor (GUI)https://www.jabref.org

References

Ethics & safety

  • Citation accuracy is a moral obligation. Always verify a DOI resolves to the work you intend; do not cite by memory or guess.
  • No citation cartels. Never agree to reciprocal or coerced citation; flag suspected citation manipulation to editors.
  • Honest attribution. Capture every author, use ORCID where available, and respect the CRediT taxonomy for contributor roles.
  • Originality. Citing a source does not license you to copy its text verbatim without quotes; paraphrase and attribute.
  • Self-citation transparency. Disclose self-citations in cover letters and conflict-of-interest statements.
  • Author name disambiguation. Use ORCID iDs in CSL-JSON; never invent author initials to "fit" a style.
  • Data sharing. When you submit the manuscript, share the underlying .bib/CSL-JSON file under a permissive license so reviewers and future readers can audit your reference list.
  • No metadata fabrication. If a field is unknown, leave it blank rather than inventing volume/issue/page numbers.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.