Organic chemistry smarts

From XuShuwenn/RedAct · View interactive version

Organic chemistry smarts is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Match SMILES molecules against SMARTS patterns to detect functional groups using RDKit.

How to use this skill

Skill file

SMARTS Pattern Matching for Molecules

When to Use

Input Format

File /root/input.txt (2 lines):

Output Format

To /root/output.txt:

Match: yes/no

Output "yes" if pattern matches, "no" otherwise.

Using RDKit

from rdkit import Chem

mol = Chem.MolFromSmiles(smiles)
pattern = Chem.MolFromSmarts(smarts_pattern)

if mol is None or pattern is None:
    matched = False
else:
    matched = mol.HasSubstructMatch(pattern)

result = "yes" if matched else "no"

Use RDKit directly for the yes/no decision: parse line 1 as the molecule SMILES, parse line 2 as the SMARTS query, and only call HasSubstructMatch when both parsed objects are valid.

SMARTS Patterns

Tips

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.