Skip to content
Back to skills

Molecule Io Core

ASecurity

"Use for RDKit molecule creation, file/string I/O, validation,

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
toolspythonbashreactdatabase

Works with

  • cli

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill molecule-io-core --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Molecule Io Core?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Molecule Io Core
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-molecule-io-core/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-molecule-io-core)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: molecule-io-core
description: "Use for RDKit molecule creation, file/string I/O, validation,
  sanitization, atom/bond/ring queries, substructure matching, hydrogens, and
  editable molecule workflows. Route descriptors/fingerprints,
  conformers/drawing, reactions/standardization, and R-group workflows to their
  dedicated RDKit sub-skills."
disable-model-invocation: true
metadata:
  disco-role: operating
license: BSD 3-Clause
---

# RDKit Molecule I/O Core

Use this sub-skill when a task asks an agent to parse, validate, inspect, edit, serialize, or round-trip RDKit molecules from SMILES, SMARTS, MolBlocks, SDF, or delimited SMILES files.

## Route here

- Parse strings with `Chem.MolFromSmiles`, `Chem.MolFromSmarts`, `Chem.MolFromMolBlock`, or supplier classes.
- Write canonical/isomeric SMILES, MolBlocks, SDF, or SMILES files with `Chem.MolToSmiles`, `Chem.MolToMolBlock`, `Chem.SDWriter`, or `Chem.SmilesWriter`.
- Validate invalid SMILES and empty supplier entries without silently passing `None` molecules downstream.
- Control sanitization, kekulization, aromaticity, valence handling, and explicit/implicit hydrogens.
- Query atoms, bonds, rings, properties, and substructure matches.
- Make small structural edits with `Chem.RWMol` or `Chem.EditableMol` and re-sanitize the result.

## Route elsewhere

- Descriptors, fingerprints, bit vectors, similarity, and clustering: `descriptors-fingerprints`.
- 3D conformers, force-field optimization, 2D coordinates, and drawing: `conformers-drawing`.
- Reaction SMARTS, product sanitization after reactions, molecule standardization, tautomer handling, stereochemistry workflows, and R-groups: `reactions-standardization`.
- Pandas, database, RDKit data-file location, and CLI integration: `data-cli-integration`.

## Start with these references

- `references/molecule-io.md` for parsing, suppliers, writers, and round-trip patterns.
- `references/sanitization-and-queries.md` for sanitization, hydrogens, atom/bond/ring queries, substructure matching, and molecule editing.
- `references/troubleshooting.md` for common failures and safe recovery patterns.
- `scripts/molecule_io_smoke.py` for a tiny standalone smoke test that canonicalizes SMILES and round-trips SDF.

## Core workflow

1. Parse input and immediately check for `None` before doing any chemistry.
2. Canonicalize with `Chem.MolToSmiles(mol, isomericSmiles=True)` when comparing or de-duplicating molecules.
3. Use suppliers defensively: iterate with indexes, skip or report `None`, and preserve molecule names/properties when writing SDF.
4. If using `sanitize=False`, run a deliberate `Chem.SanitizeMol` step before relying on valence, aromaticity, rings, descriptors, or substructure behavior.
5. For structural edits, edit a copy, call `GetMol()`, update property cache if needed, then sanitize or report the sanitization failure.

## Minimal examples

```python
from rdkit import Chem

mol = Chem.MolFromSmiles("CC(=O)O")
if mol is None:
    raise ValueError("invalid SMILES")
canonical = Chem.MolToSmiles(mol, isomericSmiles=True)
```

```python
query = Chem.MolFromSmarts("[CX3](=O)[OX2H1]")
matches = mol.GetSubstructMatches(query)
```

```python
edited = Chem.RWMol(mol)
atom_index = edited.AddAtom(Chem.Atom("Cl"))
edited.AddBond(0, atom_index, Chem.BondType.SINGLE)
new_mol = edited.GetMol()
Chem.SanitizeMol(new_mol)
```

## Bundled check

Run the bundled helper in any environment where RDKit is importable:

```bash
python scripts/molecule_io_smoke.py --smiles "CCO" "c1ccccc1" --include-invalid
```

It asserts that valid SMILES parse, invalid SMILES are reported, canonical SMILES are stable after a second parse, and a tiny SDF round-trip preserves molecule count and properties.

Files in this skill

  • SKILL.md3.7 KB
  • references/molecule-io.md4.1 KB
  • references/sanitization-and-queries.md4.8 KB
  • references/troubleshooting.md4.9 KB
  • scripts/molecule_io_smoke.py5.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.