Agent skill

Searching Clinicaltrials

by maziyarpanahi in maziyarpanahi/openmed

Searches ClinicalTrials.gov for studies by condition, intervention, and recruitment status using the modern v2 REST API with cursor (pageToken) pagination.

Apache-2.0Auto-check passedBusiness, Finance & HR

Install Searching Clinicaltrials

skills CLI
$ npx skills add maziyarpanahi/openmed --skill searching-clinicaltrials -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install maziyarpanahi/openmed searching-clinicaltrials --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/maziyarpanahi/openmed.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/searching-clinicaltrials .claude/skills/searching-clinicaltrials && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
searching-clinicaltrials
GitHub stars
5.5k
Token cost
~2k tokens
SKILL.md length
589 words
Files
1
Skills in repo
74
Repo updated
First seen
Licence
Apache-2.0

At a glance

Searches ClinicalTrials.gov for studies by condition, intervention, and recruitment status using the modern v2 REST API with cursor (pageToken) pagination.

  • Works in 4 steps: Build the query from OpenMed facts. Map… → Page through with the cursor until… → Persist nctId, status, conditions,… → …
  • The user wants to find trials for a diagnosis
  • SKILL.md covers When to use, Quick start (real v2 API call), Response shape and Cursor pagination, plus 4 more sections
  • Calls curl; reaches clinicaltrials.gov

What it does

Searching Clinicaltrials is an agent skill from maziyarpanahi/openmed. Searches ClinicalTrials.gov for studies by condition, intervention, and recruitment status using the modern v2 REST API with cursor (pageToken) pagination. Use when the user wants to find trials for a diagnosis or drug, screen patients against open studies, build a trial-matching feature, or pull a trial corpus for analysis. Trigger keywords: clinical trial, ClinicalTrials.gov, NCT number, trial search, recruiting studies, eligibility, query.cond, query.intr, pageToken, v2 API. Pairs adjacent to OpenMed: take…

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Business, Finance & HR, covering Recruiting and HR, REST APIs and Clinical and healthcare research. The repository describes itself as: Local-first healthcare AI: clinical NER and HIPAA PII de-identification on hardware you control. 2,200+ medical models, 35 model-backed PII languages, and Python, MLX, Android… The licence is Apache-2.0.

When your agent uses it

  • The user wants to find trials for a diagnosis
  • Screen patients against open studies
  • Build a trial-matching feature
  • Pull a trial corpus for analysis

Example prompts

  • “Use the searching-clinicaltrials skill to search ClinicalTrials.gov for studies by condition, intervention, and recruitment status using the modern…”
  • “/searching-clinicaltrials”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Build the query from OpenMed facts. Map extracted Disease spans →
  2. Page through with the cursor until nextPageToken is gone; cap total pulls.
  3. Persist nctId, status, conditions, interventions, and the raw eligibility
  4. Optionally re-NER the eligibility / outcomes text with

What it can do on your machine

Read from SKILL.md and the folder at commit 34d7b8c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • curl

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • clinicaltrials.gov

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Searching Clinicaltrials loads about 2k tokens when it runs. Until then it costs about 195 tokens; SKILL.md has 589 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~195
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from maziyarpanahi/openmed at commit 34d7b8c, republished under its Apache-2.0 licence (© maziyarpanahi). 589 words, ~2,028 tokens.

