Skip to main content
skill CX Codex

pubchem-database — Claude Code skill: query PubChem by name, CID

A skill that wires your agent into PubChem: resolves compounds by name, CID or SMILES and pulls properties, hazard data and bioactivity.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add google-deepmind/science-skills --skill pubchem-database -a claude-code
npx skills add google-deepmind/science-skills --skill pubchem_database -a claude-code
Open on GitHub

What pubchem-database does

The skill hands the agent a Python wrapper, scripts/pubchem_api.py, instead of letting it hit PubChem directly. The wrapper enforces the rate limit and parses the JSON, so several agents can query the API at once without stepping on each other.

It covers a lot of ground: name or InChI to CID, SMILES and InChIKey; computed properties such as MolecularWeight and XLogP; synonyms and trade names; GHS hazard statements; FDA pharmacology; any PUG-View heading; 2D structure images; bioassays. Similarity and substructure search work off a SMILES string, and there is a range search over features like molecular_weight and xlogp.

Two things to line up first. uv has to be on PATH. And if .licenses/pubchem_database_LICENSE.txt is not in the workspace root, the skill asks you to read the PubChem terms and then writes that file with a timestamp. Output lands in a JSON file, which it suggests you process with jq or code.

When a name or formula returns nothing, the skill falls back to the neutral parent of an ion or salt, splits a complex formula into components, or switches to substructure search.

What it helps with

  • resolve a trade name to a PubChem CID
  • pull molecular weight and XLogP for a batch of compounds
  • check GHS hazard statements before handling a reagent
  • find structural analogues from a given SMILES
  • list genes and proteins a compound interacts with

Example prompts for the agent

  • resolve aspirin and show me its properties
  • find molecules similar to CC(=O)OC1=CC=CC=C1C(=O)O
  • what GHS hazards does CID 2244 carry?

How to install pubchem-database

1Skills CLI (Vercel)

npx skills add google-deepmind/science-skills --skill pubchem-database -a claude-code
npx skills add google-deepmind/science-skills --skill pubchem_database -a claude-code

2Manually: put the files in place

~/.claude/skills/pubchem_database/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/pubchem_database/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about pubchem-database

How do I install pubchem-database in Claude?

Run npx skills add google-deepmind/science-skills --skill pubchem-database -a claude-code. The skill lands at ~/.claude/skills/pubchem_database/SKILL.md.

What does pubchem-database do?

It wraps PubChem for the agent: name-to-identifier resolution, properties, synonyms, hazard data, pharmacology, structure search and bioassays.

What do I need before using it?

uv installed and on PATH. On first use the skill asks you to review the PubChem terms and creates .licenses/pubchem_database_LICENSE.txt in the workspace root.

Source text

SKILL.md · Apache-2.0
---
name: pubchem-database
description: >
  Query PubChem, search by name/CID/SMILES, retrieve properties,
  similarity/substructure searches, bioactivity, for cheminformatics. Use when a
  user asks about a specific chemical, drug, or molecule.
---

# PubChem Database

## Prerequisites

1.  **`uv`**: Read the `uv` skill and follow its Setup instructions to ensure
    `uv` is installed and on PATH.
2.  **User Notification**: If .licenses/pubchem_database_LICENSE.txt does not
    already exist in the workspace root directory then (1) prominently notify
    the user to check the terms at
    https://pubchem.ncbi.nlm.nih.gov/docs/citation-guidelines and
    https://pubchem.ncbi.nlm.nih.gov/docs/pug-rest, then (2) create the file
    recording the notification text and timestamp.

## Quick Start

PubChem queries are executed via a robust Python wrapper script to respect
terms-of-service and handle complex JSON parsing. This script allows safe
multi-agent use of APIs.

Example: Resolve a chemical name to its Compound ID (CID)

```bash
uv run scripts/pubchem_api.py resolve --name "aspirin" --output result.json
```

## Core Rules

-   **Use the Wrapper**: ALWAYS execute the provided helper scripts to query the
    database rather than accessing the database directly. The scripts
    automatically enforce the required rate limit gracefully.
-   Read the generated JSON output file, and process it with jq or code.
-   **Verify Facts**: ALWAYS verify information retrieved from memory with a
    database query if the user asks for a specific fact that can be checked in
    PubChem. Do not rely solely on internal knowledge.
-   **Notification**: If this skill is used, ensure this is mentioned in the
    output.

## Core Capabilities

**1. Compound Resolution (Name or InChI to Identifiers)** Convert chemical/trade
names or InChI strings into PubChem CIDs, SMILES, and InChIKeys.

```bash
uv run scripts/pubchem_api.py resolve --name "ibuprofen" --output result.json
# OR
uv run scripts/pubchem_api.py resolve --inchi "InChI=1S/C3/c1-3-2/i1+1" --output result.json
```

**2. Physical & Chemical Property Retrieval** Fetch computed properties (e.g.,
MolecularWeight, XLogP, TPSA).

```bash
uv run scripts/pubchem_api.py properties --cid 2244 --output result.json
```

**3. Synonyms and Trade Names** Find alternative names and brand names.

