pubmed-database – Data & Science skill for AI agents
Direct REST API access to PubMed. Advanced Boolean/MeSH queries, E-utilities API, batch processing, citation management. For Python workflows, prefer biopython (Bio.Entrez). Use this for direct HTTP/REST work or custom API implementations.
Install the pubmed-database skill with one command
Pick the tool you use, copy the command and paste it in your terminal. The skill lands in that tool's skills folder and is ready in your next session.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/pubmed-database-34dd2.tgz | tar xz -C ~/.claude/skills
Call it in Claude Code: /pubmed-database – then describe the task you want done.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/pubmed-database-34dd2.tgz | tar xz -C ~/.codex/skills
Call it in Codex: $pubmed-database – then describe the task you want done.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/pubmed-database-34dd2.tgz | tar xz -C ~/.hermes/skills
Call it in Hermes Agent: /pubmed-database – then describe the task you want done.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/pubmed-database-34dd2.tgz | tar xz -C ~/.deepcode/skills
Call it in DeepSeek: /pubmed-database – then describe the task you want done.
SKILL.md content
Supporting material availability
This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:
<support-root>/references/api_reference.md<support-root>/references/search_syntax.md<support-root>/references/common_queries.md
Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.
PubMed Database
Overview
PubMed is the U.S. National Library of Medicine's comprehensive database providing free access to MEDLINE and life sciences literature. Construct advanced queries with Boolean operators, MeSH terms, and field tags, access data programmatically via E-utilities API for systematic reviews and literature analysis.
When to Use This Skill
This skill should be used when:
- Searching for biomedical or life sciences research articles
- Constructing complex search queries with Boolean operators, field tags, or MeSH terms
- Conducting systematic literature reviews or meta-analyses
- Accessing PubMed data programmatically via the E-utilities API
- Finding articles by specific criteria (author, journal, publication date, article type)
- Retrieving citation information, abstracts, or full-text articles
- Working with PMIDs (PubMed IDs) or DOIs
- Creating automated workflows for literature monitoring or data extraction
Core Capabilities
1. Advanced Search Query Construction
Construct sophisticated PubMed queries using Boolean operators, field tags, and specialized syntax.
Basic Search Strategies:
- Combine concepts with Boolean operators (AND, OR, NOT)
- Use field tags to limit searches to specific record parts
- Employ phrase searching with double quotes for exact matches
- Apply wildcards for term variations
- Use proximity searching for terms within specified distances
Example Queries:
# Recent systematic reviews on diabetes treatment
diabetes mellitus[mh] AND treatment[tiab] AND systematic review[pt] AND 2023:2024[dp]
# Clinical trials comparing two drugs
(metformin[nm] OR insulin[nm]) AND diabetes mellitus, type 2[mh] AND randomized controlled trial[pt]
# Author-specific research
smith ja[au] AND cancer[tiab] AND 2023[dp] AND english[la]When to consult search_syntax.md:
- Need comprehensive list of available field tags
- Require detailed explanation of search operators
- Constructing complex proximity searches
- Understanding automatic term mapping behavior
- Need specific syntax for date ranges, wildcards, or special characters
Grep pattern for field tags: \[au\]|\[ti\]|\[ab\]|\[mh\]|\[pt\]|\[dp\]
2. MeSH Terms and Controlled Vocabulary
Use Medical Subject Headings (MeSH) for precise, consistent searching across the biomedical literature.
MeSH Searching:
- [mh] tag searches MeSH terms with automatic inclusion of narrower terms
- [majr] tag limits to articles where the topic is the main focus
- Combine MeSH terms with subheadings for specificity (e.g., diabetes mellitus/therapy[mh])
Common MeSH Subheadings:
- /diagnosis - Diagnostic methods
- /drug therapy - Pharmaceutical treatment
- /epidemiology - Disease patterns and prevalence
- /etiology - Disease causes
- /prevention & control - Preventive measures
- /therapy - Treatment approaches
Example:
# Diabetes therapy with specific focus
"Diabetes Mellitus, Type 2/drug therapy"[mh] AND "Cardiovascular Diseases/prevention and control"[mh]3. Article Type and Publication Filtering
Filter results by publication type, date, text availability, and other attributes.
Publication Types (use [pt] field tag):
- Clinical Trial
- Meta-Analysis
- Randomized Controlled Trial
- Review
- Systematic Review
- Case Reports
- Guideline
Date Filtering:
- Single year:
2024[dp] - Date range:
2020:2024[dp] - Specific date:
2024/03/15[dp]
Text Availability:
- Free full text: Add
AND free full text[sb]to query - Has abstract: Add
AND hasabstract[text]to query
Example:
# Recent free full-text RCTs on hypertension
hypertension[mh] AND randomized controlled trial[pt] AND 2023:2024[dp] AND free full text[sb]4. Programmatic Access via E-utilities API
Access PubMed data programmatically using the NCBI E-utilities REST API for automation and bulk operations.
Core API Endpoints:
1. ESearch - Search database and retrieve PMIDs
2. EFetch - Download full records in various formats
3. ESummary - Get document summaries
4. EPost - Upload UIDs for batch processing
5. ELink - Find related articles and linked data
Basic Workflow:
import os
import time
import requests
base_url = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/"
common = {"db": "pubmed", "tool": "reviewed-literature-client",
"email": os.environ["NCBI_CONTACT_EMAIL"]}
if os.environ.get("NCBI_API_KEY"):
common["api_key"] = os.environ["NCBI_API_KEY"]
session = requests.Session()
session.headers["User-Agent"] = "reviewed-literature-client/1.0"
# POST avoids putting optional credentials and the query in the request URL.
response = session.post(base_url + "esearch.fcgi", data={**common,
"term": "diabetes[tiab] AND 2024[dp]", "retmax": 100, "retmode": "json"}, timeout=30)
response.raise_for_status()
result = response.json()["esearchresult"]
pmids = result["idlist"]
abstracts = ""
if pmids:
time.sleep(0.4) # This process stays below 3 req/s; coordinate all shared clients too.
response = session.post(base_url + "efetch.fcgi", data={**common,
"id": ",".join(pmids), "rettype": "abstract", "retmode": "text"}, timeout=30)
response.raise_for_status()
abstracts = response.text
# This is at most 100 returned IDs, not the entire result set; inspect count/translation.Rate Limits:
- Without API key: 3 requests/second
- With API key: 10 requests/second
- Always include User-Agent header
Best Practices:
- History improves batching but does not remove PubMed result-retrieval caps; partition large searches reproducibly or use the documented bulk-data route
- Implement batch operations via EPost for multiple UIDs
- Cache results locally to minimize redundant calls
- Respect rate limits to avoid service disruption
When to consult api_reference.md:
- Need detailed endpoint documentation
- Require parameter specifications for each E-utility
- Constructing batch operations or history server workflows
- Understanding response formats (XML, JSON, text)
- Troubleshooting API errors or rate limit issues
Grep pattern for API endpoints: esearch|efetch|esummary|epost|elink|einfo
5. Citation Matching and Article Retrieval
Find articles using partial citation information or specific identifiers.
By Identifier:
# By PMID
12345678[pmid]
# By DOI
10.1056/NEJMoa123456[doi]
# By PMC ID
PMC123456[pmc]Citation Matching (via ECitMatch API):
Use journal name, year, volume, page, and author to find PMIDs:
Format: journal|year|volume|page|author|key|
Example (synthetic fields): JournalTitle|2024|12|34|ExampleAuthor|key1|By Author and Metadata:
# First author with year and topic
smith ja[1au] AND 2023[dp] AND cancer[tiab]
# Journal, volume, and page
nature[ta] AND 2024[dp] AND 456[vi] AND 123-130[pg]6. Systematic Literature Reviews
Conduct comprehensive literature searches for systematic reviews and meta-analyses.
PICO Framework (Population, Intervention, Comparison, Outcome):
Structure clinical research questions systematically:
# Example: Diabetes treatment effectiveness
# P: diabetes mellitus, type 2[mh]
# I: metformin[nm]
# C: lifestyle modification[tiab]
# O: glycemic control[tiab]
diabetes mellitus, type 2[mh] AND
(metformin[nm] OR lifestyle modification[tiab]) AND
glycemic control[tiab] AND
randomized controlled trial[pt]Comprehensive Search Strategy:
# Include multiple synonyms and MeSH terms
(disease name[tiab] OR disease name[mh] OR synonym[tiab]) AND
(treatment[tiab] OR therapy[tiab] OR intervention[tiab]) AND
(systematic review[pt] OR meta-analysis[pt] OR randomized controlled trial[pt]) AND
2020:2024[dp] AND
english[la]Search Refinement:
1. Start broad, review results
2. Add specificity with field tags
3. Apply date and publication type filters
4. Use Advanced Search to view query translation
5. Combine search history for complex queries
When to consult common_queries.md:
- Need e
… (full content is in the download package)
Related skills
- quality-nonconformance – Operational guidance for quality control, non-conformance investigation, root cause…
- quant-analyst – Build financial models, backtest trading strategies, and analyze market data. Implements…
- radar-satellite-analysis – Interpret weather radar and satellite observations by validating product metadata and…
- radare2 – Drive the radare2 CLI for binary reconnaissance, disassembly, analysis, function…
- radio-sdr – Authorized RF/SDR security research: signal identification, replay-feasibility study in…
- rag-implementation – RAG (Retrieval-Augmented Generation) implementation workflow covering embedding…
- redis – Configure Redis for caching and data storage. Set up clustering, persistence, and…
- research-prompt – Turn vague research needs into one precise deep-research prompt with context and output…