pubchem-compound

Search and retrieve chemical compound data from PubChem's PUG REST API (110M+ compounds). Use when the user needs compound properties, molecular structures, similarity searches, substructure searches, or bioactivity data. NOT for protein structures (use pdb-structure), NOT for drug-target interactions (use chembl-drug), NOT for gene-disease associations (use open-targets).

564 stars

Best use case

pubchem-compound is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Search and retrieve chemical compound data from PubChem's PUG REST API (110M+ compounds). Use when the user needs compound properties, molecular structures, similarity searches, substructure searches, or bioactivity data. NOT for protein structures (use pdb-structure), NOT for drug-target interactions (use chembl-drug), NOT for gene-disease associations (use open-targets).

Teams using pubchem-compound should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/pubchem-compound/SKILL.md --create-dirs "https://raw.githubusercontent.com/beita6969/ScienceClaw/main/skills/pubchem-compound/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/pubchem-compound/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How pubchem-compound Compares

Feature / Agentpubchem-compoundStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Search and retrieve chemical compound data from PubChem's PUG REST API (110M+ compounds). Use when the user needs compound properties, molecular structures, similarity searches, substructure searches, or bioactivity data. NOT for protein structures (use pdb-structure), NOT for drug-target interactions (use chembl-drug), NOT for gene-disease associations (use open-targets).

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# PubChem Compound Lookup

Query the PubChem PUG REST API to search over 110 million chemical compounds by name, CID, SMILES, InChI, or molecular formula. Retrieve molecular properties, 2D/3D structures, bioactivity data, and perform similarity or substructure searches.

## API Base URL

```
https://pubchem.ncbi.nlm.nih.gov/rest/pug
```

## API Endpoints

### Compound Lookup

Retrieve compound data by name, CID, or SMILES:

```bash
# By compound name
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/aspirin/JSON" | head -60

# By PubChem CID
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/JSON" | head -60

# By SMILES string
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/smiles/CC(=O)OC1=CC=CC=C1C(=O)O/JSON" | head -60

# By InChI key
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/inchikey/BSYNRYMUTXBXSQ-UHFFFAOYSA-N/JSON" | head -60
```

### Property Retrieval

Fetch specific molecular properties (comma-separated list):

```bash
# Common drug-likeness properties (Lipinski's Rule of Five)
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/ibuprofen/property/MolecularWeight,MolecularFormula,XLogP,HBondDonorCount,HBondAcceptorCount,TPSA/JSON"

# Multiple compounds by CID list
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244,3672,2519/property/MolecularWeight,XLogP,IUPACName/JSON"
```

Available properties: MolecularFormula, MolecularWeight, CanonicalSMILES, IsomericSMILES, InChI, InChIKey, IUPACName, XLogP, ExactMass, MonoisotopicMass, TPSA, Complexity, HBondDonorCount, HBondAcceptorCount, RotatableBondCount, HeavyAtomCount, AtomStereoCount, BondStereoCount, Volume3D.

### Similarity Search

Find structurally similar compounds using 2D fingerprint Tanimoto similarity:

```bash
# Find compounds with >=90% similarity to aspirin
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastsimilarity_2d/smiles/CC(=O)OC1=CC=CC=C1C(=O)O/cids/JSON?Threshold=90"

# Similarity search returning properties
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastsimilarity_2d/cid/2244/property/MolecularWeight,XLogP,CanonicalSMILES/JSON?Threshold=85&MaxRecords=10"
```

### Substructure Search

Find compounds containing a specific substructure:

```bash
# Find compounds containing a benzene ring with carboxylic acid
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastsubstructure/smiles/c1ccccc1C(=O)O/cids/JSON?MaxRecords=10"
```

### PUG-View (Detailed Annotations)

Retrieve detailed compound records including pharmacology, safety, and literature:

```bash
# Full PUG-View record
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug_view/data/compound/2244/JSON" | head -100

# Specific section headings
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug_view/data/compound/2244/JSON?heading=Pharmacology+and+Biochemistry" | head -80
```

