关于
This skill helps developers manage BibTeX bibliography files using R packages like RefManageR and bibtex. It can parse, merge, deduplicate, and generate .bib entries from identifiers like DOIs, and export clean files. Use it for creating or cleaning bibliographies in R Markdown/Quarto projects or merging collaborator files.
快速安装
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 中复制并粘贴此命令以安装该技能
技能文档
管參書
以 R(RefManageR、bibtex)造、合、去重 BibTeX 參書。析 .bib 為 R 結構,以 DOI 或題似合去重,由 DOI/ISBN/arXiv ID 生項,出淨排 .bib。
用
- 為 R Markdown 或 Quarto 項造新 .bib
- 合多協作者或源之參書
- 去重於複製積之 .bib
- 由 DOI 或他識程生 BibTeX 項
- 清並標現 .bib(一致鍵、排字段)
入
- 必:一或多 .bib 之路,或 DOI/ISBN/arXiv ID 列
- 可:出 .bib 路(默
references.bib) - 可:去重策(
doi、title、both;默both) - 可:排序(
author、year、key;默key) - 可:鍵生式(默
AuthorYear)
行
一:裝並載包
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)
得:諸包載無誤。
敗:RefManageR 裝敗→查 curl 與 xml2 系統庫。Ubuntu:sudo apt install libcurl4-openssl-dev libxml2-dev。
二:析現 .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。項計匹文件中 @article{、@book{ 塊數。
敗:析敗→查未匹括號或 .bib 中無效 UTF-8。bibtex::read.bib() 為嚴格析之退。
三:由識生項
# 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 附全元(題、作、刊、年、DOI)。
敗:DOI 解依 CrossRef API。請求敗→查網連與 DOI 是否有效。大批量或限速;請求間加 Sys.sleep(1)。
四:合多參書
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)))
得:含二文件項之合 BibEntry。
五:去重
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")
得:重項除。除重數印。
敗:題比過激(除非重)→升似閾 > 0.95 或僅用 method = "doi"。
六:排並出
# 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)))
得:淨 .bib 寫於盤附一致格、一項一塊、按引鍵字排。
敗:WriteBib 生編誤→確 R 會話 locale 支 UTF-8:Sys.setlocale("LC_ALL", "en_US.UTF-8")。
驗
- 出 .bib 無誤析:
RefManageR::ReadBib("references.bib") - 項計合預(入計減重)
- 無重 DOI:諸出 DOI 獨
- 諸項有引鍵
- 類所需字段存(至少作、題、年)
- 文件為有效 BibTeX(以
bibtex::read.bib()測)
忌
- 編問題:.bib 含 Latin-1 重音破 UTF-8 析。先轉編:
iconv -f ISO-8859-1 -t UTF-8 old.bib > new.bib - 未匹括號:缺一
}默棄項。大文件前驗括號平 - DOI 限速:CrossRef 節未認請求。以
RefManageR::BibOptions(check.entries = FALSE)設禮郵並批請求 - 鍵衝:合重鍵文件(皆有
Smith2020)默覆。合後重生鍵 - LaTeX 於題:題含
{DNA}或$\alpha$需謹處;RefManageR 保之而下游工或剝
參
format-citations- 格參書項為式引validate-references- 驗 .bib 項全與 DOI 解../reporting/format-apa-report- 以參書生 APA 格報../r-packages/write-vignette- 造引參之包 vignette
GitHub 仓库
Frequently asked questions
What is the manage-bibliography skill?
manage-bibliography is a Claude Skill by pjt222. Skills package instructions and resources that Claude loads on demand, so Claude can perform manage-bibliography-related tasks without extra prompting.
How do I install manage-bibliography?
Use the install commands on this page: add manage-bibliography to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.
What category does manage-bibliography belong to?
manage-bibliography is in the Meta category, tagged general.
Is manage-bibliography free to use?
Yes. manage-bibliography is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.
相关推荐技能
Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。
这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。
该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。
SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。
