skills/43-wentorai-research-plugins/skills/writing/citation/bibtex-management-guide/SKILL.md
Clean, format, deduplicate, and manage BibTeX bibliography files for LaTeX
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research bibtex-management-guideInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A skill for maintaining clean, consistent, and complete BibTeX bibliography files. Covers formatting standards, deduplication, common errors, and automated cleanup workflows essential for LaTeX-based academic writing.
% Article in a journal
@article{smith2024deep,
author = {Smith, John A. and Doe, Jane B.},
title = {Deep Learning for Climate Prediction: A Comparative Study},
journal = {Nature Machine Intelligence},
year = {2024},
volume = {6},
number = {3},
pages = {234--248},
doi = {10.1038/s42256-024-00001-1}
}
% Conference proceedings
@inproceedings{lee2024attention,
author = {Lee, Wei and Chen, Li},
title = {Attention Mechanisms for Scientific Document Understanding},
booktitle = {Proceedings of the 62nd Annual Meeting of the ACL},
year = {2024},
pages = {1123--1135},
publisher = {Association for Computational Linguistics},
doi = {10.18653/v1/2024.acl-main.89}
}
% Book
@book{bishop2006pattern,
author = {Bishop, Christopher M.},
title = {Pattern Recognition and Machine Learning},
publisher = {Springer},
year = {2006},
isbn = {978-0387310732}
}
import re
from collections import defaultdict
def parse_bibtex_entries(bib_content: str) -> list[dict]:
"""
Parse a BibTeX file into structured entries.
"""
entries = []
pattern = r'@(\w+)\{([^,]+),\s*(.*?)\n\}'
matches = re.finditer(pattern, bib_content, re.DOTALL)
for match in matches:
entry = {
'type': match.group(1).lower(),
'key': match.group(2).strip(),
'raw': match.group(0),
'fields': {}
}
fields_str = match.group(3)
field_pattern = r'(\w+)\s*=\s*[{\"](.+?)[}\"]'
for field_match in re.finditer(field_pattern, fields_str, re.DOTALL):
entry['fields'][field_match.group(1).lower()] = field_match.group(2).strip()
entries.append(entry)
return entries
def deduplicate_bibtex(entries: list[dict]) -> dict:
"""
Find and remove duplicate BibTeX entries.
Deduplication strategy:
1. Exact DOI match
2. Fuzzy title match (normalized)
3. Author + year + first title word match
"""
seen_dois = {}
seen_titles = {}
duplicates = []
unique = []
for entry in entries:
doi = entry['fields'].get('doi', '').lower().strip()
title = entry['fields'].get('title', '').lower().strip()
title_normalized = re.sub(r'[^a-z0-9\s]', '', title)
is_duplicate = False
# Check DOI match
if doi and doi in seen_dois:
duplicates.append({
'entry': entry['key'],
'duplicate_of': seen_dois[doi],
'reason': 'same DOI'
})
is_duplicate = True
elif doi:
seen_dois[doi] = entry['key']
# Check title match
if not is_duplicate and title_normalized:
if title_normalized in seen_titles:
duplicates.append({
'entry': entry['key'],
'duplicate_of': seen_titles[title_normalized],
'reason': 'same title'
})
is_duplicate = True
else:
seen_titles[title_normalized] = entry['key']
if not is_duplicate:
unique.append(entry)
return {
'unique_entries': len(unique),
'duplicates_found': len(duplicates),
'duplicates': duplicates,
'entries': unique
}
def clean_bibtex_entry(entry: dict) -> dict:
"""
Clean and standardize a BibTeX entry.
"""
cleaned = entry.copy()
fields = cleaned['fields']
# Standardize author names: "Last, First and Last, First"
if 'author' in fields:
authors = fields['author']
# Fix common issues
authors = authors.replace(' AND ', ' and ')
authors = authors.replace(' & ', ' and ')
fields['author'] = authors
# Ensure proper page ranges with en-dash
if 'pages' in fields:
fields['pages'] = fields['pages'].replace('-', '--').replace('---', '--')
# Capitalize title properly (protect proper nouns with braces)
if 'title' in fields:
title = fields['title']
# Protect acronyms and proper nouns
words = title.split()
for i, word in enumerate(words):
if word.isupper() and len(word) > 1:
words[i] = '{' + word + '}'
fields['title'] = ' '.join(words)
# Add missing DOI prefix
if 'doi' in fields:
doi = fields['doi']
doi = doi.replace('https://doi.org/', '')
doi = doi.replace('http://dx.doi.org/', '')
fields['doi'] = doi
# Remove empty fields
fields = {k: v for k, v in fields.items() if v.strip()}
cleaned['fields'] = fields
return cleaned
import requests
def doi_to_bibtex(doi: str) -> str:
"""
Retrieve a complete BibTeX entry from a DOI using CrossRef.
"""
url = f"https://doi.org/{doi}"
headers = {'Accept': 'application/x-bibtex'}
response = requests.get(url, headers=headers, allow_redirects=True)
if response.status_code == 200:
return response.text
else:
return f"% Error: Could not retrieve BibTeX for DOI {doi}"
# Example
bibtex = doi_to_bibtex('10.1038/s41586-021-03819-2')
print(bibtex)
Consistent citation keys improve readability:
Convention: authorYEARfirstword
Examples:
smith2024deep
lee2024attention
bishop2006pattern
For multiple papers by same author in same year:
smith2024a, smith2024b
For papers with many authors:
smithetal2024deep (use "etal" for 3+ authors)
Before submitting a manuscript, validate your BibTeX file:
\cite{} in the manuscript has a matching entry in the .bib file--), not single hyphenUse biber --validate-datamodel or checkcites for automated validation.
development
Conduct rigorous thematic analysis (TA) of qualitative data following Braun and Clarke's (2006) six-phase framework. Use whenever the user mentions 'thematic analysis', 'TA', 'Braun and Clarke', 'qualitative coding', 'identifying themes', or asks for help analysing interviews, focus groups, open-ended survey responses, or transcripts to identify patterns. Also trigger for questions about inductive vs theoretical coding, semantic vs latent themes, essentialist vs constructionist epistemology, building a thematic map, or writing up a qualitative findings section. Covers all six phases, the four upfront analytic decisions, the 15-point quality checklist, and the five common pitfalls. Produces a Word document write-up and an annotated thematic map. Does NOT cover IPA, grounded theory, discourse analysis, conversation analysis, or narrative analysis — use a different method for those.
development
Guide users through writing a systematic literature review (SLR) following the PRISMA 2020 framework. Use this skill whenever the user mentions 'systematic review', 'systematic literature review', 'SLR', 'PRISMA', 'PRISMA 2020', 'PRISMA flow diagram', 'PRISMA checklist', or asks for help writing, structuring, or auditing a literature review that follows reporting guidelines. Also trigger when the user asks about inclusion/exclusion criteria for a review, search strategies for databases like Scopus/WoS/PubMed, study selection processes, risk of bias assessment, or narrative synthesis for a review paper. This skill covers the full PRISMA 2020 checklist (27 items), produces a Word document manuscript in strict journal article format, generates an annotated PRISMA flow diagram, and enforces APA 7th Edition referencing throughout. It does NOT cover meta-analysis or statistical pooling. By Chuah Kee Man.
testing
Performs placebo-in-time sensitivity analysis with hierarchical null model and optional Bayesian assurance. Use when checking model robustness, verifying lack of pre-intervention effects, or estimating study power.
data-ai
Fit, summarize, plot, and interpret a chosen CausalPy experiment. Use after the causal method has been selected, including when configuring PyMC/sklearn models and scale-aware custom priors.