/fetch:pubmed-nlmfrom fetch
Fetches PubMed/NLM biomedical articles via NCBI E-utilities API — metadata, structured abstract, MeSH terms, and PMC full text when open access. Activated by PubMed URLs, PMIDs, PMC IDs, or DOIs.
Ships in fetch. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Pull a PubMed record — bibliographic metadata, the structured abstract, MeSH indexing, and the PMC full text when the article is open access — into a directory. This skill knows nothing about vaults. It retrieves, and stops. notes:clip turns the result into a note.
Unlike every other skill in this plugin, do not open a browser for PubMed. NCBI publishes the entire corpus through E-utilities as XML over plain HTTP: no login, no cookies, no JavaScript, no rate-limit key for light use. There is no gstack section here because there is nothing for gstack to do.
Driving a browser at pubmed.ncbi.nlm.nih.gov would scrape a rendering of data the API hands over structured — losing MeSH qualifiers, grant numbers and author affiliations that never appear on the page — and would miss the full text entirely, which lives on a different host under a different id.
$ARGUMENTS should contain: <url|pmid|pmcid|doi> [output_dir]All four reference forms resolve to the same record:
| Input | Resolution |
|---|---|
https://pubmed.ncbi.nlm.nih.gov/26041386/ | direct |
26041386 | direct |
PMC4986668 or a /pmc/articles/PMC… URL | reverse-resolved to its PMID via the PMC record |
10.1093/jamia/ocv046 or a doi.org URL | resolved via esearch — efetch has no DOI lookup |
python3 ${CLAUDE_PLUGIN_ROOT}/scripts/pubmed_fetch.py $ARGUMENTS
The script handles everything:
efetch.fcgi?db=pubmed&id=<pmid>&retmode=xmlpmc id, fetches efetch.fcgi?db=pmc&id=<numeric>&retmode=xml for the full text<pmid>.json record, and a rendered <pmid>.mdSet NCBI_API_KEY to raise the rate limit from 3 to 10 requests/second, and NCBI_EMAIL to identify yourself to NCBI. Both are optional and neither is sent unless set — do not add the user's email without being asked.
pubmed, usually doi, often pmc and pii). Dozens means the reference list leaked into them — see Notes.full text: <n> chars or full text: unavailable — abstract only to stderr. Abstract-only is a normal outcome, not a failure — but report which one happened rather than letting the reader assume.Scope the article ids. .//ArticleIdList/ArticleId also matches the id list inside every <Reference>: on PMID 26041386 that is 103 ids instead of 4, and the first doi among them belongs to a cited paper. The record parses cleanly and points at the wrong article. The anchored path is PubmedData/ArticleIdList.
Never use elem.text on PubMed XML. .text is the text before the first child element, not the element's text. <ArticleTitle>Risk of <i>P. falciparum</i> infection</ArticleTitle> yields "Risk of " — a truncation with no error and no marker. Use ''.join(elem.itertext()) throughout.
MeSH indexing is not guaranteed. PMID 29036387 has no MeshHeadingList at all — newer and unindexed records simply lack one. Treat its absence as normal, never as a failed parse.
Figures and tables are nested inside the prose, not beside it. JATS puts <fig> and <table-wrap> within a <p>, so a naive flatten does two things at once: the caption is glued into the surrounding sentence, and .//p matches the caption's own <p> a second time as a body paragraph. Worse, a flattened <table> becomes Atrial fibrillation48 961Yes<0.001MarchOctober — corrupted data wearing the shape of prose. The script detaches floats before reading the body (handing the float's tail text back to its parent) and renders tables as real markdown grids. On PMID 26041386 this is the difference between a 35,603-character body and a 29,323-character one; the missing 6,280 characters were duplicated captions and mangled table cells.
One <table-wrap> can hold several <table> elements. PMC splits a table that broke across a page in the original layout, and find(".//table") returns only the first. Table 2 of PMID 26041386 is 12 rows plus 10 rows; taking the first block alone yields 9 of its 16 conditions in a table that looks entirely complete — the caption still says n = 16. Read every block and concatenate, resolving spans per block since a rowspan cannot cross the break.
Resolve colspan and rowspan before emitting rows. Table 2 of PMID 26041386 heads two columns with a colspan'd Birth Month Risk over High/Low, and rowspans the five columns to its left. Appending cells in document order puts High/Low under EHR Condition and N — every column label wrong, in a table that still renders perfectly well-formed.
Three smaller ones, all handled by the script:
A pmc id does not guarantee full text. Embargoed records return a valid document with no <body>. The script reports abstract-only rather than an empty section.
A cell can be legitimately empty. Table 2's Seasonal Pattern column holds sparkline graphics, not text, so it comes through blank. That is the honest rendering — the column exists and its content is an image the record does not hand over.
PMC citation superscripts flatten into the prose. presented in 1983<sup><xref>13</xref></sup> becomes presented in 1983.13, which reads as a decimal. The script brackets them: 1983.[13].
Figure captions are captured; figure images are not. The PMC XML names each graphic (ocv046f1p.jpg) but the file is not served from a predictable URL — /pmc/articles/<id>/bin/<name>, the pmc.ncbi.nlm.nih.gov equivalent, and the legacy utils/oa/oa.fcgi service all returned 404 for PMID 26041386 (checked 2026-09-14). Articles inside the PMC Open Access subset ship their images in a downloadable package; most publisher-deposited articles, including these JAMIA ones, do not. Report figures as caption-only rather than implying the images were fetched.
Abstract section labels differ between records — METHODS vs MATERIAL AND METHODS, CONCLUSIONS vs CONCLUSION. Render whatever labels arrive; do not normalise them to a fixed set.
The script prints progress to stderr and the directory as the final stdout line:
OUTPUT_DIR:/absolute/path/to/output
The marker must be last, and nothing is printed on failure — callers chain on it and must never reconstruct the path. A bad PMID, an unrecognised reference, or an unreachable NCBI exits non-zero with an ERROR: line on stderr and creates no directory.
# By URL, into a temp directory
/fetch:pubmed-nlm https://pubmed.ncbi.nlm.nih.gov/26041386/
# By bare PMID, into a named directory
/fetch:pubmed-nlm 26041386 ./papers/birth-month
# By DOI or PMC id
/fetch:pubmed-nlm 10.1093/jamia/ocx105 ./papers/exposures
/fetch:pubmed-nlm PMC4986668 ./papers/birth-month
What SKILL.md sets; muted values are Claude Code's defaults
11 skills in this plugin
/alphaxiv-paperUse when user shares an arxiv or alphaxiv URL, mentions a paper ID like 2401.12345, or asks to explain, summarize, or analyze a research paper. Fetches structured AI-generated overview from alphaxiv.org instead of reading raw PDFs./blog-postThis skill should be used when the user shares a blog/article URL (Medium, Substack, personal blog, news/long-form post) and asks to "download this blog post", "save this article", "archive this post with images", "clip this medium article", or otherwise wants a self-contained local copy. Extracts clean markdown via Defuddle, recovers lazy-loaded images via the gstack browser (which Defuddle drops), and — when the article contains Vedic astrology charts — invokes the fetch:vedic-chart skill to digitize them. Saves a folder with frontmatter + an images/ subfolder./Other plugins' skills for the same job
npx claudepluginhub mayank-io/mstack --plugin fetch