Download SKILL.mdSave it as .claude/skills/searching-clinicaltrials/SKILL.md (or your agent's skills folder).
name
searching-clinicaltrials
description
Searches ClinicalTrials.gov for studies by condition, intervention, and recruitment status using the modern v2 REST API with cursor (pageToken) pagination. Use when the user wants to find trials for a diagnosis or drug, screen patients against open studies, build a trial-matching feature, or pull a trial corpus for analysis. Trigger keywords: clinical trial, ClinicalTrials.gov, NCT number, trial search, recruiting studies, eligibility, query.cond, query.intr, pageToken, v2 API. Pairs adjacent to OpenMed: take Disease/Pharmaceutical entities from openmed.analyze_text and turn them into query.cond / query.intr filters; the returned eligibility text feeds parsing-trial-eligibility. ClinicalTrials.gov API v2 is fully public — no API key, no license.
license
Apache-2.0
metadata.project
OpenMed
metadata.category
research-genomics
metadata.pairs
adjacent
metadata.version
1.0

Searching ClinicalTrials.gov (v2 REST API)

Query ClinicalTrials.gov — the U.S. registry of clinical studies — for trials matching a condition, intervention, and recruitment status. This skill uses the modern v2 REST API (/api/v2/studies), which returns structured JSON and paginates with an opaque cursor (pageToken), not page numbers.

The v2 API is fully public: no API key, no registration, no license barrier. The legacy v1/classic API and the older query_term-style endpoints are deprecated — do not build on them.

When to use

  • OpenMed extracted a diagnosis ("metastatic colorectal cancer") or a drug ("pembrolizumab") and you want open trials for it.
  • You are building a patient-to-trial matching feature and need candidate studies before applying eligibility logic (parsing-trial-eligibility).
  • You need a corpus of trial records (eligibility text, outcomes) to feed back into openmed.analyze_text for biomedical NER.

If you already have an NCT number, fetch the single study directly (/api/v2/studies/NCT01234567) instead of searching.

Quick start (real v2 API call)

Base URL: https://clinicaltrials.gov/api/v2. No auth. JSON by default.

python
import requests

BASE = "https://clinicaltrials.gov/api/v2"

def search_trials(condition: str, intervention: str | None = None,
                  status: str = "RECRUITING", page_size: int = 50) -> dict:
    """One page of studies for a condition (+ optional intervention)."""
    params = {
        "query.cond": condition,            # condition / disease search
        "filter.overallStatus": status,     # comma-separated enum values
        "pageSize": min(page_size, 1000),   # max 1000; default 10
        "countTotal": "true",               # include totalCount on first page
        "format": "json",
    }
    if intervention:
        params["query.intr"] = intervention  # drug / intervention search
    r = requests.get(f"{BASE}/studies", params=params, timeout=30)
    r.raise_for_status()
    return r.json()

data = search_trials("breast cancer", intervention="trastuzumab")
print(data["totalCount"])                    # total matches (first page only)
for study in data["studies"]:
    ps = study["protocolSection"]
    nct = ps["identificationModule"]["nctId"]
    title = ps["identificationModule"]["briefTitle"]
    print(nct, "-", title)

Equivalent cURL:

bash
curl "https://clinicaltrials.gov/api/v2/studies?query.cond=breast+cancer\
&query.intr=trastuzumab&filter.overallStatus=RECRUITING&pageSize=50&format=json"

Response shape

Top level: studies (array), nextPageToken (present only if more results), and totalCount (only when countTotal=true, on the first page). Each study is a protocolSection of typed modules:

Field pathMeaning
identificationModule.nctIdNCT........ study id
identificationModule.briefTitleshort title
statusModule.overallStatusRECRUITING, COMPLETED, …
conditionsModule.conditionslist of condition strings
armsInterventionsModule.interventionsdrugs / procedures
eligibilityModule.eligibilityCriteriafree-text inclusion/exclusion
eligibilityModule.sex / minimumAge / maximumAgedemographic gates
contactsLocationsModule.locationsrecruiting sites

Cursor pagination

There are no page numbers. Loop until nextPageToken is absent. The token is opaque — pass it back verbatim. Do not re-send countTotal after page 1.

python
def iter_all(condition: str, status: str = "RECRUITING"):
    params = {"query.cond": condition, "filter.overallStatus": status,
              "pageSize": 1000, "format": "json"}
    while True:
        r = requests.get(f"{BASE}/studies", params=params, timeout=30)
        r.raise_for_status()
        page = r.json()
        yield from page.get("studies", [])
        token = page.get("nextPageToken")
        if not token:
            break
        params["pageToken"] = token        # cursor for the next page
Trimming payloads

Default responses are large. Restrict to the fields you need with fields (dotted paths or module names) to cut bandwidth:

python
params["fields"] = ("NCTId,BriefTitle,OverallStatus,"
                    "Condition,EligibilityCriteria")

Workflow

  1. Build the query from OpenMed facts. Map extracted Disease spans → query.cond; Pharmaceutical spans → query.intr. Free-text keywords go in query.term. Combine status filters as filter.overallStatus=RECRUITING,NOT_YET_RECRUITING.
  2. Page through with the cursor until nextPageToken is gone; cap total pulls.
  3. Persist nctId, status, conditions, interventions, and the raw eligibility text. Eligibility goes to parsing-trial-eligibility.
  4. Optionally re-NER the eligibility / outcomes text with openmed.analyze_text to structure inclusion criteria.
Show full SKILL.md (250 more words)Show less

Hand-off to / from OpenMed

  • From OpenMed → trial search. openmed.analyze_text(note, model_name="disease_detection_superclinical") yields Disease and Pharmaceutical entities. Use the surface forms (or a grounded term from coding-icd10 / normalizing-rxnorm) as query.cond / query.intr.
  • Trial text → OpenMed. Feed eligibilityModule.eligibilityCriteria and brief summaries back through openmed.analyze_text to extract conditions, meds, and labs mentioned in the criteria. Then hand to parsing-trial-eligibility for inclusion/exclusion matching against patient facts.
  • Keep patient data local. The API call carries only the query terms (condition/drug names), never the patient note or any PHI.

Edge cases & gotchas

  • Synonyms & spelling. The condition matcher is fuzzy but not infinite — "MI" will not match "myocardial infarction". Normalize OpenMed output first (ICD-10 / RxNorm) and consider issuing a few synonym variants.
  • Status enums are exact. Valid values include RECRUITING, NOT_YET_RECRUITING, ENROLLING_BY_INVITATION, ACTIVE_NOT_RECRUITING, COMPLETED, SUSPENDED, TERMINATED, WITHDRAWN, UNKNOWN. Comma-separate; do not lowercase.
  • totalCount is first-page only. Request countTotal=true once; it is not repeated on subsequent pages.
  • Page size cap is 1000. Larger values are silently clamped.
  • Rate limits. No key required, but throttle politely (a short sleep between pages); aggressive scraping can be blocked. For bulk/offline work, consider the full registry data dump rather than thousands of paged calls.
  • pageToken expires if the underlying index shifts; restart the query if a token is rejected.
  • Not medical advice. A trial appearing in results does not mean the patient qualifies — eligibility is decided downstream and reviewed by a clinician.

Standards & references

© maziyarpanahi, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/searching-clinicaltrials of maziyarpanahi/openmed.

Open the folder on GitHubat commit 34d7b8c

Compare with similar skills

Searching Clinicaltrials next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Searching Clinicaltrials compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Searching Clinicaltrials this skillmaziyarpanahi/openmed5.5k—~2kAutomated safety check: PassApache-2.0
Clinicaltrials DBaipoch/medical-research-skills1.9k—~762Automated safety check: PassMIT
Ct Status Diffagentii-ai/agentii-investment-intelligence207—~1.8kAutomated safety check: PassApache-2.0
Clinical Trials Databasegoogle-deepmind/science-skills3.2k2 repos~3.2kAutomated safety check: PassApache-2.0
Fhir Developer SkillFreedomIntelligence/OpenClaw-Medical-Skills3.1k1 repos~2.5kAutomated safety check: PassNone
Fhir APIaehrc/pathling137—~1.5kAutomated safety check: PassApache-2.0

Similar skills

  • Clinicaltrials DB

    aipoch/medical-research-skills

    Query the ClinicalTrials.gov API v2 to search for clinical trials, retrieve detailed study protocols, and analyze recruitment status; use when you need to find trials by condition/drug, export…

    1.9k GitHub stars~762 tokensUpdated 24 days ago
    Business, Finance & HRAuto-check passed
  • Ct Status Diff

    agentii-ai/agentii-investment-intelligence

    Weekly clinical-trial status diff — the 11-category change report over the stored weekly snapshots (spec 055 FR-B03).

    207 GitHub stars~1.8k tokensUpdated 12 days ago
    Business, Finance & HRAuto-check passed
  • Clinical Trials Database

    google-deepmind/science-skills

    Query ClinicalTrials.gov via APIv2. An agent skill from google-deepmind/science-skills.

    3.2k GitHub starsUsed in 2 repos~3.2k tokens
    Research & ScienceAuto-check passed
  • Fhir Developer Skill

    FreedomIntelligence/OpenClaw-Medical-Skills

    FHIR API development guide for building healthcare endpoints.

    3.1k GitHub starsUsed in 1 repo~2.5k tokens
    Research & ScienceAuto-check passed
  • Fhir API

    aehrc/pathling

    Expert guidance for implementing FHIR RESTful API servers and clients following the HL7 FHIR specification.

    137 GitHub stars~1.5k tokensUpdated 3 days ago
    Research & ScienceAuto-check passed
  • Fintel Data

    himself65/finance-skills

    Query Fintel (fintel.io) institutional market data through its REST API or official MCP server.

    3.4k GitHub stars~2.2k tokensUpdated 6 days ago
    Business, Finance & HRAuto-check: notes

More from maziyarpanahi/openmed

All 74 skills in this repo
  • Checks OpenMed de-identified clinical text against the 18 HIPAA Safe Harbor identifier categories and reports gaps and residual re-identification risk.

    5.5k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • OpenMed Model Card Writer

    maziyarpanahi/openmed

    Fills in a model card for an OpenMed clinical NER or de-identification model from its evaluation reports: intended use, metrics, subgroups and limitations.

    5.5k GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Walks a data pipeline against the HIPAA Privacy and Security Rule checklist and produces a gap report before it processes patient data.

    5.5k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • ICD-10 Coding Assistant

    maziyarpanahi/openmed

    Suggests candidate ICD-10-CM diagnosis and ICD-10-PCS procedure codes for clinical text extracted by OpenMed, with rationale for a certified coder to review.

    5.5k GitHub stars~2k tokensUpdated today
    Auto-check passed
  • OpenMed ETL to OMOP CDM

    maziyarpanahi/openmed

    Maps OpenMed-extracted, terminology-coded conditions, drugs and measurements into OMOP CDM v5.4 tables for OHDSI and ATLAS analytics.

    5.5k GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Extracting SDOH and Z-Codes

    maziyarpanahi/openmed

    Finds social risks such as housing instability or food insecurity in clinical notes and proposes matching ICD-10-CM Z-codes for a coder to confirm.

    5.5k GitHub stars~1.9k tokensUpdated today
    Auto-check passed

Questions about Searching Clinicaltrials

What does Searching Clinicaltrials do?

Searches ClinicalTrials.gov for studies by condition, intervention, and recruitment status using the modern v2 REST API with cursor (pageToken) pagination. Searching Clinicaltrials is an agent skill from maziyarpanahi/openmed.gov for studies by condition, intervention, and recruitment status using the modern v2 REST API with cursor (pageToken) pagination.

When should I use Searching Clinicaltrials?

Searching Clinicaltrials fits situations like: the user wants to find trials for a diagnosis; screen patients against open studies; build a trial-matching feature; pull a trial corpus for analysis.

How do I install Searching Clinicaltrials in Claude Code?

Run `npx skills add maziyarpanahi/openmed --skill searching-clinicaltrials -a claude-code`. Or copy the skill folder (skills/searching-clinicaltrials in maziyarpanahi/openmed) into .claude/skills/searching-clinicaltrials in your project. Claude Code loads it when a task matches its description.

How do I install Searching Clinicaltrials in Codex?

Run `npx skills add maziyarpanahi/openmed --skill searching-clinicaltrials -a codex`. Or copy the skill folder (skills/searching-clinicaltrials in maziyarpanahi/openmed) into .agents/skills/searching-clinicaltrials in your project. Codex loads it when a task matches its description.

Can I use Searching Clinicaltrials in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add maziyarpanahi/openmed --skill searching-clinicaltrials -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/searching-clinicaltrials, .gemini/skills/searching-clinicaltrials, .github/skills/searching-clinicaltrials and .opencode/skills/searching-clinicaltrials in your project.

What does Searching Clinicaltrials need to run?

Going by SKILL.md and its folder, Searching Clinicaltrials needs the command-line tools its instructions call (curl). Our summary lists: Python 3.

Does Searching Clinicaltrials access the network?

SKILL.md names 1 domain. In commands or code: clinicaltrials.gov; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Searching Clinicaltrials safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Searching Clinicaltrials use?

Searching Clinicaltrials is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Searching Clinicaltrials use?

About 2k tokens (SKILL.md is roughly 8.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Searching Clinicaltrials?

Skills that share tags, products or a category with Searching Clinicaltrials: Clinicaltrials DB (aipoch/medical-research-skills, 1.9k stars), Ct Status Diff (agentii-ai/agentii-investment-intelligence, 207 stars), Clinical Trials Database (google-deepmind/science-skills, 3.2k stars) and Fhir Developer Skill (FreedomIntelligence/OpenClaw-Medical-Skills, 3.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Searching Clinicaltrials?

maziyarpanahi (a GitHub user) maintains it in maziyarpanahi/openmed, which has 5,506 GitHub stars. The repository holds 74 skills in this directory. The repository was last updated on October 11, 2026.

Source: maziyarpanahi/openmed on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.