PubMed Search Specialist
Expert tool for constructing sophisticated Boolean queries to search PubMed/MEDLINE database with precision.
When to Use
- - Use this skill when the task needs Build complex Boolean query strings for precise PubMed/MEDLINE literature retrieval. Trigger when user needs MeSH term mapping, Boolean query construction, advanced PubMed filters, citation searching, systematic review search strategy, or clinical query optimization.
- Use this skill for evidence insight tasks that require explicit assumptions, bounded scope, and a reproducible output format.
- Use this skill when you need a documented fallback path for missing inputs, execution errors, or partial evidence.
Key Features
- - Scope-focused workflow aligned to: Build complex Boolean query strings for precise PubMed/MEDLINE literature retrieval. Trigger when user needs MeSH term mapping, Boolean query construction, advanced PubMed filters, citation searching, systematic review search strategy, or clinical query optimization.
- Packaged executable path(s):
scripts/main.py. - Reference material available in
references/ for task-specific guidance. - Structured execution path designed to keep outputs consistent and reviewable.
Dependencies
See ## Prerequisites above for related details.
- -
Python: 3.10+. Repository baseline for current packaged skills. - INLINECODE5 :
unspecified. Declared in requirements.txt. - INLINECODE8 :
unspecified. Declared in requirements.txt.
Example Usage
CODEBLOCK0
Example run plan:
- 1. Confirm the user input, output path, and any required config values.
- Edit the in-file
CONFIG block or documented parameters if the script uses fixed settings. - Run
python scripts/main.py with the validated inputs. - Review the generated output and return the final artifact with any assumptions called out.
Implementation Details
See ## Workflow above for related details.
- - Execution model: validate the request, choose the packaged workflow, and produce a bounded deliverable.
- Input controls: confirm the source files, scope limits, output format, and acceptance criteria before running any script.
- Primary implementation surface:
scripts/main.py. - Reference guidance:
references/ contains supporting rules, prompts, or checklists. - Parameters to clarify first: input path, output path, scope filters, thresholds, and any domain-specific constraints.
- Output discipline: keep results reproducible, identify assumptions explicitly, and avoid undocumented side effects.
Quick Check
Use this command to verify that the packaged script entry point can be parsed before deeper execution.
CODEBLOCK1
Audit-Ready Commands
Use these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.
CODEBLOCK2
Workflow
- 1. Confirm the user objective, required inputs, and non-negotiable constraints before doing detailed work.
- Validate that the request matches the documented scope and stop early if the task would require unsupported assumptions.
- Use the packaged script path or the documented reasoning path with only the inputs that are actually available.
- Return a structured result that separates assumptions, deliverables, risks, and unresolved items.
- If execution fails or inputs are incomplete, switch to the fallback path and state exactly what blocked full completion.
Core Capabilities
- - MeSH Term Mapping: Convert natural language concepts to standardized Medical Subject Headings
- Boolean Query Builder: Construct complex nested queries with AND/OR/NOT operators
- Advanced Filters: Apply study type, date, language, age, and species filters
- Search Strategy Optimization: Refine sensitivity vs specificity trade-offs
Usage Workflow
1. Concept Extraction
Extract key concepts from user's research question using PICO framework:
- - Population/Problem
- Intervention
- Comparison
- Outcome
2. MeSH Term Mapping
For each concept, identify appropriate MeSH terms:
- - Preferred terms (mapped to MeSH hierarchy)
- Entry terms (synonyms mapped to preferred)
- Subheadings for precision
- Explode vs Focus options
3. Boolean Construction
Build query strings following PubMed syntax:
CODEBLOCK3
4. Filter Application
Append filters as needed:
- - Publication dates: INLINECODE16
- Article types:
Clinical Trial, Review, INLINECODE19 - Species:
humans[MeSH Terms] or INLINECODE21 - Languages: INLINECODE22
- Age groups:
adult[MeSH Terms], INLINECODE24
5. Search Strategy Output
Provide complete, copy-paste ready PubMed search string with:
- - Line-by-line breakdown
- Estimated result count guidance
- Alternative strategies for sensitivity/specificity balance
Key MeSH Features
| Feature | Syntax | Use Case |
|---|
| MeSH Terms | INLINECODE25 | Subject heading search |
| MeSH Major Topic |
"Diabetes Mellitus"[MeSH Major Topic] | Core focus articles |
| Explode |
"Diabetes Mellitus"[MeSH Terms:noexp] | Exclude subcategories |
| Subheadings |
"Diabetes Mellitus/drug therapy"[MeSH Terms] | Specific aspects |
| Entry Terms |
"Blood Sugar"[Title/Abstract] | Non-MeSH synonyms |
Boolean Operators
- - AND: Both terms must appear (narrows search)
- OR: Either term may appear (broadens search)
- NOT: Exclude terms (use sparingly)
Operator Precedence: Use parentheses to control evaluation order.
Field Tags Reference
| Tag | Field | Example |
|---|
| INLINECODE30 | Medical Subject Headings | INLINECODE31 |
| INLINECODE32 |
Article title only |
"stroke"[Title] |
|
[Title/Abstract] | Title and abstract |
"aspirin"[Title/Abstract] |
|
[Author] | Author name |
"Smith J"[Author] |
|
[Journal] | Journal name |
"Lancet"[Journal] |
|
[Publication Date] | Date range |
2020:2024[Publication Date] |
|
[Language] | Article language |
english[Language] |
|
[Publication Type] | Article type |
clinical trial[Publication Type] |
Clinical Query Filters
Therapy
CODEBLOCK4
Diagnosis
CODEBLOCK5
Prognosis
CODEBLOCK6
Etiology
CODEBLOCK7
Parameters
| Parameter | Type | Default | Description |
|---|
| INLINECODE46 | str | Required | Population/Problem |
| INLINECODE47 |
str | Required | Intervention |
|
--comparison | str | Required | Comparison |
|
--outcome | str | Required | Outcome |
|
--study-type | str | Required | Clinical query category |
|
--format | str | 'lines' | Output format |
Example: Complete Search Strategy
Research Question: Does aspirin reduce stroke risk in diabetic patients?
Line 1 - Population:
CODEBLOCK8
Line 2 - Intervention:
CODEBLOCK9
Line 3 - Outcome:
CODEBLOCK10
Line 4 - Study Type Filter:
CODEBLOCK11
Final Query:
CODEBLOCK12
MeSH Browser Usage
When mapping terms:
- 1. Check MeSH Browser for exact term hierarchy
- Note tree numbers for related terms
- Identify entry terms (synonyms)
- Consider subheadings for precision
- Decide on explode vs noexp based on scope needs
Quality Checklist
Before finalizing query:
- - [ ] All concepts covered with OR within, AND between groups
- [ ] MeSH terms verified against current MeSH database
- [ ] Free-text synonyms included for completeness
- [ ] Filters appropriate for research question
- [ ] Parentheses balanced and precedence correct
- [ ] Copy-paste ready for PubMed search box
Technical Difficulty
🔴 High - Requires understanding of:
- - MeSH hierarchical structure and term relationships
- Boolean logic and operator precedence
- Field tag semantics and limitations
- Search sensitivity vs specificity trade-offs
- Clinical query methodology
⚠️ Verification Required: MeSH terms change annually. Always verify current MeSH version at https://meshb.nlm.nih.gov/
References
See references/mesh-structure.md for detailed MeSH hierarchy guidance.
See references/boolean-examples.md for categorized query templates.
Risk Assessment
| Risk Indicator | Assessment | Level |
|---|
| Code Execution | Python scripts executed locally | Medium |
| Network Access |
PubMed E-utilities API calls | High |
| File System Access | Read/write search strategies | Low |
| Instruction Tampering | Query construction guidelines | Low |
| Data Exposure | Search terms logged locally | Low |
Security Checklist
- - [ ] No hardcoded credentials or API keys
- [ ] NCBI API requests use HTTPS only
- [ ] API rate limits respected (max 3 requests/second without API key)
- [ ] Input validation for search terms (injection prevention)
- [ ] Output directory restricted to workspace
- [ ] Error messages sanitized (no internal paths exposed)
- [ ] API timeout and retry mechanisms implemented
- [ ] No exposure of internal service architecture
Prerequisites
CODEBLOCK13
Evaluation Criteria
Success Metrics
- - [ ] Successfully constructs valid PubMed Boolean queries
- [ ] MeSH term mapping is accurate and current
- [ ] Query syntax is copy-paste ready for PubMed
- [ ] Provides sensitivity/specificity trade-off options
- [ ] Handles complex multi-concept research questions
- [ ] Estimated result counts are reasonable
Test Cases
- 1. Basic Query: "diabetes treatment" → Valid MeSH-based query
- PICO Framework: Complex clinical question → Complete search strategy
- MeSH Mapping: Free-text term → Correct MeSH term identification
- Boolean Logic: Multiple concepts → Properly nested AND/OR/NOT
- Clinical Query: Therapy-focused question → Includes appropriate filters
- API Integration: Execute search via E-utilities → Successful retrieval
- Error Handling: Invalid search term → Graceful error with suggestions
Lifecycle Status
- - Current Stage: Draft
- Next Review Date: 2026-03-06
- Known Issues:
- MeSH terms updated annually, may need periodic validation
- API rate limits without key
- Integration with NCBI API key support for higher rate limits
- Automatic MeSH term validation against current database
- Support for additional databases (Embase, Cochrane)
Output Requirements
Every final response should make these items explicit when they are relevant:
- - Objective or requested deliverable
- Inputs used and assumptions introduced
- Workflow or decision path
- Core result, recommendation, or artifact
- Constraints, risks, caveats, or validation needs
- Unresolved items and next-step checks
Error Handling
- - If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.
- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
- If
scripts/main.py fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback. - Do not fabricate files, citations, data, search results, or execution outcomes.
Input Validation
This skill accepts requests that match the documented purpose of pubmed-search-specialist and include enough context to complete the workflow safely.
Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:
INLINECODE56 only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.
Response Template
Use the following fixed structure for non-trivial requests:
- 1. Objective
- Inputs Received
- Assumptions
- Workflow
- Deliverable
- Risks and Limits
- Next Checks
If the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.
PubMed 搜索专家
用于构建复杂布尔查询以精确搜索PubMed/MEDLINE数据库的专家工具。
使用时机
- - 当任务需要构建复杂布尔查询字符串以实现精确的PubMed/MEDLINE文献检索时使用此技能。当用户需要MeSH术语映射、布尔查询构建、高级PubMed筛选器、引文搜索、系统综述搜索策略或临床查询优化时触发。
- 当证据洞察任务需要明确的假设、有限的范围和可重复的输出格式时使用此技能。
- 当需要为缺失输入、执行错误或部分证据提供有记录的备用路径时使用此技能。
主要特性
- - 聚焦范围的工作流程,旨在:构建复杂布尔查询字符串以实现精确的PubMed/MEDLINE文献检索。当用户需要MeSH术语映射、布尔查询构建、高级PubMed筛选器、引文搜索、系统综述搜索策略或临床查询优化时触发。
- 打包的可执行路径:scripts/main.py。
- 参考资料位于references/目录,提供任务特定指导。
- 结构化执行路径,确保输出一致且可审查。
依赖项
详见上方## 先决条件。
- - Python:3.10+。当前打包技能的仓库基线。
- dataclasses:未指定。在requirements.txt中声明。
- requests:未指定。在requirements.txt中声明。
使用示例
bash
cd 20260318/scientific-skills/Evidence Insight/pubmed-search-specialist
python -m py_compile scripts/main.py
python scripts/main.py --help
示例运行计划:
- 1. 确认用户输入、输出路径和任何必需的配置值。
- 如果脚本使用固定设置,编辑文件内的CONFIG块或文档化参数。
- 使用验证后的输入运行python scripts/main.py。
- 审查生成的输出,返回最终成果并注明任何假设。
实现细节
详见上方## 工作流程。
- - 执行模型:验证请求,选择打包的工作流程,生成有限的可交付成果。
- 输入控制:在运行任何脚本前确认源文件、范围限制、输出格式和验收标准。
- 主要实现界面:scripts/main.py。
- 参考指南:references/包含支持规则、提示或检查清单。
- 需首先明确的参数:输入路径、输出路径、范围筛选器、阈值以及任何领域特定约束。
- 输出规范:保持结果可重复,明确标识假设,避免未记录的副作用。
快速检查
使用此命令验证打包脚本入口点可在深入执行前被解析。
bash
python -m py_compile scripts/main.py
审计就绪命令
使用这些具体命令进行验证。它们特意保持自包含,避免使用占位符路径。
bash
python -m py_compile scripts/main.py
python scripts/main.py --help
工作流程
- 1. 在进行详细工作前,确认用户目标、必需输入和不可协商的约束条件。
- 验证请求是否与文档化范围匹配,如果任务需要不支持的假设则提前停止。
- 仅使用实际可用的输入,使用打包脚本路径或文档化的推理路径。
- 返回结构化结果,区分假设、可交付成果、风险和未解决项。
- 如果执行失败或输入不完整,切换到备用路径并明确说明阻止完整完成的原因。
核心能力
- - MeSH术语映射:将自然语言概念转换为标准医学主题词
- 布尔查询构建器:使用AND/OR/NOT运算符构建复杂嵌套查询
- 高级筛选器:应用研究类型、日期、语言、年龄和物种筛选器
- 搜索策略优化:优化敏感度与特异度的权衡
使用工作流程
1. 概念提取
使用PICO框架从用户研究问题中提取关键概念:
- - P:人群/问题
- I:干预措施
- C:对照措施
- O:结局指标
2. MeSH术语映射
为每个概念识别适当的MeSH术语:
- - 首选术语(映射到MeSH层级)
- 入口术语(映射到首选术语的同义词)
- 副主题词以提高精确度
- 扩展与聚焦选项
3. 布尔构建
按照PubMed语法构建查询字符串:
(术语[MeSH Terms] OR 术语[Title/Abstract] OR 同义词[Title/Abstract])
4. 筛选器应用
根据需要附加筛选器:
- - 出版日期:from 2020 to 2024
- 文章类型:Clinical Trial、Review、Meta-Analysis
- 物种:humans[MeSH Terms]或animals[MeSH Terms]
- 语言:english[Language]
- 年龄组:adult[MeSH Terms]、aged[MeSH Terms]
5. 搜索策略输出
提供完整、可直接复制粘贴的PubMed搜索字符串,包括:
- - 逐行分解
- 预估结果数量指导
- 用于敏感度/特异度平衡的替代策略
关键MeSH特性
| 特性 | 语法 | 使用场景 |
|---|
| MeSH术语 | Diabetes Mellitus[MeSH Terms] | 主题词搜索 |
| MeSH主要主题 |
Diabetes Mellitus[MeSH Major Topic] | 核心焦点文章 |
| 扩展 | Diabetes Mellitus[MeSH Terms:noexp] | 排除子类别 |
| 副主题词 | Diabetes Mellitus/drug therapy[MeSH Terms] | 特定方面 |
| 入口术语 | Blood Sugar[Title/Abstract] | 非MeSH同义词 |
布尔运算符
- - AND:两个术语都必须出现(缩小搜索范围)
- OR:任一术语可出现(扩大搜索范围)
- NOT:排除术语(谨慎使用)
运算符优先级:使用括号控制求值顺序。
字段标签参考
| 标签 | 字段 | 示例 |
|---|
| [MeSH Terms] | 医学主题词 | Hypertension[MeSH Terms] |
| [Title] |
仅文章标题 | stroke[Title] |
| [Title/Abstract] | 标题和摘要 | aspirin[Title/Abstract] |
| [Author] | 作者姓名 | Smith J[Author] |
| [Journal] | 期刊名称 | Lancet[Journal] |
| [Publication Date] | 日期范围 | 2020:2024[Publication Date] |
| [Language] | 文章语言 | english[Language] |
| [Publication Type] | 文章类型 | clinical trial[Publication Type] |
临床查询筛选器
治疗
(randomized controlled trial[Publication Type] OR (randomized[Title/Abstract] AND controlled[Title/Abstract] AND trial[Title/Abstract]))
诊断
(sensitivity and specificity[MeSH Terms] OR sensitivity[Title/Abstract] OR specificity[Title/Abstract] OR diagnostic accuracy[Title/Abstract])
预后
(incidence[MeSH Terms] OR mortality[MeSH Terms] OR follow-up studies[MeSH Terms] OR prognos[Title/Abstract] OR predict[Title/Abstract])
病因
(risk[MeSH Terms] OR (risk factors[MeSH Terms]) OR (risk[Title/Abstract] AND factor*[Title/Abstract]))
参数
| 参数 | 类型 | 默认值 | 描述 |
|---|
| --population | str | 必需 | 人群/问题 |
| --intervention |
str | 必需 | 干预措施 |
| --comparison | str | 必需 | 对照措施 |
| --outcome | str | 必需 | 结局指标 |
| --study-type | str | 必需 | 临床查询类别 |
| --format | str | lines | 输出格式 |
示例:完整搜索策略
研究问题:阿司匹林是否能降低糖尿病患者的中风风险?
第1行 - 人群:
(Diabetes Mellitus[MeSH Terms] OR Diabetic[Title/Abstract] OR Diabetics[Title/Abstract])
第2行 - 干预措施:
(Aspirin[MeSH Terms] OR Acetylsalicylic Acid[Title/Abstract] OR aspirin[Title/Abstract])
第3行 - 结局指标:
(Stroke[MeSH Terms] OR Cerebrovascular Accident[Title/Abstract] OR stroke[Title/Abstract] OR cerebrovascular[Title/Abstract])
第4行 - 研究类型筛选器:
(randomized controlled trial[Publication Type] OR systematic review[Publication Type] OR meta-analysis[