Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Search PubChem for chemical compounds, structures, and bioassay data
.claude/skills/brycewang-stanford-pubchem-api-guide/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | 99% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 17% | 0% |
| case-24 | ✗→✓ | ▲ Improved | 206% | 0% |
| case-09 | ✓→✓ | = Same ✓ | 154% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 68% | 0% |
PubChem is the world's largest free chemistry database, maintained by the National Center for Biotechnology Information (NCBI) at the U.S. National Library of Medicine. It contains information on over 115 million chemical compounds, 300 million substances from hundreds of data sources, and over 1.5 million bioassay experiments. PubChem is a critical resource for researchers in chemistry, pharmacology, drug discovery, toxicology, and related life sciences.
The PUG REST (Power User Gateway RESTful) API provides programmatic access to PubChem's three primary databases: Compound (standardized chemical structures), Substance (depositor-provided records), and BioAssay (biological screening results). The API supports searches by name, molecular formula, structure similarity, substructure, and various identifiers including CID, SID, InChI, and SMILES.
PUG REST is entirely free, requires no authentication, and returns data in JSON, XML, CSV, SDF, and other formats. It is designed for both simple lookups and complex cheminformatics workflows.
No authentication is required. PubChem PUG REST is a free public service.
bash# No API key needed curl "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/aspirin/JSON"
GET https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/{name}/JSONbashcurl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/caffeine/JSON" \ | python3 -m json.tool
Retrieve specific properties for a compound by CID.
GET https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/{cid}/property/{properties}/JSONAvailable properties: MolecularFormula, MolecularWeight, CanonicalSMILES, InChI, InChIKey, IUPACName, XLogP, ExactMass, HBondDonorCount, HBondAcceptorCount, RotatableBondCount, TPSA
bashcurl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/ibuprofen/property/MolecularFormula,MolecularWeight,CanonicalSMILES,IUPACName,XLogP/JSON" \ | python3 -m json.tool
bashcurl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastformula/C8H10N4O2/property/IUPACName,MolecularWeight,CanonicalSMILES/JSON" \ | python3 -m json.tool
Find compounds structurally similar to a given compound (Tanimoto threshold).
bashcurl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/fastsimilarity_2d/cid/2244/property/IUPACName,MolecularWeight,CanonicalSMILES/JSON?Threshold=90" \ | python3 -m json.tool
Retrieve biological activity data for a compound.
bashcurl -s "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/2244/assaysummary/JSON" \ | python3 -m json.tool
pythonimport requests import time PUG_REST = "https://pubchem.ncbi.nlm.nih.gov/rest/pug" def get_compound_properties(name): """Fetch key drug-likeness properties for a named compound.""" props = "MolecularWeight,XLogP,HBondDonorCount,HBondAcceptorCount,TPSA,RotatableBondCount,IUPACName" url = f"{PUG_REST}/compound/name/{name}/property/{props}/JSON" resp = requests.get(url) resp.raise_for_status() data = resp.json() return data.get("PropertyTable", {}).get("Properties", [{}])[0] def check_lipinski(props): """Check Lipinski's Rule of Five for oral drug-likeness.""" violations = 0 mw = props.get("MolecularWeight", 0) logp = props.get("XLogP", 0) hbd = props.get("HBondDonorCount", 0) hba = props.get("HBondAcceptorCount", 0) if mw > 500: violations += 1 if logp > 5: violations += 1 if hbd > 5: violations += 1 if hba > 10: violations += 1 return violations drug_candidates = ["metformin", "atorvastatin", "lisinopril", "omeprazole"] print(f"{'Compound':<20} {'MW':>8} {'LogP':>6} {'HBD':>4} {'HBA':>4} {'Violations':>10}") print("-" * 60) for drug in drug_candidates: props = get_compound_properties(drug) violations = check_lipinski(props) print(f"{drug:<20} {props.get('MolecularWeight', 0):>8.1f} " f"{props.get('XLogP', 0):>6.1f} " f"{props.get('HBondDonorCount', 0):>4} " f"{props.get('HBondAcceptorCount', 0):>4} " f"{violations:>10}") time.sleep(0.3)
pythonimport requests def compare_compounds(cid_list): """Compare properties of multiple compounds by CID.""" cids = ",".join(str(c) for c in cid_list) props = "IUPACName,MolecularFormula,MolecularWeight,CanonicalSMILES,XLogP" url = f"{PUG_REST}/compound/cid/{cids}/property/{props}/JSON" resp = requests.get(url) resp.raise_for_status() return resp.json().get("PropertyTable", {}).get("Properties", []) # Compare aspirin (2244), ibuprofen (3672), acetaminophen (1983) results = compare_compounds([2244, 3672, 1983]) for compound in results: print(f"\n{compound.get('IUPACName', 'Unknown')}") print(f" Formula: {compound.get('MolecularFormula')}") print(f" MW: {compound.get('MolecularWeight')}") print(f" SMILES: {compound.get('CanonicalSMILES')}") print(f" LogP: {compound.get('XLogP')}")
Structure-Activity Relationship (SAR) Analysis: Use similarity searches to find structural analogs of lead compounds, then retrieve bioassay data to compare biological activity across the series.
Virtual Screening: Screen large compound libraries against drug-likeness filters (Lipinski's rules, Veber's rules) using property endpoints to prioritize candidates for experimental testing.
Chemical Identifier Resolution: Translate between compound names, CIDs, InChI, InChIKey, and SMILES notations. Essential for data integration across heterogeneous chemistry databases.
Toxicology Research: Access bioassay results and safety data for compounds to support toxicity profiling and risk assessment in environmental health research.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-09 | pass→pass | 6,166 | 3,534 | -43% | 1 | 1 | 0% | 1,044 | 2,647 | +154% | 0 | 0 | — |
case-01 | pass→pass | 18,366 | 29,303 | +60% | 1 | 1 | 0% | 3,351 | 5,620 | +68% | 0 | 0 | — |
case-02 | pass→pass | 9,762 | 11,117 | +14% | 1 | 1 | 0% | 1,691 | 4,066 | +140% | 0 | 0 | — |
case-03 | pass→pass | 9,387 | 11,083 | +18% | 1 | 1 | 0% | 1,677 | 4,062 | +142% | 0 | 0 | — |
case-04 | pass→pass | 7,392 | 5,710 | -23% | 1 | 1 | 0% | 1,315 | 3,057 | +132% | 0 | 0 | — |
case-05 | fail→pass | 12,817 | 11,344 | -11% | 1 | 1 | 0% | 2,144 | 4,260 | +99% | 0 | 0 | — |
case-06 | pass→pass | 13,318 | 4,020 | -70% | 1 | 1 | 0% | 2,101 | 2,705 | +29% | 0 | 0 | — |
case-07 | fail→pass | 13,296 | 2,216 | -83% | 1 | 1 | 0% | 2,000 | 2,347 | +17% | 0 | 0 | — |
case-08 | pass→pass | 9,831 | 5,349 | -46% | 1 | 1 | 0% | 1,740 | 3,036 | +74% | 0 | 0 | — |
case-10 | pass→pass | 6,759 | 2,831 | -58% | 1 | 1 | 0% | 984 | 2,503 | +154% | 0 | 0 | — |
case-11 | pass→pass | 5,091 | 4,821 | -5% | 1 | 1 | 0% | 852 | 2,841 | +233% | 0 | 0 | — |
case-12 | pass→pass | 4,425 | 3,976 | -10% | 1 | 1 | 0% | 793 | 2,618 | +230% | 0 | 0 | — |
case-13 | pass→pass | 5,674 | 3,484 | -39% | 1 | 1 | 0% | 903 | 2,639 | +192% | 0 | 0 | — |
case-14 | pass→pass | 7,944 | 4,524 | -43% | 1 | 1 | 0% | 1,425 | 2,856 | +100% | 0 | 0 | — |
case-15 | pass→pass | 15,060 | 12,989 | -14% | 1 | 1 | 0% | 2,596 | 4,343 | +67% | 0 | 0 | — |
case-16 | pass→pass | 8,997 | 8,345 | -7% | 1 | 1 | 0% | 1,568 | 3,252 | +107% | 0 | 0 | — |
case-17 | pass→pass | 11,627 | 13,639 | +17% | 1 | 1 | 0% | 1,630 | 4,359 | +167% | 0 | 0 | — |
case-18 | pass→pass | 3,515 | 2,922 | -17% | 1 | 1 | 0% | 556 | 2,572 | +363% | 0 | 0 | — |
case-19 | pass→pass | 7,118 | 4,433 | -38% | 1 | 1 | 0% | 1,267 | 2,884 | +128% | 0 | 0 | — |
case-20 | pass→pass | 3,086 | 2,502 | -19% | 1 | 1 | 0% | 479 | 2,497 | +421% | 0 | 0 | — |
case-21 | pass→pass | 15,603 | 3,228 | -79% | 1 | 1 | 0% | 1,352 | 2,605 | +93% | 0 | 0 | — |
case-22 | pass→pass | 6,368 | 5,721 | -10% | 1 | 1 | 0% | 1,120 | 3,076 | +175% | 0 | 0 | — |
case-23 | pass→pass | 3,939 | 2,929 | -26% | 1 | 1 | 0% | 665 | 2,459 | +270% | 0 | 0 | — |
case-24 | fail→pass | 17,043 | 7,177 | -58% | 1 | 1 | 0% | 1,013 | 3,097 | +206% | 0 | 0 | — |
case-25 | pass→pass | 6,848 | 6,307 | -8% | 1 | 1 | 0% | 1,138 | 3,098 | +172% | 0 | 0 | — |
case-26 | pass→pass | 11,047 | 15,527 | +41% | 1 | 1 | 0% | 1,886 | 4,731 | +151% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 26 cases were attempted, and 25 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +12 percentage points is the difference between those two pass rates over the 25 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.