Chemistry Query
by @cheminem
Chemistry agent skill for PubChem API queries (compound info/properties, structures/SMILES/images, synthesis routes/references) + RDKit cheminformatics (SMIL...
clawhub install chemistry-queryπ About This Skill
name: chemistry-query description: Chemistry agent skill for PubChem API queries (compound info/properties, structures/SMILES/images, synthesis routes/references) + RDKit cheminformatics (SMILES to molecule props/logP/TPSA, 2D PNG/SVG viz, Morgan fingerprints, retrosynthesis/BRICS disconnects, multi-step synth planning). Use for chemistry tasks involving compounds, molecules, structures, PubChem data, RDKit analysis, SMILES processing, synthesis routes, retrosynthesis, reaction simulation. Triggers on chemistry, compounds, molecules, chemical data/properties, PubChem, RDKit, SMILES, structures, synthesis, reactions, retrosynthesis, synth plan/route.
Chemistry Query Agent v1.4.0
Overview
Full-stack chemistry toolkit combining PubChem data retrieval with RDKit molecule processing, visualization, analysis, retrosynthesis, and synthesis planning. All outputs are structured JSON for easy downstream chaining. Generates PNG/SVG images on demand.
Key capabilities:
Quick Start
# PubChem compound info
exec python scripts/query_pubchem.py --compound "aspirin" --type infoMolecular properties from SMILES
exec python scripts/rdkit_mol.py --smiles "CC(=O)Oc1ccccc1C(=O)O" --action propsRetrosynthesis
exec python scripts/rdkit_mol.py --target "CC(=O)Oc1ccccc1C(=O)O" --action retro --depth 2Full chain (name β props + draw + retro)
exec python scripts/chain_entry.py --input-json '{"name": "caffeine", "context": "user"}'
Scripts
scripts/query_pubchem.py
PubChem REST API queries with automatic nameβCID resolution and timeout handling.--compound --type [--format smiles|inchi|image|json] [--threshold 80]
scripts/rdkit_mol.py
RDKit cheminformatics engine. Resolves names via PubChem automatically.--smiles --action
| Action | Description | Key Args |
|--------|-------------|----------|
| props | MW, logP, TPSA, HBD, HBA, rotB, aromRings | --smiles |
| draw | 2D PNG/SVG (300Γ300) | --smiles --output file.png --format png\|svg |
| retro | BRICS recursive retrosynthesis | --target |
| plan | Multi-step retro route | --target |
| react | Forward reaction via SMARTS | --reactants "smi1 smi2" --smarts " |
| fingerprint | Morgan fingerprint bitvector | --smiles --radius 2 |
| similarity | Tanimoto similarity scoring | --query_smiles --target_smiles "smi1,smi2" |
| substruct | Substructure matching | --query_smiles --target_smiles "smi1,smi2" |
| xyz | 3D coordinates (MMFF optimized) | --smiles |
scripts/chain_entry.py
Standard agent chain interface. Accepts {"smiles": "...", "context": "..."} or {"name": "...", "context": "..."}. Returns unified JSON with props, visualization, and retrosynthesis.python scripts/chain_entry.py --input-json '{"name": "sotorasib", "context": "user"}'
Output schema:
{
"agent": "chemistry-query",
"version": "1.4.0",
"smiles": "",
"status": "success|error",
"report": {"props": {...}, "draw": {...}, "retro": {...}},
"risks": [],
"viz": ["path/to/image.png"],
"recommend_next": ["pharmacology", "toxicology"],
"confidence": 0.95,
"warnings": [],
"timestamp": "ISO8601"
}
scripts/templates.json
21 named reaction templates with SMARTS, expected yields, conditions, and references. Includes: Suzuki, Heck, Buchwald-Hartwig, Grignard, Wittig, Diels-Alder, Click, Sonogashira, Negishi, and more.Chaining
1. Name β Full Profile: chain_entry.py with {"name": "ibuprofen"} β props + draw + retro
2. Chemistry β Pharmacology: Output feeds directly into pharma-pharmacology-agent
3. Retro + Viz: Get precursors, then draw each one
4. Suzuki Test: --action react --reactants "c1ccccc1Br c1ccccc1B(O)O" --smarts "[c:1][Br:2].[c:3]B(O)O>>[c:1][c:3]"
Tested With
All features verified end-to-end with RDKit 2024.03+:
| Molecule | SMILES | Tests Passed |
|----------|--------|-------------|
| Caffeine | CN1C=NC2=C1C(=O)N(C(=O)N2C)C | info, structure, props, draw, retro, plan, chain |
| Aspirin | CC(=O)Oc1ccccc1C(=O)O | info, structure, props, draw, retro, plan, chain |
| Sotorasib | PubChem name lookup | info, structure, props, draw, retro, chain |
| Ibuprofen | PubChem name lookup | info, structure, props, chain |
| Invalid SMILES | XXXINVALID | Graceful JSON error |
| Empty input | {} | Graceful JSON error |
Resources
references/api_endpoints.md β PubChem API endpoint reference and rate limitsscripts/rdkit_reaction.py β Legacy reaction modulescripts/chembl_query.py, scripts/pubmed_search.py, scripts/admet_predict.py β Additional query modulesChangelog
v1.4.0 (2026-02-14)
v1.3.0
v1.2.0
π‘ Examples
# PubChem compound info
exec python scripts/query_pubchem.py --compound "aspirin" --type infoMolecular properties from SMILES
exec python scripts/rdkit_mol.py --smiles "CC(=O)Oc1ccccc1C(=O)O" --action propsRetrosynthesis
exec python scripts/rdkit_mol.py --target "CC(=O)Oc1ccccc1C(=O)O" --action retro --depth 2Full chain (name β props + draw + retro)
exec python scripts/chain_entry.py --input-json '{"name": "caffeine", "context": "user"}'