### Bioactivity Data

Retrieve assay results and biological activity:

```bash
# Get bioassay summary for a compound
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/assaysummary/JSON" | head -80

# Get assay results with activity outcome
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/aids/JSON?aids_type=active"
```

## Common Queries

```bash
# Check if a compound exists and get its CID
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/metformin/cids/JSON"

# Get canonical SMILES for a compound
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/caffeine/property/CanonicalSMILES,IsomericSMILES/JSON"

# Get 2D structure image URL (PNG)
# https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/PNG

# Get SDF (structure-data file)
curl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/aspirin/SDF"
```

## Best Practices

1. Rate limit requests to 5 per second maximum; PubChem may throttle or block excessive usage.
2. Use CID lookups when possible -- name lookups may return multiple matches.
3. For large result sets, use `MaxRecords` and pagination with `cids_type=standardized`.
4. URL-encode SMILES strings that contain special characters (e.g., `#`, `/`, `\`).
5. Prefer property endpoints over full JSON records to reduce response size.
6. Use PUG-View for curated annotations (pharmacology, safety, patents) rather than raw compound data.
7. For bulk operations (>100 compounds), use the PUG REST asynchronous listkey pattern.

## Data Integrity Rule

NEVER fabricate database results from training data. Every protein ID, gene name, compound property, pathway ID, structure detail, and metadata MUST come from an actual API response in this conversation. If the API returns no results, errors, or partial data, report exactly what happened. Do not "fill in" missing data from memory or make up identifiers.

Related Skills

pubchem-database

564
from beita6969/ScienceClaw

Query PubChem via PUG-REST API/PubChemPy (110M+ compounds). Search by name/CID/SMILES, retrieve properties, similarity/substructure searches, bioactivity, for cheminformatics.

xurl

564
from beita6969/ScienceClaw

A CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.

xlsx

564
from beita6969/ScienceClaw

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.

writing

564
from beita6969/ScienceClaw

No description provided.

world-bank-data

564
from beita6969/ScienceClaw

World Bank Open Data API for development indicators. Use when: user asks about GDP, population, poverty, health, or education statistics by country. NOT for: real-time financial data or stock prices.

wikipedia-search

564
from beita6969/ScienceClaw

Search and fetch structured content from Wikipedia using the MediaWiki API for reliable, encyclopedic information

wikidata-knowledge

564
from beita6969/ScienceClaw

Query Wikidata for structured knowledge using SPARQL and entity search. Use when: (1) finding structured facts about entities (people, places, organizations), (2) querying relationships between entities, (3) cross-referencing external identifiers (Wikipedia, VIAF, GND, ORCID), (4) building knowledge graphs from linked data. NOT for: full-text article content (use Wikipedia API), scientific literature (use semantic-scholar), geospatial data (use OpenStreetMap).

weather

564
from beita6969/ScienceClaw

Get current weather and forecasts via wttr.in or Open-Meteo. Use when: user asks about weather, temperature, or forecasts for any location. NOT for: historical weather data, severe weather alerts, or detailed meteorological analysis. No API key needed.

wacli

564
from beita6969/ScienceClaw

Send WhatsApp messages to other people or search/sync WhatsApp history via the wacli CLI (not for normal user chats).

voice-call

564
from beita6969/ScienceClaw

Start voice calls via the OpenClaw voice-call plugin.

visualization

564
from beita6969/ScienceClaw

Create publication-quality scientific figures and plots using Python (matplotlib, seaborn, plotly). Supports bar charts, scatter plots, heatmaps, box plots, violin plots, survival curves, network graphs, and more. Use when user asks to plot data, create figures, make charts, visualize results, or generate publication-ready graphics. Triggers on "plot", "chart", "figure", "graph", "visualize", "heatmap", "scatter plot", "bar chart", "histogram".

video-frames

564
from beita6969/ScienceClaw

Extract frames or short clips from videos using ffmpeg.