```bash
uv run scripts/pubchem_api.py synonyms --cid 2244 --output result.json
```

## Advanced Context

**4. Safety and Hazard Information (GHS)** Retrieve Global Harmonized System
hazard statements and handling precautions (uses PUG-View).

```bash
uv run scripts/pubchem_api.py safety --cid 2244 --output result.json
```

**5. Drug and Medication Information** Fetch FDA pharmacology data, mechanism of
action, and therapeutic uses (uses PUG-View).

```bash
uv run scripts/pubchem_api.py pharmacology --cid 2244 --output result.json
```

**6. Custom Heading (PUG-View)** Retrieve any specific heading from the PUG-View
system (e.g., 'Geometry', 'Crystal Structures').

```bash
uv run scripts/pubchem_api.py view --cid 3939 --heading "Crystal Structures" --output result.json
```

**7. Image Generation** Retrieve 2D chemical structure images. The script
returns a Markdown-formatted image link.

```bash
uv run scripts/pubchem_api.py image --cid 2244 --output result.json
```

## Complex Search & Biology

**8. Structure-Based Searching (Similarity & Substructure)** Find molecules
similar to a SMILES string or containing a specific substructure.

```bash
uv run scripts/pubchem_api.py similarity --smiles "CC(=O)OC1=CC=CC=C1C(=O)O" --output result.json
```

and

```bash
uv run scripts/pubchem_api.py substructure --smiles "C1=CC=CC=C1" --output result.json
```

**9. BioAssay & Target Interactions** Identify genes or proteins a chemical
interacts with.

```bash
uv run scripts/pubchem_api.py assays --cid 2244 --output result.json
```

## Advanced Usage & Workflows

**10. Cross-references (Xrefs)** Fetch identifiers cross-referenced with a CID
(e.g., PatentID, PubMedID).

```bash
uv run scripts/pubchem_api.py xrefs --cid 2244 --type "PatentID" --output result.json
```

**11. Property Range Search** Find CIDs within a specific property range.
Supported features include: `molecular_weight`, `heavy_atom_count`, `xlogp`,
`tpsa`, `h_bond_donor_count`, `h_bond_acceptor_count`, `rotatable_bond_count`,
`exact_mass`, `monoisotopic_mass`, and `complexity`.

```bash
uv run scripts/pubchem_api.py range --feature molecular_weight --min 400.0 --max 400.05 --output result.json
```

**12. Custom PUG-REST Query** Execute a raw path against the PUG-REST API.

```bash
uv run scripts/pubchem_api.py query --path "compound/cid/2244/xrefs/PatentID/JSON" --output result.json
```

## Fallback Search Strategies

If direct resolution by name or formula fails (e.g., for complex compounds or
specific ions):

-   **Search for parent/neutral molecule**: If searching for an ion or salt, try
    searching for the neutral parent compound.
-   **Deconstruct complex formulas**: If a complex formula returns no results,
    try searching for major components or ligands.
-   **Use substructure or similarity search**: If you have a SMILES string or
    can generate one for a component, use it to find related compounds.

## Complex Queries and Multi-Step Tasks

*   **Custom/Complex Queries**: For more details, read
    [references/endpoints.md](references/endpoints.md) to construct raw PUG-REST
    URLs.
*   **Multi-Step Tasks**: For complex tasks like drug discovery pipelines,
    follow the checklists in [references/workflows.md](references/workflows.md).

© google-deepmind · Apache-2.0 · google-deepmind/science-skills

Similar skills

Everything for Science and research →

From the same set39

uniprot-database Retrieves protein metadata, function annotations, and sequences from UniProtKB, UniParc, and UniRef. Useful for mapping database identifiers and streaming entries. CX Codex +1 2,200installs openfda-database Queries, counts and downloads records from the openFDA API. Use it for FDA safety events, recalls, labels, NDC lookups and regulatory data searches. CX Codex +1 2,200installs pymol A PyMOL skill that renders protein and molecular structures, runs alignments, and measures distances or contacts. Useful when you already have a structure file and need an image or a number. CX Codex +1 2,200installs ncbi-sequence-fetch Fetches protein and nucleotide sequences from NCBI databases via E-utilities. It queries records by accession, gene name, locus tag, PubMed ID, or patent. CX Codex +1 2,200installs alphafold-database-fetch-and-analyze Pulls AlphaFold predicted structures by UniProt ID and works out what they mean: pLDDT confidence, disordered regions, rigid domain boundaries. CX Codex +1 2,200installs pdb-database Searches and downloads experimental 3D structures of biomolecules from RCSB PDB using sequence similarity, structure comparisons, or chemical attributes. CX Codex +1 2,200installs unibind-database This skill queries UniBind for experimentally validated transcription-factor binding sites and downloads BED or FASTA coordinates for local analysis. CX Codex +1 2,100installs ucsc-conservation-and-tfbs Pulls evolutionary conservation scores (phyloP, phastCons) and transcription factor binding sites out of the UCSC Genome Browser. Handy when you are reading non-coding variants. CX Codex +1 2,100installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor