Medical-research-skills bib-formatter
Convert reference lists and in-text citations between RIS, BibTeX, plain text, and CSL-JSON, triggered when you need to unify bibliography/citation styles before journal submission or compare before/after formatting differences.
install
source · Clone the upstream repo
git clone https://github.com/aipoch/medical-research-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/aipoch/medical-research-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/scientific-skills/Other/bib-formatter" ~/.claude/skills/aipoch-medical-research-skills-bib-formatter && rm -rf "$T"
manifest:
scientific-skills/Other/bib-formatter/SKILL.mdsource content
When to Use
- You have a bibliography in RIS/BibTeX/plain text/CSL-JSON and must reformat it to a journal style (e.g., NEJM, The Lancet, Nature) before submission.
- You need to switch in-text citation formatting (e.g., generating formatted citations for specific cite keys/IDs).
- You are consolidating references from multiple sources and want a single consistent output style.
- You want a before/after comparison to verify formatting changes and spot missing metadata.
- You need to validate and repair incomplete entries (missing authors, year, journal, pages, DOI/URL) prior to final export.
Key Features
- Supports input formats: RIS, BibTeX, plain text, CSL-JSON.
- Outputs bibliography entries compatible with CSL styles (including NEJM/Lancet/Nature or any custom
)..csl - Journal-name driven style selection with automatic CSL retrieval (exact match preferred; download first, then search fallback).
- Batch conversion via
.scripts/format_bibliography.py - In-text citation generation mode for specified cite keys/IDs.
- Produces a Markdown Before/After table (minimum 2 examples) for quick review.
- Detects entries that cannot be reliably parsed and requests missing fields.
Dependencies
- Python 3.10+
- Citation Style Language (CSL) style files (
) for target formatting (e.g.,.csl
,styles/nature.csl
,styles/the-lancet.csl
)styles/new-england-journal-of-medicine.csl
Example Usage
1) Auto-retrieve a journal style (recommended)
python scripts/format_bibliography.py \ --input refs.bib \ --input-format bibtex \ --journal "Nature"
2) Use a local CSL style file for bibliography formatting
python scripts/format_bibliography.py \ --input refs.bib \ --input-format bibtex \ --style "styles/nature.csl" \ --output formatted.txt
3) RIS input example
python scripts/format_bibliography.py \ --input refs.ris \ --input-format ris \ --style "styles/the-lancet.csl"
4) In-text citations mode (format citations for specific IDs)
python scripts/format_bibliography.py \ --input refs.json \ --input-format csljson \ --style "styles/new-england-journal-of-medicine.csl" \ --mode citations \ --cite-keys "ITEM-1,ITEM-2"
Implementation Details
-
Workflow
- Collect input text/files and identify the input format:
.ris | bibtex | plain | csljson - Choose the target style by either:
- providing
(auto-retrieval; exact match prioritized; download first, then search), or--journal "<Journal Name>" - providing
(local CSL file).--style "<path/to/style.csl>"
- providing
- Run batch conversion using
.scripts/format_bibliography.py - Validate completeness of critical fields and rerun after fixing missing metadata:
- author(s), year, title, journal/container title, volume/issue, pages, DOI/URL.
- After formatting, append a Markdown comparison table with at least two Before/After examples.
- Collect input text/files and identify the input format:
-
Input parsing and field mapping
- Refer to
for parsing rules, field mapping, and format-specific details.references/input-formats.md
- Refer to
-
Output requirements
- All instructions/prompts shown to the user must be in Chinese.
- Clearly state the target CSL style and the source input format.
- For entries that cannot be reliably parsed, prompt in Chinese and list the missing fields that must be completed.
- Always include a Markdown Before/After comparison table (≥ 2 examples) at the end.
-
Quality checklist
- Output matches the target journal style (NEJM/Lancet/Nature/custom CSL).
- Required metadata is complete: author, year, journal, volume/issue/pages, DOI/URL.
- Sorting, punctuation, and capitalization follow the CSL style rules.