manage-bibliography
について
このスキルは、開発者がRを通じてBibTeX文献目録を管理することを支援し、解析、重複排除を伴う統合、DOIやISBNなどの識別子からのエントリ生成を可能にします。R MarkdownやQuarto用の整理された.bibファイルの作成や、複数の共同研究者からの文献目録を統合する際に有用です。主な機能には、DOIやタイトルの類似性に基づくインテリジェントな重複排除、および整列され構造化されたBibTeX出力のエクスポートが含まれます。
クイックインストール
Claude Code
推奨npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/manage-bibliographyこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします
ドキュメント
Manage Bibliography
Create, merge, dedup BibTeX bib files via R. Full lifecycle: parse existing .bib → structured R, gen new entries from identifiers (DOI, ISBN, arXiv ID), merge multi bibs w/ intelligent dedup, export clean consistent .bib.
Use When
- New .bib for R Markdown / Quarto project
- Merge bibs from multi collaborators / sources
- Dedup .bib grown by copy-paste accumulation
- Gen BibTeX entries programmatically from DOIs / identifiers
- Clean + standardize existing .bib (consistent keys, sorted fields)
In
- Req: Path to ≥1 .bib files, or list of DOIs/ISBNs/arXiv IDs
- Opt: Output .bib path (default:
references.bib) - Opt: Dedup strategy (
doi,title,both; default:both) - Opt: Sort order (
author,year,key; default:key) - Opt: Key gen pattern (default:
AuthorYear)
Do
Step 1: Install + Load Pkgs
required_packages <- c("RefManageR", "bibtex", "stringdist")
missing <- required_packages[!vapply(required_packages, requireNamespace,
logical(1), quietly = TRUE)]
if (length(missing) > 0) install.packages(missing)
library(RefManageR)
→ All pkgs load w/o errs.
If err: RefManageR fails → check curl + xml2 sys libs avail. Ubuntu: sudo apt install libcurl4-openssl-dev libxml2-dev.
Step 2: Parse Existing .bib
bib <- RefManageR::ReadBib("references.bib", check = FALSE)
message(sprintf("Parsed %d entries from references.bib", length(bib)))
# Inspect structure
print(bib[1:3])
# Access fields programmatically
keys <- names(bib)
years <- vapply(bib, function(x) x$year %||% NA_character_, character(1))
→ BibEntry obj w/ all entries. Count matches @article{, @book{, etc blocks.
If err: Parse fails → check unmatched braces / invalid UTF-8. Fallback: bibtex::read.bib() w/ stricter parsing.
Step 3: Gen Entries from Identifiers
# From DOI
entry_doi <- RefManageR::GetBibEntryWithDOI("10.1093/bioinformatics/btz848")
# From a vector of DOIs
dois <- c("10.1093/bioinformatics/btz848", "10.1038/s41586-020-2649-2")
entries <- do.call(c, lapply(dois, function(d) {
tryCatch(
RefManageR::GetBibEntryWithDOI(d),
error = function(e) {
warning(sprintf("Failed to fetch DOI %s: %s", d, e$message))
NULL
}
)
}))
entries <- Filter(Negate(is.null), entries)
→ BibEntry objs w/ complete metadata (title, author, journal, year, DOI) per resolved identifier.
If err: DOI resolution → CrossRef API. Failed → check connectivity + DOI valid. Rate limiting for large batches → Sys.sleep(1) between reqs.
Step 4: Merge Multi Bibs
bib1 <- RefManageR::ReadBib("project_a.bib", check = FALSE)
bib2 <- RefManageR::ReadBib("project_b.bib", check = FALSE)
# Simple merge
merged <- c(bib1, bib2)
message(sprintf("Merged: %d + %d = %d entries (before dedup)",
length(bib1), length(bib2), length(merged)))
→ Combined BibEntry obj w/ entries from both files.
Step 5: Dedup Entries
deduplicate_bib <- function(bib, method = "both") {
n_before <- length(bib)
keys_to_remove <- c()
for (i in seq_along(bib)) {
if (names(bib)[i] %in% keys_to_remove) next
for (j in seq(i + 1, length(bib))) {
if (j > length(bib)) break
if (names(bib)[j] %in% keys_to_remove) next
is_dup <- FALSE
if (method %in% c("doi", "both")) {
doi_i <- bib[[i]]$doi %||% ""
doi_j <- bib[[j]]$doi %||% ""
if (nzchar(doi_i) && nzchar(doi_j) && tolower(doi_i) == tolower(doi_j)) {
is_dup <- TRUE
}
}
if (!is_dup && method %in% c("title", "both")) {
title_i <- tolower(gsub("[^a-z0-9 ]", "", tolower(bib[[i]]$title %||% "")))
title_j <- tolower(gsub("[^a-z0-9 ]", "", tolower(bib[[j]]$title %||% "")))
if (nzchar(title_i) && nzchar(title_j)) {
sim <- 1 - stringdist::stringdist(title_i, title_j, method = "jw")
if (sim > 0.95) is_dup <- TRUE
}
}
if (is_dup) keys_to_remove <- c(keys_to_remove, names(bib)[j])
}
}
if (length(keys_to_remove) > 0) {
bib <- bib[!names(bib) %in% keys_to_remove]
}
message(sprintf("Deduplication: %d -> %d entries (%d duplicates removed)",
n_before, length(bib), n_before - length(bib)))
bib
}
merged <- deduplicate_bib(merged, method = "both")
→ Dup entries removed. Count of removed dups printed.
If err: Title comparison too aggressive (removing non-dups) → raise threshold > 0.95 or switch method = "doi" only.
Step 6: Sort + Export
# Sort by citation key
sorted_bib <- sort(merged, sorting = "nyt") # name-year-title
# Export to .bib file
RefManageR::WriteBib(sorted_bib, file = "references.bib", biblatex = FALSE)
message(sprintf("Wrote %d entries to references.bib", length(sorted_bib)))
→ Clean .bib on disk w/ consistent format, one entry per block, sorted alphabetically by key.
If err: WriteBib encoding issues → ensure R locale supports UTF-8: Sys.setlocale("LC_ALL", "en_US.UTF-8").
Check
- Output .bib parses w/o errs:
RefManageR::ReadBib("references.bib") - Entry count matches expectations (input - dups)
- No dup DOIs remain: all DOIs in output unique
- All entries have citation key
- Required fields per entry type (author, title, year min)
- File valid BibTeX (test w/
bibtex::read.bib())
Traps
- Encoding issues: Latin-1 accents break UTF-8 parsers. Convert first:
iconv -f ISO-8859-1 -t UTF-8 old.bib > new.bib - Unmatched braces: Single missing
}silently drops entries. Validate balance before parsing large. - DOI rate limiting: CrossRef throttles unauthenticated. Set polite email w/
RefManageR::BibOptions(check.entries = FALSE)+ batch reqs. - Key collisions: Merging files w/ dup keys (both have
Smith2020) silently overwrites. Regen keys after merge. - LaTeX in titles: Titles w/
{DNA}/$\alpha$need careful handling. RefManageR preserves but downstream may strip.
→
format-citations— format bib entries → styled citationsvalidate-references— verify completeness + DOI resolution../reporting/format-apa-report— APA-formatted reports using bibs../r-packages/write-vignette— pkg vignettes citing refs
GitHub リポジトリ
関連スキル
content-collections
メタこのスキルは、Content Collections(Markdown/MDXファイルを型安全なデータコレクションに変換するTypeScriptファーストのツール)の本番環境でテストされた設定を提供します。Zodバリデーションによる型安全性を実現し、ブログ、ドキュメントサイト、コンテンツ重視のVite + Reactアプリケーション構築時にご利用ください。Viteプラグインの設定、MDXコンパイルから、デプロイ最適化、スキーマバリデーションまで、すべてを網羅しています。
polymarket
メタこのスキルは、開発者がPolymarket予測市場プラットフォームを活用したアプリケーション構築を可能にします。API統合による取引や市場データの取得に加え、WebSocketを介したリアルタイムデータストリーミングにより、ライブ取引や市場活動を監視できます。取引戦略の実装や、ライブ市場更新を処理するツールの作成にご利用ください。
creating-opencode-plugins
メタこのスキルは、開発者がコマンド、ファイル、LSP操作など25種類以上のイベントタイプにフックするOpenCodeプラグインを作成することを支援します。JavaScript/TypeScriptモジュール向けに、プラグイン構造、イベントAPI仕様、および実装パターンを提供します。カスタムイベント駆動ロジックでOpenCode AIアシスタントのライフサイクルをインターセプト、監視、または拡張する必要がある場合にご利用ください。
sglang
メタSGLangは、高性能なLLMサービングフレームワークであり、RadixAttentionプレフィックスキャッシュを活用したJSON、正規表現、エージェントワークフロー向けの高速で構造化された生成を特長とします。特にプレフィックスが繰り返されるタスクにおいて、大幅に高速な推論を実現し、複雑な構造化出力やマルチターン対話に最適です。制約付きデコードが必要な場合や、広範なプレフィックス共有を伴うアプリケーションを構築する場合は、vLLMなどの代替案ではなくSGLangを選択してください。
