[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73J50YF49THFHCTD2AN7YRE":3,"skill-same:01M73J50YF49THFHCTD2AN7YRE":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M73J50YF49THFHCTD2AN7YRE","rdkit-chemdraw-cdxml",null,"Read, write, and edit ChemDraw CDX\u002FCDXML files with RDKit's rdkit.Chem.rdChemDraw plus direct XML editing, always paired with a rendered PNG. Parse molecules and reactions from .cdxml\u002F.cdx, write structures with good 2D depiction, and hand-build or modify the parts RDKit cannot write: reaction arrows, plus signs, schemes\u002Fsteps, and text\u002Flabels. Use for reaction schemes, synthesis routes, mechanisms, retrosynthesis, or SI figures. Critical: RDKit writes structures only — round-tripping a reaction through a Mol silently drops arrows and text; this skill shows the XML layer that preserves them. For pure molecular analysis (descriptors, fingerprints, SMARTS) use rdkit-cheminformatics; for multi-format 3D conversion use openbabel.","bg-szy\u002FTOP-SKILLS","bg-szy","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F106576190?v=4","01M73A4E8KPV67SFXRY8XZGNBX","ShuZhiyong","01M73A4E96MQ294MHM74TZBVQD",6,"BSD-3-Clause","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Frdkit-chemdraw-cdxml\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: \"rdkit-chemdraw-cdxml\"\ndescription: \"Read, write, and edit ChemDraw CDX\u002FCDXML files with RDKit's rdkit.Chem.rdChemDraw plus direct XML editing, always paired with a rendered PNG. Parse molecules and reactions from .cdxml\u002F.cdx, write structures with good 2D depiction, and hand-build or modify the parts RDKit cannot write: reaction arrows, plus signs, schemes\u002Fsteps, and text\u002Flabels. Use for reaction schemes, synthesis routes, mechanisms, retrosynthesis, or SI figures. Critical: RDKit writes structures only — round-tripping a reaction through a Mol silently drops arrows and text; this skill shows the XML layer that preserves them. For pure molecular analysis (descriptors, fingerprints, SMARTS) use rdkit-cheminformatics; for multi-format 3D conversion use openbabel.\"\nlicense: \"BSD-3-Clause\"\n---\n\n# RDKit ChemDraw \u002F CDXML Toolkit\n\n## Overview\n\nCDXML is an XML serialization of ChemDraw's object tree (CDX is its binary form). RDKit 2022.09+ exposes an optional Revvity ChemDraw parser at `rdkit.Chem.rdChemDraw` that reads molecules **and** reactions and writes molecule structures. RDKit cannot write **arrows, plus signs, schemes, or text** — those are built or edited at the XML level. This skill covers the full read → depict → annotate → write → modify → render loop.\n\n## Output contract\n\nA `.cdxml` is not viewable without ChemDraw, and **you cannot run ChemDraw here** — so the rendered PNG is the only evidence the file is correct. Therefore:\n\n- **Deliver `\u003Cname>.cdxml` and `\u003Cname>.png` together, matching basenames** — never the CDXML alone. `build_scheme()` and Module 9 write both; the helper raises if the PNG cannot be produced.\n- **Validate before delivering** with `scripts\u002Fcheck_scheme.py` (rebuilds each molecule from the drawing, sanitizes, checks mass balance across arrows, and critiques layout). Drive it to zero problems.\n- **Report honestly**: \"opens correctly in ChemDraw\" is never something you tested; stereochemistry is not drawn unless you added it. Offer a plain SMILES list of intermediates for schemes with more than three structures.\n\n## When to Use\n\n- Convert SMILES\u002FSDF\u002FMol into `.cdxml` files that open cleanly in ChemDraw\n- Extract molecules or reactions (reactants\u002Fagents\u002Fproducts) from `.cdxml` or `.cdx`\n- Build a reaction scheme: fragments + arrows + `+` separators + conditions text\n- Modify an existing ChemDraw file (relabel, annotate, reposition) without losing its arrows\u002Ftext\n- Batch-generate ChemDraw figures for a reaction dataset or SAR table\n- Use `rdkit-cheminformatics` instead for descriptors\u002Ffingerprints\u002FSMARTS with no ChemDraw I\u002FO\n- For multi-format 3D conversion (MOL2, XYZ, PDB), use `openbabel`; this toolkit is 2D ChemDraw-specific\n\n## Prerequisites\n\n- **Python packages**: `rdkit` (2023.03+, built with ChemDraw support), `epam.indigo` (renders CDXML→PNG); `xml.etree.ElementTree` (stdlib) handles all XML editing.\n- **Inputs**: SMILES\u002FMol for writing; `.cdxml` (UTF-8 text) or `.cdx` (binary) for reading.\n- **Check before installing.** RDKit is usually already present — run `python -c \"import rdkit\"` first; inside pixi use `pixi run python ...`.\n- **Install `epam.indigo` into the interpreter that runs your code.** A bare `pip install` can land in a different Python than the kernel (e.g. system `\u002Fusr\u002Flocal` vs the pixi env that has rdkit), so `import indigo` still fails even though the install \"succeeded\" — and no single interpreter then has both rdkit and indigo. In a Jupyter\u002FIPython kernel use `%pip install epam.indigo`; otherwise `python -m pip install epam.indigo` (the running interpreter), or add it to the project env (`pixi add epam.indigo`). For the same reason, **do not run the build\u002Frender in a fresh `subprocess`** (`[\"python\", …]` may resolve yet another interpreter) — import the helper and run it in the current process.\n\n```bash\npython -m pip install epam.indigo   # the running interpreter; or  %pip install epam.indigo  in Jupyter\npython -c \"from rdkit import Chem; print('ChemDraw write support:', Chem.HasChemDrawCDXSupport())\"\n```\n\n## Quick Start\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdDepictor\n\nmol = Chem.MolFromSmiles(\"CC(=O)Oc1ccccc1C(=O)O\")   # aspirin\nrdDepictor.SetPreferCoordGen(True)\nrdDepictor.Compute2DCoords(mol)                      # coordinates are REQUIRED before writing\ncdxml = rdChemDraw.MolToChemDrawBlock(mol, rdChemDraw.CDXFormat.CDXML)   # -> str\nopen(\"aspirin.cdxml\", \"w\", encoding=\"utf-8\").write(cdxml)\n```\n\n## Core API\n\n### Module 1: Reading molecules\n\n`MolsFromChemDrawFile` \u002F `MolsFromChemDrawBlock` handle both `.cdx` and `.cdxml`, returning a tuple of `Mol` (one per fragment).\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw\n\nmols = rdChemDraw.MolsFromChemDrawFile(\"drawing.cdxml\", sanitize=True, removeHs=True)\nfor m in mols:\n    print(Chem.MolToSmiles(m))\n\nblock = open(\"drawing.cdxml\", encoding=\"utf-8\").read()\nmols = rdChemDraw.MolsFromChemDrawBlock(block, sanitize=True, removeHs=True)\nmols_legacy = Chem.MolsFromCDXML(block)   # CDXML-only fallback, no ChemDraw SDK needed\n```\n\n### Module 2: Reading reactions (arrows → reactant\u002Fproduct split)\n\n`ReactionsFromChemDrawBlock` interprets `\u003Cstep>`\u002F`\u003Carrow>` and returns `ChemicalReaction`s with reactants, agents, and products split out. Note the reaction reader defaults `sanitize=False`.\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdChemReactions\n\nblock = open(\"reaction.cdxml\", encoding=\"utf-8\").read()\nfor rxn in rdChemDraw.ReactionsFromChemDrawBlock(block, sanitize=True):\n    print(\"reactants:\", [Chem.MolToSmiles(m) for m in rxn.GetReactants()])\n    print(\"products :\", [Chem.MolToSmiles(m) for m in rxn.GetProducts()])\n\nrxns = rdChemReactions.ReactionsFromCDXMLBlock(block, sanitize=True)   # legacy equivalent\n```\n\n### Module 3: Writing molecule structures\n\n`MolToChemDrawBlock` writes one molecule to CDXML (`str`). CDX (binary) write is broken in `rdChemDraw` (`UnicodeDecodeError`); use the legacy writer for CDX bytes.\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdDepictor, rdmolfiles\n\nmol = Chem.MolFromSmiles(\"c1ccccc1O\")\nrdDepictor.Compute2DCoords(mol)                                          # coords first, always\ncdxml = rdChemDraw.MolToChemDrawBlock(mol, rdChemDraw.CDXFormat.CDXML)   # str (preferred)\ncdx_bytes = Chem.MolToCDXMLBlock(mol, rdmolfiles.CDXMLFormat.CDX)        # bytes (legacy writer)\n```\n\n### Module 4: Good molecular depiction\n\nLayout quality is set *before* writing. CoordGen gives more natural coordinates; template alignment keeps a shared scaffold oriented consistently across a series. Note: CoordGen still tangles cages and bridged bicyclics — check those in the render.\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdDepictor\n\nrdDepictor.SetPreferCoordGen(True)\nmol = Chem.MolFromSmiles(\"O=C(Nc1ccc(cc1)S(=O)(=O)N)C\")\nrdDepictor.Compute2DCoords(mol)\nrdDepictor.StraightenDepiction(mol)\nrdDepictor.NormalizeDepiction(mol)      # uniform median bond length\n```\n\n```python\n# Align a series to a shared scaffold so the core is drawn identically each time\ntemplate = Chem.MolFromSmiles(\"c1ccc(cc1)S(=O)(=O)N\")\nrdDepictor.Compute2DCoords(template)\nfor m in [Chem.MolFromSmiles(s) for s in [\"Cc1ccc(cc1)S(=O)(=O)N\", \"Clc1ccc(cc1)S(=O)(=O)N\"]]:\n    rdDepictor.GenerateDepictionMatching2DStructure(m, template)\n```\n\n### Module 5: Drawing arrows\n\nA reaction arrow is an `\u003Carrow>` with `Head3D`\u002F`Tail3D` (`\"x y z\"`, y increases downward). `ArrowheadHead`\u002F`ArrowheadType` style the head. Equilibrium\u002Fresonance\u002Fretrosynthetic arrows use a `\u003Cgraphic>` Line with `ArrowType`.\n\n```python\nimport xml.etree.ElementTree as ET\n\ndef make_arrow(arrow_id, tail_xy, head_xy):\n    (tx, ty), (hx, hy) = tail_xy, head_xy\n    return ET.Element(\"arrow\", {\n        \"id\": str(arrow_id), \"FillType\": \"None\", \"ArrowheadType\": \"Solid\",\n        \"ArrowheadHead\": \"Full\", \"HeadSize\": \"2250\",\n        \"BoundingBox\": f\"{min(tx,hx)} {min(ty,hy)-4} {max(tx,hx)} {max(ty,hy)+4}\",\n        \"Head3D\": f\"{hx} {hy} 0\", \"Tail3D\": f\"{tx} {ty} 0\"})\n\nprint(ET.tostring(make_arrow(40, (160, 100), (210, 100)), encoding=\"unicode\"))\nequil = ET.Element(\"graphic\", {\"id\": \"41\", \"GraphicType\": \"Line\",\n                               \"ArrowType\": \"Equilibrium\", \"BoundingBox\": \"160 100 210 100\"})\n```\n\n### Module 6: Reaction schemes and steps\n\nA `\u003Cscheme>` groups `\u003Cstep>` objects that reference page objects **by id**: `ReactionStepReactants`, `ReactionStepProducts`, `ReactionStepArrows`, `ReactionStepPlusses`, and objects above\u002Fbelow the arrow.\n\n```python\nimport xml.etree.ElementTree as ET\n\ndef make_plus(gid, x, y):\n    return ET.Element(\"graphic\", {\"id\": str(gid), \"GraphicType\": \"Symbol\",\n                                  \"SymbolType\": \"Plus\", \"BoundingBox\": f\"{x} {y-7} {x+15} {y+8}\"})\n\nscheme = ET.Element(\"scheme\", {\"id\": \"60\"})\nET.SubElement(scheme, \"step\", {\"id\": \"61\", \"ReactionStepReactants\": \"10 20\",\n    \"ReactionStepProducts\": \"50\", \"ReactionStepArrows\": \"40\",\n    \"ReactionStepPlusses\": \"30\", \"ReactionStepObjectsAboveArrow\": \"70\"})\nprint(ET.tostring(scheme, encoding=\"unicode\"))\n```\n\n### Module 7: Adding text and labels\n\nFree text is a `\u003Ct>` at `p=\"x y\"` holding one or more `\u003Cs>` styled-string children. `\u003Cs>` references a `font` id (`\u003Cfonttable>`) and `color` index (`\u003Ccolortable>`); `face` is a bitmask (1=bold, 2=italic, 32=subscript, 64=superscript). Split a `\u003Ct>` into multiple `\u003Cs>` runs for subscripts (`Br₂`, `CO₂H`). Indigo renders **subscript (32) but not superscript (64)** — it drops the run's leading text — so keep charges inline (`H+`, `OH-`). `°C` (temperatures) and `Δ` (heat) render with the Arial font; avoid other non-Latin-1 characters (`hν`, en-dashes).\n\n```python\nimport xml.etree.ElementTree as ET\n\ndef make_text(tid, x, y, runs, font_id=21, size=10):\n    \"\"\"runs: list of (text, face). face 0=normal, 1=bold, 32=subscript, 64=superscript.\"\"\"\n    t = ET.Element(\"t\", {\"id\": str(tid), \"p\": f\"{x} {y}\"})\n    for text, face in runs:\n        ET.SubElement(t, \"s\", {\"font\": str(font_id), \"size\": str(size),\n                               \"color\": \"0\", \"face\": str(face)}).text = text\n    return t\n\nprint(ET.tostring(make_text(70, 175, 92, [(\"reflux, 2 h\", 0)]), encoding=\"unicode\"))\nprint(ET.tostring(make_text(80, 158, 135, [(\"Br\", 0), (\"2\", 32), (\" (excess)\", 0)]),\n                  encoding=\"unicode\"))   # Br\u003Csub>2\u003C\u002Fsub> (excess)\n```\n\n### Module 8: Editing an existing CDXML file\n\n`ElementTree` round-trips arrows, text, and graphics it does not understand, so you can edit a real ChemDraw file without losing objects — unlike an RDKit Mol round-trip.\n\n```python\nimport xml.etree.ElementTree as ET\n\ntree = ET.parse(\"reaction.cdxml\")          # DOCTYPE is dropped on re-save (harmless)\nroot = tree.getroot()\nfor s in root.iter(\"s\"):                   # relabel \"Cl\" -> \"Br\"\n    if s.text == \"Cl\":\n        s.text = \"Br\"\ncap = ET.SubElement(root.find(\"page\"), \"t\", {\"p\": \"100 300\"})\nET.SubElement(cap, \"s\", {\"font\": \"21\", \"size\": \"12\", \"color\": \"0\"}).text = \"Scheme 1\"\ntree.write(\"reaction_edited.cdxml\", encoding=\"unicode\", xml_declaration=True)\n```\n\n### Module 9: Rendering CDXML to PNG\n\nRender the PNG next to the CDXML (same basename), look at it, then deliver both. [Indigo](https:\u002F\u002Flifescience.opensource.epam.com\u002Findigo\u002F) (`epam.indigo`) loads a CDXML — a scheme with arrows as a *reaction*, a lone structure as a *molecule* — and rasterizes arrows, text, and layout faithfully. (RDKit's own `Draw.ReactionToImage` re-lays-out molecules and drops the ChemDraw arrows\u002Ftext, so use Indigo to render a file as authored.)\n\n```python\nfrom pathlib import Path\nfrom indigo import Indigo\nfrom indigo.renderer import IndigoRenderer\n\ndef render_cdxml(cdxml_path, png_path=None, width=1600):\n    png_path = png_path or str(Path(cdxml_path).with_suffix(\".png\"))\n    ind = Indigo(); rnd = IndigoRenderer(ind)\n    ind.setOption(\"render-output-format\", \"png\")\n    ind.setOption(\"render-background-color\", \"1,1,1\")\n    ind.setOption(\"render-image-width\", width)\n    cdxml = open(cdxml_path, encoding=\"utf-8\").read()\n    try:\n        obj = ind.loadReaction(cdxml)   # scheme with arrows\n    except Exception:\n        obj = ind.loadMolecule(cdxml)   # single structure\n    rnd.renderToFile(obj, png_path)\n    return png_path\n\nprint(\"Wrote\", render_cdxml(\"scheme.cdxml\"))\n```\n\n## Key Concepts\n\n### CDXML coordinate system\n\n**y increases downward** (origin top-left). Atoms: `p=\"x y\"`; arrows: `Head3D`\u002F`Tail3D=\"x y z\"`; graphics\u002Ftext: `BoundingBox=\"x1 y1 x2 y2\"`. Default bond length ≈ 30.\n\n```python\ndef shift_fragment(frag, dx, dy):      # move a fragment onto the canvas\n    for n in frag.iter(\"n\"):\n        x, y = map(float, n.get(\"p\").split())\n        n.set(\"p\", f\"{x+dx} {y+dy}\")\n    return frag\n```\n\n### Object-id reference model\n\nEvery object has a unique integer `id`; reactions and groups reference members **by id**, not by nesting. When merging fragments from separate RDKit outputs (each starts ids at 1), renumber all ids to stay globally unique, then wire `\u003Cstep>` to the new ids.\n\n### RDKit vs XML capability boundary\n\n| Task | RDKit `rdChemDraw` | Direct XML |\n|------|--------------------|-----------|\n| Read molecules \u002F reactions | ✅ | — |\n| Write molecule structure | ✅ (CDXML) | — |\n| Write arrows \u002F plus \u002F scheme \u002F text | ❌ | ✅ |\n| Preserve objects while editing | ❌ (drops on Mol round-trip) | ✅ |\n\n## Common Workflows\n\n### Workflow 1: SMILES → single-molecule CDXML\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdDepictor\n\ndef smiles_to_cdxml(smiles, path):\n    mol = Chem.MolFromSmiles(smiles)\n    if mol is None:\n        raise ValueError(f\"Invalid SMILES: {smiles}\")\n    rdDepictor.SetPreferCoordGen(True)\n    rdDepictor.Compute2DCoords(mol)\n    rdDepictor.StraightenDepiction(mol)\n    open(path, \"w\", encoding=\"utf-8\").write(rdChemDraw.MolToChemDrawBlock(mol))\n    return path\n\nprint(\"Wrote\", smiles_to_cdxml(\"CC(=O)Oc1ccccc1C(=O)O\", \"aspirin.cdxml\"))\n```\n\n### Workflow 2: Hand-assemble a reaction from Modules 5-7\n\nCombine `_fragment_of` (write a mol, extract `\u003Cfragment>`, renumber ids, shift x) with an arrow, a plus, conditions text, and a `\u003Cstep>`. Render with Module 9. For multi-step schemes prefer Workflow 4.\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdDepictor, rdChemReactions\nimport xml.etree.ElementTree as ET\n\ndef _fragment_of(smiles, base_id, dx):\n    m = Chem.MolFromSmiles(smiles); rdDepictor.Compute2DCoords(m)\n    frag = ET.fromstring(rdChemDraw.MolToChemDrawBlock(m)).find(\"page\u002Ffragment\")\n    remap = {}\n    for i, el in enumerate([frag, *frag.iter(\"n\"), *frag.iter(\"b\")]):\n        remap[el.get(\"id\")] = str(base_id + i); el.set(\"id\", remap[el.get(\"id\")])\n    for b in frag.iter(\"b\"):\n        b.set(\"B\", remap[b.get(\"B\")]); b.set(\"E\", remap[b.get(\"E\")])\n    for n in frag.iter(\"n\"):\n        x, y = map(float, n.get(\"p\").split()); n.set(\"p\", f\"{x+dx} {y}\")\n    return frag\n\nroot = ET.Element(\"CDXML\", {\"BondLength\": \"30\"}); page = ET.SubElement(root, \"page\")\npage.append(_fragment_of(\"CCO\", 100, 0))\nET.SubElement(page, \"graphic\", {\"id\": \"30\", \"GraphicType\": \"Symbol\",\n                                \"SymbolType\": \"Plus\", \"BoundingBox\": \"60 -7 75 8\"})\npage.append(_fragment_of(\"CC(=O)O\", 200, 120))\nET.SubElement(page, \"arrow\", {\"id\": \"40\", \"FillType\": \"None\", \"ArrowheadHead\": \"Full\",\n    \"ArrowheadType\": \"Solid\", \"HeadSize\": \"2250\", \"Head3D\": \"320 3 0\", \"Tail3D\": \"260 3 0\"})\ncond = ET.SubElement(page, \"t\", {\"id\": \"70\", \"p\": \"270 -12\"})\nET.SubElement(cond, \"s\", {\"font\": \"21\", \"size\": \"9\", \"color\": \"0\"}).text = \"H+, reflux\"\npage.append(_fragment_of(\"CCOC(C)=O\", 300, 420))\nscheme = ET.SubElement(page, \"scheme\", {\"id\": \"60\"})\nET.SubElement(scheme, \"step\", {\"id\": \"61\", \"ReactionStepReactants\": \"100 200\",\n    \"ReactionStepProducts\": \"300\", \"ReactionStepArrows\": \"40\", \"ReactionStepPlusses\": \"30\"})\nET.SubElement(ET.SubElement(root, \"fonttable\"), \"font\",\n              {\"id\": \"21\", \"charset\": \"x-mac-roman\", \"name\": \"Helvetica\"})\n\ncdxml = ET.tostring(root, encoding=\"unicode\")\nopen(\"esterification.cdxml\", \"w\", encoding=\"utf-8\").write(cdxml)\nprint(\"reactions re-parsed:\", len(rdChemReactions.ReactionsFromCDXMLBlock(cdxml, sanitize=True)))\n```\n\n### Workflow 3: Edit an existing file, preserving arrows and text\n\n```python\nimport xml.etree.ElementTree as ET\n\ntree = ET.parse(\"input_reaction.cdxml\"); root = tree.getroot()\ntitle = ET.SubElement(root.find(\"page\"), \"t\", {\"p\": \"50 -30\"})\nET.SubElement(title, \"s\", {\"font\": \"21\", \"size\": \"14\", \"color\": \"0\", \"face\": \"1\"}).text = \"Route A\"\nfor arrow in root.iter(\"arrow\"):\n    arrow.set(\"HeadSize\", \"3000\")\ntree.write(\"output_reaction.cdxml\", encoding=\"unicode\", xml_declaration=True)\n```\n\n### Workflow 4: Multi-step scheme with the bundled helper (recommended)\n\n`scripts\u002Fbuild_reaction_scheme.py` turns `(smiles, name, conditions)` steps into a laid-out scheme **and its PNG in one call**, handling grid layout, globally unique ids, single arrows, and conditions text placed clear of structures — the defects that recur when schemes are hand-built. Cells auto-size to the largest structure, so big molecules never overlap. Model convergent\u002Fmulti-component steps by folding co-reactants into `conditions` (e.g. `[\"+ (MeO2C)2C=CHOMe\", \"Base, MeCN\"]`), keeping one main-chain structure per cell.\n\n**Copy the scripts into your working directory with your file tools — not from Python.** Inside the execution sandbox the `\u002FSciAgent-Skills\u002F...` path is reachable **only through your read-file tool**; it is not on the sandbox filesystem, so a Python `open()` or `import` of that path fails with `FileNotFoundError`\u002F`ModuleNotFoundError`. For each of `build_reaction_scheme.py` and `check_scheme.py` (each is self-contained — rdkit + epam.indigo only — copy just what you need):\n\n1. **Read-file tool** on `\u002FSciAgent-Skills\u002Fskills\u002Fstructural-biology-drug-discovery\u002Frdkit-chemdraw-cdxml\u002Fscripts\u002F\u003Cname>` (the leading slash routes to the skills backend) → returns the script text.\n2. **Write-file tool** → save it to `.\u002F\u003Cname>` in the working directory.\n\nThen import the local copies. (Importing writes a harmless `__pycache__\u002F`; set `PYTHONDONTWRITEBYTECODE=1` to suppress it.)\n\n```python\nfrom build_reaction_scheme import build_scheme    # local copies, already in the workdir\nfrom check_scheme import check_all\n\nsteps = [\n    {\"smiles\": \"O=C1CCCC1\", \"name\": \"cyclopentanone\"},\n    {\"smiles\": \"O=C1C(Br)C(Br)C(Br)C1Br\", \"name\": \"tetrabromoketone\",\n     \"conditions\": [\"Br2 (excess)\", \"AcOH, 25 C\"]},          # reagents for the arrow into this step\n    {\"smiles\": \"O=C1C=CC=C1Br\", \"name\": \"2-bromocyclopentadienone\",\n     \"conditions\": [\"Et2NH\", \"cold Et2O\"]},\n    {\"smiles\": \"C12C3C4C1C5C2C3C45\", \"name\": \"cubane\", \"conditions\": [\"(remaining steps)\"]},\n]\ncdxml, png = build_scheme(steps, \"cubane.cdxml\", title=\"Total Synthesis of Cubane\", cols=4)\ncheck_all(\"cubane.cdxml\", expect={3: \"C12C3C4C1C5C2C3C45\"})   # validate before delivering\nprint(f\"Deliverables: {cdxml} + {png}\")\n```\n\n## Key Parameters\n\n| Parameter | Module \u002F Function | Default | Options | Effect |\n|-----------|-------------------|---------|---------|--------|\n| `format` | `MolToChemDrawBlock` | `CDXFormat.CDXML` | `CDXML`, `CDX` | Use CDXML (str); for CDX bytes use legacy `MolToCDXMLBlock` |\n| `sanitize` | `MolsFromChemDrawBlock` | `True` | `True`\u002F`False` | `False` to inspect raw\u002Finvalid input |\n| `sanitize` | `ReactionsFromChemDrawBlock` | `False` | `True`\u002F`False` | Defaults **False** — pass `True` for clean SMILES |\n| `SetPreferCoordGen` | `rdDepictor` | `False` | `True`\u002F`False` | `True` gives more natural 2D layouts |\n| `ArrowheadHead` | `\u003Carrow>` XML | — | `Full`, `HalfLeft`, `HalfRight`, `None` | Arrowhead style |\n| `ArrowType` | `\u003Cgraphic>` Line | — | `FullHead`, `Equilibrium`, `Resonance`, `RetroSynthetic`, `NoGo` | Special arrow semantics |\n| `BondLength` | `\u003CCDXML>` root | `\"\"` (RDKit) | numeric, e.g. `30` | Canvas scale; set a number so structures\u002Farrows scale together |\n\n## Best Practices\n\n1. **Compute 2D coordinates before writing** (`SetPreferCoordGen(True)` then `Compute2DCoords`); a molecule without coordinates writes as a degenerate layout.\n2. **Never round-trip a reaction through a Mol if you need the drawing** — reading drops arrows, plus signs, text, and graphics. Edit reaction files on the XML tree (Module 8).\n3. **Keep object ids globally unique.** Merging RDKit outputs (each starts at 1) collides and breaks `\u003Cstep>` references and doubles arrows; renumber into disjoint blocks.\n4. **Prefer CDXML (text) over CDX (binary).** CDX write via `rdChemDraw` raises `UnicodeDecodeError`; only legacy `Chem.MolToCDXMLBlock(mol, CDXMLFormat.CDX)` returns valid CDX bytes.\n5. **Write a complete document header** — `\u003CCDXML BondLength=...>` plus a standard `\u003Cfonttable>`\u002F`\u003Ccolortable>` and page dimensions. See `references\u002Fcdxml-schema-reference.md`.\n6. **Text**: use `°C` for temperatures and `Δ` for heat (both render); keep charges inline (`H+`, `OH-`) since Indigo has no superscript; avoid other non-Latin-1 characters. Render heteroatoms via `\u003Cn Element=...>`, not free `\u003Ct>` text; don't add decorative flags (\"Chiral\"\u002F\"racemic\") — use wedge bonds. Keep labels clear of the arrow line: names under the structure, conditions offset above\u002Fbeside the arrow. (`build_scheme` does all of this — `0 C`→`0 °C`, `heat`→`Δ`, subscripts, spacing — automatically.)\n7. **Deliver the CDXML and PNG together, and run `check_scheme.check_all` first.** The render and the critic catch overlaps, duplicate\u002Fdegenerate arrows, dropped intermediates, and connectivity errors before the user sees them.\n\n## Common Recipes\n\n### Recipe: Batch SMILES → CDXML files\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdDepictor\nfrom pathlib import Path\n\nrdDepictor.SetPreferCoordGen(True); Path(\"out\").mkdir(exist_ok=True)\nfor i, smi in enumerate([\"CCO\", \"c1ccccc1\", \"CC(=O)O\"]):\n    m = Chem.MolFromSmiles(smi); rdDepictor.Compute2DCoords(m)\n    Path(f\"out\u002Fmol_{i}.cdxml\").write_text(rdChemDraw.MolToChemDrawBlock(m), encoding=\"utf-8\")\n```\n\n### Recipe: Pretty-print CDXML for inspection\n\n```python\nimport xml.dom.minidom as minidom\nprint(minidom.parseString(open(\"esterification.cdxml\", encoding=\"utf-8\").read())\n      .toprettyxml(indent=\"  \")[:1500])\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| Exception on `MolToChemDrawBlock` | RDKit built without ChemDraw support | Check `Chem.HasChemDrawCDXSupport()`; install a build with the Revvity parser |\n| `UnicodeDecodeError` writing CDX | `rdChemDraw` CDX path is broken | Use legacy `Chem.MolToCDXMLBlock(mol, CDXMLFormat.CDX)`, or write CDXML |\n| Structure written flat\u002Foverlapping | No 2D coordinates | Call `rdDepictor.Compute2DCoords(mol)` before writing |\n| Edited reaction lost arrows\u002Ftext | File round-tripped through a Mol | Edit the XML tree (`ElementTree`); RDKit writes structures only |\n| Reaction won't re-parse | `\u003Cstep>` references missing ids (collision after merge) | Renumber fragment ids globally unique; update `ReactionStep*` |\n| Structures\u002Farrows mismatched size | `\u003CCDXML BondLength=\"\">` empty | Set a numeric `BondLength` (e.g. `30`) on the root |\n| `mols` tuple empty on read | Wrong format, or unsanitizable structure | Retry with `sanitize=False`; confirm the file is genuine CDX\u002FCDXML |\n| Doubled labels (\"OO\", \"BrBr\") | Free-text `\u003Ct>` on top of `Element` nodes | Remove the free labels; let `\u003Cn Element=...>` render the symbol |\n| Stray line crosses a structure | Duplicate or degenerate `\u003Carrow>` | Run `check_scheme`; unique id + real length (`Head3D`≠`Tail3D`) per arrow |\n| Conditions text overlaps a structure | Text placed on the structure, not over the arrow gap | Center conditions over the arrow midpoint; widen structure spacing |\n| Text renders wrong\u002Fblank | non-ASCII, or `\u003Cs font>` id missing from `\u003Cfonttable>` | Keep text ASCII; reference an existing `font id` |\n| No PNG \u002F render error | `epam.indigo` missing, or loaded as molecule when it has arrows | `pip install epam.indigo`; try `loadReaction` before `loadMolecule` |\n| \"Chiral\"\u002F\"racemic\" printed above structures | Decorative flag text added as `\u003Ct>` | Remove it — stereochemistry is shown by wedge bonds; `check_scheme` flags it |\n| A name or label sits on an arrow | Text placed on the arrow line | Names go under the structure, conditions offset above\u002Fbeside the arrow; `check_scheme` flags text on an arrow |\n| `stoi: no conversion` loading in Indigo | `\u003CCDXML BondLength=\"\">` empty | Set a numeric `BondLength` (e.g. `30`) before rendering |\n| `ModuleNotFoundError`\u002F`FileNotFoundError` on a helper script | `import`ed or `open()`ed the `\u002FSciAgent-Skills\u002F...` path from Python | That path is reachable only via the read-file tool, not the sandbox filesystem — copy the script into the workdir first (Workflow 4), then import |\n| `import indigo` fails after a \"successful\" `pip install` | pip installed into a different Python than the runtime (system `\u002Fusr\u002Flocal` vs the pixi\u002Fkernel env) | Install into the running interpreter (`%pip install` or `python -m pip install`), or `pixi add epam.indigo`; don't shell out to a different `python` |\n| A charge (`H+`) renders as a giant `+` | Indigo draws a standalone `+` as a reaction-plus symbol, and superscript (face 64) mangles ion text | Keep charges inline (`H+`, `OH-`), face 0 — a true raised superscript is not achievable in the Indigo preview. Subscripts (face 32) and `°C`\u002F`Δ` render fine |\n\n## Bundled Resources\n\nThe `scripts\u002F` files can be read from the skill path but **not imported from there** — copy the one you need into your working directory (`read_file` it, write locally), then `import` or run it (see Workflow 4 for the exact copy snippet). Each is self-contained and depends only on rdkit (+ epam.indigo).\n\n- `references\u002Fcdxml-schema-reference.md` — element\u002Fattribute cheat-sheet (`n`, `b`, `arrow`, `graphic`, `step`\u002F`scheme`, `t`\u002F`s`, `fonttable`, `colortable`), coordinate conventions, enum tables, and a copy-paste document header.\n- `scripts\u002Fbuild_reaction_scheme.py` — assemble a multi-step scheme from `(smiles, name, conditions)` steps and render the PNG in one call; auto-sizes cells so structures never overlap. Library (`build_scheme(...)`) or CLI (`python build_reaction_scheme.py steps.json out.cdxml out.png \"Title\"`).\n- `scripts\u002Fcheck_scheme.py` — pre-delivery validator\u002Fcritic. `check_all(path, expect=..., perspective_ids=...)` rebuilds each molecule from the drawing, sanitizes, prints formulas for a mass-balance check, and flags duplicate ids, fragment overlaps, degenerate arrows, non-ASCII text, decorative flag words (\"Chiral\"), and labels sitting on an arrow line.\n\n## Related Skills\n\n- **rdkit-cheminformatics** — descriptors, fingerprints, SMARTS; analysis once molecules are parsed\n- **datamol-cheminformatics** — higher-level RDKit wrapper for batch standardization before drawing\n- **openbabel** — multi-format 2D\u002F3D conversion when you need formats beyond ChemDraw\n\n## References\n\n- [RDKit `rdkit.Chem.rdChemDraw`](https:\u002F\u002Fwww.rdkit.org\u002Fdocs\u002Fsource\u002Frdkit.Chem.rdChemDraw.html) — `MolsFromChemDraw*`, `ReactionsFromChemDraw*`, `MolToChemDrawBlock`, `CDXFormat`\n- [RDKit depiction docs](https:\u002F\u002Fwww.rdkit.org\u002Fdocs\u002Fsource\u002Frdkit.Chem.Draw.rdMolDraw2D.html) — 2D coordinates and CoordGen\n- [CDX\u002FCDXML format specification (CambridgeSoft SDK mirror)](https:\u002F\u002Fchemapps.stolaf.edu\u002Fiupac\u002Fcdx\u002Fsdk\u002F) — arrows, graphics, reactions, text\n- [RDKit CDXML test fixtures](https:\u002F\u002Fgithub.com\u002Frdkit\u002Frdkit\u002Ftree\u002Fmaster\u002FCode\u002FGraphMol\u002Ftest_data\u002FCDXML) — real ChemDraw-authored `.cdxml`\n- [Indigo toolkit (`epam.indigo`)](https:\u002F\u002Flifescience.opensource.epam.com\u002Findigo\u002F) — CDXML loading and PNG rendering\n","# RDKit ChemDraw \u002F CDXML Toolkit\n\n## Overview\n\nCDXML is an XML serialization of ChemDraw's object tree (CDX is its binary form). RDKit 2022.09+ exposes an optional Revvity ChemDraw parser at `rdkit.Chem.rdChemDraw` that reads molecules **and** reactions and writes molecule structures. RDKit cannot write **arrows, plus signs, schemes, or text** — those are built or edited at the XML level. This skill covers the full read → depict → annotate → write → modify → render loop.\n\n## Output contract\n\nA `.cdxml` is not viewable without ChemDraw, and **you cannot run ChemDraw here** — so the rendered PNG is the only evidence the file is correct. Therefore:\n\n- **Deliver `\u003Cname>.cdxml` and `\u003Cname>.png` together, matching basenames** — never the CDXML alone. `build_scheme()` and Module 9 write both; the helper raises if the PNG cannot be produced.\n- **Validate before delivering** with `scripts\u002Fcheck_scheme.py` (rebuilds each molecule from the drawing, sanitizes, checks mass balance across arrows, and critiques layout). Drive it to zero problems.\n- **Report honestly**: \"opens correctly in ChemDraw\" is never something you tested; stereochemistry is not drawn unless you added it. Offer a plain SMILES list of intermediates for schemes with more than three structures.\n\n## When to Use\n\n- Convert SMILES\u002FSDF\u002FMol into `.cdxml` files that open cleanly in ChemDraw\n- Extract molecules or reactions (reactants\u002Fagents\u002Fproducts) from `.cdxml` or `.cdx`\n- Build a reaction scheme: fragments + arrows + `+` separators + conditions text\n- Modify an existing ChemDraw file (relabel, annotate, reposition) without losing its arrows\u002Ftext\n- Batch-generate ChemDraw figures for a reaction dataset or SAR table\n- Use `rdkit-cheminformatics` instead for descriptors\u002Ffingerprints\u002FSMARTS with no ChemDraw I\u002FO\n- For multi-format 3D conversion (MOL2, XYZ, PDB), use `openbabel`; this toolkit is 2D ChemDraw-specific\n\n## Prerequisites\n\n- **Python packages**: `rdkit` (2023.03+, built with ChemDraw support), `epam.indigo` (renders CDXML→PNG); `xml.etree.ElementTree` (stdlib) handles all XML editing.\n- **Inputs**: SMILES\u002FMol for writing; `.cdxml` (UTF-8 text) or `.cdx` (binary) for reading.\n- **Check before installing.** RDKit is usually already present — run `python -c \"import rdkit\"` first; inside pixi use `pixi run python ...`.\n- **Install `epam.indigo` into the interpreter that runs your code.** A bare `pip install` can land in a different Python than the kernel (e.g. system `\u002Fusr\u002Flocal` vs the pixi env that has rdkit), so `import indigo` still fails even though the install \"succeeded\" — and no single interpreter then has both rdkit and indigo. In a Jupyter\u002FIPython kernel use `%pip install epam.indigo`; otherwise `python -m pip install epam.indigo` (the running interpreter), or add it to the project env (`pixi add epam.indigo`). For the same reason, **do not run the build\u002Frender in a fresh `subprocess`** (`[\"python\", …]` may resolve yet another interpreter) — import the helper and run it in the current process.\n\n```bash\npython -m pip install epam.indigo   # the running interpreter; or  %pip install epam.indigo  in Jupyter\npython -c \"from rdkit import Chem; print('ChemDraw write support:', Chem.HasChemDrawCDXSupport())\"\n```\n\n## Quick Start\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdDepictor\n\nmol = Chem.MolFromSmiles(\"CC(=O)Oc1ccccc1C(=O)O\")   # aspirin\nrdDepictor.SetPreferCoordGen(True)\nrdDepictor.Compute2DCoords(mol)                      # coordinates are REQUIRED before writing\ncdxml = rdChemDraw.MolToChemDrawBlock(mol, rdChemDraw.CDXFormat.CDXML)   # -> str\nopen(\"aspirin.cdxml\", \"w\", encoding=\"utf-8\").write(cdxml)\n```\n\n## Core API\n\n### Module 1: Reading molecules\n\n`MolsFromChemDrawFile` \u002F `MolsFromChemDrawBlock` handle both `.cdx` and `.cdxml`, returning a tuple of `Mol` (one per fragment).\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw\n\nmols = rdChemDraw.MolsFromChemDrawFile(\"drawing.cdxml\", sanitize=True, removeHs=True)\nfor m in mols:\n    print(Chem.MolToSmiles(m))\n\nblock = open(\"drawing.cdxml\", encoding=\"utf-8\").read()\nmols = rdChemDraw.MolsFromChemDrawBlock(block, sanitize=True, removeHs=True)\nmols_legacy = Chem.MolsFromCDXML(block)   # CDXML-only fallback, no ChemDraw SDK needed\n```\n\n### Module 2: Reading reactions (arrows → reactant\u002Fproduct split)\n\n`ReactionsFromChemDrawBlock` interprets `\u003Cstep>`\u002F`\u003Carrow>` and returns `ChemicalReaction`s with reactants, agents, and products split out. Note the reaction reader defaults `sanitize=False`.\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdChemReactions\n\nblock = open(\"reaction.cdxml\", encoding=\"utf-8\").read()\nfor rxn in rdChemDraw.ReactionsFromChemDrawBlock(block, sanitize=True):\n    print(\"reactants:\", [Chem.MolToSmiles(m) for m in rxn.GetReactants()])\n    print(\"products :\", [Chem.MolToSmiles(m) for m in rxn.GetProducts()])\n\nrxns = rdChemReactions.ReactionsFromCDXMLBlock(block, sanitize=True)   # legacy equivalent\n```\n\n### Module 3: Writing molecule structures\n\n`MolToChemDrawBlock` writes one molecule to CDXML (`str`). CDX (binary) write is broken in `rdChemDraw` (`UnicodeDecodeError`); use the legacy writer for CDX bytes.\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdDepictor, rdmolfiles\n\nmol = Chem.MolFromSmiles(\"c1ccccc1O\")\nrdDepictor.Compute2DCoords(mol)                                          # coords first, always\ncdxml = rdChemDraw.MolToChemDrawBlock(mol, rdChemDraw.CDXFormat.CDXML)   # str (preferred)\ncdx_bytes = Chem.MolToCDXMLBlock(mol, rdmolfiles.CDXMLFormat.CDX)        # bytes (legacy writer)\n```\n\n### Module 4: Good molecular depiction\n\nLayout quality is set *before* writing. CoordGen gives more natural coordinates; template alignment keeps a shared scaffold oriented consistently across a series. Note: CoordGen still tangles cages and bridged bicyclics — check those in the render.\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdDepictor\n\nrdDepictor.SetPreferCoordGen(True)\nmol = Chem.MolFromSmiles(\"O=C(Nc1ccc(cc1)S(=O)(=O)N)C\")\nrdDepictor.Compute2DCoords(mol)\nrdDepictor.StraightenDepiction(mol)\nrdDepictor.NormalizeDepiction(mol)      # uniform median bond length\n```\n\n```python\n# Align a series to a shared scaffold so the core is drawn identically each time\ntemplate = Chem.MolFromSmiles(\"c1ccc(cc1)S(=O)(=O)N\")\nrdDepictor.Compute2DCoords(template)\nfor m in [Chem.MolFromSmiles(s) for s in [\"Cc1ccc(cc1)S(=O)(=O)N\", \"Clc1ccc(cc1)S(=O)(=O)N\"]]:\n    rdDepictor.GenerateDepictionMatching2DStructure(m, template)\n```\n\n### Module 5: Drawing arrows\n\nA reaction arrow is an `\u003Carrow>` with `Head3D`\u002F`Tail3D` (`\"x y z\"`, y increases downward). `ArrowheadHead`\u002F`ArrowheadType` style the head. Equilibrium\u002Fresonance\u002Fretrosynthetic arrows use a `\u003Cgraphic>` Line with `ArrowType`.\n\n```python\nimport xml.etree.ElementTree as ET\n\ndef make_arrow(arrow_id, tail_xy, head_xy):\n    (tx, ty), (hx, hy) = tail_xy, head_xy\n    return ET.Element(\"arrow\", {\n        \"id\": str(arrow_id), \"FillType\": \"None\", \"ArrowheadType\": \"Solid\",\n        \"ArrowheadHead\": \"Full\", \"HeadSize\": \"2250\",\n        \"BoundingBox\": f\"{min(tx,hx)} {min(ty,hy)-4} {max(tx,hx)} {max(ty,hy)+4}\",\n        \"Head3D\": f\"{hx} {hy} 0\", \"Tail3D\": f\"{tx} {ty} 0\"})\n\nprint(ET.tostring(make_arrow(40, (160, 100), (210, 100)), encoding=\"unicode\"))\nequil = ET.Element(\"graphic\", {\"id\": \"41\", \"GraphicType\": \"Line\",\n                               \"ArrowType\": \"Equilibrium\", \"BoundingBox\": \"160 100 210 100\"})\n```\n\n### Module 6: Reaction schemes and steps\n\nA `\u003Cscheme>` groups `\u003Cstep>` objects that reference page objects **by id**: `ReactionStepReactants`, `ReactionStepProducts`, `ReactionStepArrows`, `ReactionStepPlusses`, and objects above\u002Fbelow the arrow.\n\n```python\nimport xml.etree.ElementTree as ET\n\ndef make_plus(gid, x, y):\n    return ET.Element(\"graphic\", {\"id\": str(gid), \"GraphicType\": \"Symbol\",\n                                  \"SymbolType\": \"Plus\", \"BoundingBox\": f\"{x} {y-7} {x+15} {y+8}\"})\n\nscheme = ET.Element(\"scheme\", {\"id\": \"60\"})\nET.SubElement(scheme, \"step\", {\"id\": \"61\", \"ReactionStepReactants\": \"10 20\",\n    \"ReactionStepProducts\": \"50\", \"ReactionStepArrows\": \"40\",\n    \"ReactionStepPlusses\": \"30\", \"ReactionStepObjectsAboveArrow\": \"70\"})\nprint(ET.tostring(scheme, encoding=\"unicode\"))\n```\n\n### Module 7: Adding text and labels\n\nFree text is a `\u003Ct>` at `p=\"x y\"` holding one or more `\u003Cs>` styled-string children. `\u003Cs>` references a `font` id (`\u003Cfonttable>`) and `color` index (`\u003Ccolortable>`); `face` is a bitmask (1=bold, 2=italic, 32=subscript, 64=superscript). Split a `\u003Ct>` into multiple `\u003Cs>` runs for subscripts (`Br₂`, `CO₂H`). Indigo renders **subscript (32) but not superscript (64)** — it drops the run's leading text — so keep charges inline (`H+`, `OH-`). `°C` (temperatures) and `Δ` (heat) render with the Arial font; avoid other non-Latin-1 characters (`hν`, en-dashes).\n\n```python\nimport xml.etree.ElementTree as ET\n\ndef make_text(tid, x, y, runs, font_id=21, size=10):\n    \"\"\"runs: list of (text, face). face 0=normal, 1=bold, 32=subscript, 64=superscript.\"\"\"\n    t = ET.Element(\"t\", {\"id\": str(tid), \"p\": f\"{x} {y}\"})\n    for text, face in runs:\n        ET.SubElement(t, \"s\", {\"font\": str(font_id), \"size\": str(size),\n                               \"color\": \"0\", \"face\": str(face)}).text = text\n    return t\n\nprint(ET.tostring(make_text(70, 175, 92, [(\"reflux, 2 h\", 0)]), encoding=\"unicode\"))\nprint(ET.tostring(make_text(80, 158, 135, [(\"Br\", 0), (\"2\", 32), (\" (excess)\", 0)]),\n                  encoding=\"unicode\"))   # Br\u003Csub>2\u003C\u002Fsub> (excess)\n```\n\n### Module 8: Editing an existing CDXML file\n\n`ElementTree` round-trips arrows, text, and graphics it does not understand, so you can edit a real ChemDraw file without losing objects — unlike an RDKit Mol round-trip.\n\n```python\nimport xml.etree.ElementTree as ET\n\ntree = ET.parse(\"reaction.cdxml\")          # DOCTYPE is dropped on re-save (harmless)\nroot = tree.getroot()\nfor s in root.iter(\"s\"):                   # relabel \"Cl\" -> \"Br\"\n    if s.text == \"Cl\":\n        s.text = \"Br\"\ncap = ET.SubElement(root.find(\"page\"), \"t\", {\"p\": \"100 300\"})\nET.SubElement(cap, \"s\", {\"font\": \"21\", \"size\": \"12\", \"color\": \"0\"}).text = \"Scheme 1\"\ntree.write(\"reaction_edited.cdxml\", encoding=\"unicode\", xml_declaration=True)\n```\n\n### Module 9: Rendering CDXML to PNG\n\nRender the PNG next to the CDXML (same basename), look at it, then deliver both. [Indigo](https:\u002F\u002Flifescience.opensource.epam.com\u002Findigo\u002F) (`epam.indigo`) loads a CDXML — a scheme with arrows as a *reaction*, a lone structure as a *molecule* — and rasterizes arrows, text, and layout faithfully. (RDKit's own `Draw.ReactionToImage` re-lays-out molecules and drops the ChemDraw arrows\u002Ftext, so use Indigo to render a file as authored.)\n\n```python\nfrom pathlib import Path\nfrom indigo import Indigo\nfrom indigo.renderer import IndigoRenderer\n\ndef render_cdxml(cdxml_path, png_path=None, width=1600):\n    png_path = png_path or str(Path(cdxml_path).with_suffix(\".png\"))\n    ind = Indigo(); rnd = IndigoRenderer(ind)\n    ind.setOption(\"render-output-format\", \"png\")\n    ind.setOption(\"render-background-color\", \"1,1,1\")\n    ind.setOption(\"render-image-width\", width)\n    cdxml = open(cdxml_path, encoding=\"utf-8\").read()\n    try:\n        obj = ind.loadReaction(cdxml)   # scheme with arrows\n    except Exception:\n        obj = ind.loadMolecule(cdxml)   # single structure\n    rnd.renderToFile(obj, png_path)\n    return png_path\n\nprint(\"Wrote\", render_cdxml(\"scheme.cdxml\"))\n```\n\n## Key Concepts\n\n### CDXML coordinate system\n\n**y increases downward** (origin top-left). Atoms: `p=\"x y\"`; arrows: `Head3D`\u002F`Tail3D=\"x y z\"`; graphics\u002Ftext: `BoundingBox=\"x1 y1 x2 y2\"`. Default bond length ≈ 30.\n\n```python\ndef shift_fragment(frag, dx, dy):      # move a fragment onto the canvas\n    for n in frag.iter(\"n\"):\n        x, y = map(float, n.get(\"p\").split())\n        n.set(\"p\", f\"{x+dx} {y+dy}\")\n    return frag\n```\n\n### Object-id reference model\n\nEvery object has a unique integer `id`; reactions and groups reference members **by id**, not by nesting. When merging fragments from separate RDKit outputs (each starts ids at 1), renumber all ids to stay globally unique, then wire `\u003Cstep>` to the new ids.\n\n### RDKit vs XML capability boundary\n\n| Task | RDKit `rdChemDraw` | Direct XML |\n|------|--------------------|-----------|\n| Read molecules \u002F reactions | ✅ | — |\n| Write molecule structure | ✅ (CDXML) | — |\n| Write arrows \u002F plus \u002F scheme \u002F text | ❌ | ✅ |\n| Preserve objects while editing | ❌ (drops on Mol round-trip) | ✅ |\n\n## Common Workflows\n\n### Workflow 1: SMILES → single-molecule CDXML\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdDepictor\n\ndef smiles_to_cdxml(smiles, path):\n    mol = Chem.MolFromSmiles(smiles)\n    if mol is None:\n        raise ValueError(f\"Invalid SMILES: {smiles}\")\n    rdDepictor.SetPreferCoordGen(True)\n    rdDepictor.Compute2DCoords(mol)\n    rdDepictor.StraightenDepiction(mol)\n    open(path, \"w\", encoding=\"utf-8\").write(rdChemDraw.MolToChemDrawBlock(mol))\n    return path\n\nprint(\"Wrote\", smiles_to_cdxml(\"CC(=O)Oc1ccccc1C(=O)O\", \"aspirin.cdxml\"))\n```\n\n### Workflow 2: Hand-assemble a reaction from Modules 5-7\n\nCombine `_fragment_of` (write a mol, extract `\u003Cfragment>`, renumber ids, shift x) with an arrow, a plus, conditions text, and a `\u003Cstep>`. Render with Module 9. For multi-step schemes prefer Workflow 4.\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdDepictor, rdChemReactions\nimport xml.etree.ElementTree as ET\n\ndef _fragment_of(smiles, base_id, dx):\n    m = Chem.MolFromSmiles(smiles); rdDepictor.Compute2DCoords(m)\n    frag = ET.fromstring(rdChemDraw.MolToChemDrawBlock(m)).find(\"page\u002Ffragment\")\n    remap = {}\n    for i, el in enumerate([frag, *frag.iter(\"n\"), *frag.iter(\"b\")]):\n        remap[el.get(\"id\")] = str(base_id + i); el.set(\"id\", remap[el.get(\"id\")])\n    for b in frag.iter(\"b\"):\n        b.set(\"B\", remap[b.get(\"B\")]); b.set(\"E\", remap[b.get(\"E\")])\n    for n in frag.iter(\"n\"):\n        x, y = map(float, n.get(\"p\").split()); n.set(\"p\", f\"{x+dx} {y}\")\n    return frag\n\nroot = ET.Element(\"CDXML\", {\"BondLength\": \"30\"}); page = ET.SubElement(root, \"page\")\npage.append(_fragment_of(\"CCO\", 100, 0))\nET.SubElement(page, \"graphic\", {\"id\": \"30\", \"GraphicType\": \"Symbol\",\n                                \"SymbolType\": \"Plus\", \"BoundingBox\": \"60 -7 75 8\"})\npage.append(_fragment_of(\"CC(=O)O\", 200, 120))\nET.SubElement(page, \"arrow\", {\"id\": \"40\", \"FillType\": \"None\", \"ArrowheadHead\": \"Full\",\n    \"ArrowheadType\": \"Solid\", \"HeadSize\": \"2250\", \"Head3D\": \"320 3 0\", \"Tail3D\": \"260 3 0\"})\ncond = ET.SubElement(page, \"t\", {\"id\": \"70\", \"p\": \"270 -12\"})\nET.SubElement(cond, \"s\", {\"font\": \"21\", \"size\": \"9\", \"color\": \"0\"}).text = \"H+, reflux\"\npage.append(_fragment_of(\"CCOC(C)=O\", 300, 420))\nscheme = ET.SubElement(page, \"scheme\", {\"id\": \"60\"})\nET.SubElement(scheme, \"step\", {\"id\": \"61\", \"ReactionStepReactants\": \"100 200\",\n    \"ReactionStepProducts\": \"300\", \"ReactionStepArrows\": \"40\", \"ReactionStepPlusses\": \"30\"})\nET.SubElement(ET.SubElement(root, \"fonttable\"), \"font\",\n              {\"id\": \"21\", \"charset\": \"x-mac-roman\", \"name\": \"Helvetica\"})\n\ncdxml = ET.tostring(root, encoding=\"unicode\")\nopen(\"esterification.cdxml\", \"w\", encoding=\"utf-8\").write(cdxml)\nprint(\"reactions re-parsed:\", len(rdChemReactions.ReactionsFromCDXMLBlock(cdxml, sanitize=True)))\n```\n\n### Workflow 3: Edit an existing file, preserving arrows and text\n\n```python\nimport xml.etree.ElementTree as ET\n\ntree = ET.parse(\"input_reaction.cdxml\"); root = tree.getroot()\ntitle = ET.SubElement(root.find(\"page\"), \"t\", {\"p\": \"50 -30\"})\nET.SubElement(title, \"s\", {\"font\": \"21\", \"size\": \"14\", \"color\": \"0\", \"face\": \"1\"}).text = \"Route A\"\nfor arrow in root.iter(\"arrow\"):\n    arrow.set(\"HeadSize\", \"3000\")\ntree.write(\"output_reaction.cdxml\", encoding=\"unicode\", xml_declaration=True)\n```\n\n### Workflow 4: Multi-step scheme with the bundled helper (recommended)\n\n`scripts\u002Fbuild_reaction_scheme.py` turns `(smiles, name, conditions)` steps into a laid-out scheme **and its PNG in one call**, handling grid layout, globally unique ids, single arrows, and conditions text placed clear of structures — the defects that recur when schemes are hand-built. Cells auto-size to the largest structure, so big molecules never overlap. Model convergent\u002Fmulti-component steps by folding co-reactants into `conditions` (e.g. `[\"+ (MeO2C)2C=CHOMe\", \"Base, MeCN\"]`), keeping one main-chain structure per cell.\n\n**Copy the scripts into your working directory with your file tools — not from Python.** Inside the execution sandbox the `\u002FSciAgent-Skills\u002F...` path is reachable **only through your read-file tool**; it is not on the sandbox filesystem, so a Python `open()` or `import` of that path fails with `FileNotFoundError`\u002F`ModuleNotFoundError`. For each of `build_reaction_scheme.py` and `check_scheme.py` (each is self-contained — rdkit + epam.indigo only — copy just what you need):\n\n1. **Read-file tool** on `\u002FSciAgent-Skills\u002Fskills\u002Fstructural-biology-drug-discovery\u002Frdkit-chemdraw-cdxml\u002Fscripts\u002F\u003Cname>` (the leading slash routes to the skills backend) → returns the script text.\n2. **Write-file tool** → save it to `.\u002F\u003Cname>` in the working directory.\n\nThen import the local copies. (Importing writes a harmless `__pycache__\u002F`; set `PYTHONDONTWRITEBYTECODE=1` to suppress it.)\n\n```python\nfrom build_reaction_scheme import build_scheme    # local copies, already in the workdir\nfrom check_scheme import check_all\n\nsteps = [\n    {\"smiles\": \"O=C1CCCC1\", \"name\": \"cyclopentanone\"},\n    {\"smiles\": \"O=C1C(Br)C(Br)C(Br)C1Br\", \"name\": \"tetrabromoketone\",\n     \"conditions\": [\"Br2 (excess)\", \"AcOH, 25 C\"]},          # reagents for the arrow into this step\n    {\"smiles\": \"O=C1C=CC=C1Br\", \"name\": \"2-bromocyclopentadienone\",\n     \"conditions\": [\"Et2NH\", \"cold Et2O\"]},\n    {\"smiles\": \"C12C3C4C1C5C2C3C45\", \"name\": \"cubane\", \"conditions\": [\"(remaining steps)\"]},\n]\ncdxml, png = build_scheme(steps, \"cubane.cdxml\", title=\"Total Synthesis of Cubane\", cols=4)\ncheck_all(\"cubane.cdxml\", expect={3: \"C12C3C4C1C5C2C3C45\"})   # validate before delivering\nprint(f\"Deliverables: {cdxml} + {png}\")\n```\n\n## Key Parameters\n\n| Parameter | Module \u002F Function | Default | Options | Effect |\n|-----------|-------------------|---------|---------|--------|\n| `format` | `MolToChemDrawBlock` | `CDXFormat.CDXML` | `CDXML`, `CDX` | Use CDXML (str); for CDX bytes use legacy `MolToCDXMLBlock` |\n| `sanitize` | `MolsFromChemDrawBlock` | `True` | `True`\u002F`False` | `False` to inspect raw\u002Finvalid input |\n| `sanitize` | `ReactionsFromChemDrawBlock` | `False` | `True`\u002F`False` | Defaults **False** — pass `True` for clean SMILES |\n| `SetPreferCoordGen` | `rdDepictor` | `False` | `True`\u002F`False` | `True` gives more natural 2D layouts |\n| `ArrowheadHead` | `\u003Carrow>` XML | — | `Full`, `HalfLeft`, `HalfRight`, `None` | Arrowhead style |\n| `ArrowType` | `\u003Cgraphic>` Line | — | `FullHead`, `Equilibrium`, `Resonance`, `RetroSynthetic`, `NoGo` | Special arrow semantics |\n| `BondLength` | `\u003CCDXML>` root | `\"\"` (RDKit) | numeric, e.g. `30` | Canvas scale; set a number so structures\u002Farrows scale together |\n\n## Best Practices\n\n1. **Compute 2D coordinates before writing** (`SetPreferCoordGen(True)` then `Compute2DCoords`); a molecule without coordinates writes as a degenerate layout.\n2. **Never round-trip a reaction through a Mol if you need the drawing** — reading drops arrows, plus signs, text, and graphics. Edit reaction files on the XML tree (Module 8).\n3. **Keep object ids globally unique.** Merging RDKit outputs (each starts at 1) collides and breaks `\u003Cstep>` references and doubles arrows; renumber into disjoint blocks.\n4. **Prefer CDXML (text) over CDX (binary).** CDX write via `rdChemDraw` raises `UnicodeDecodeError`; only legacy `Chem.MolToCDXMLBlock(mol, CDXMLFormat.CDX)` returns valid CDX bytes.\n5. **Write a complete document header** — `\u003CCDXML BondLength=...>` plus a standard `\u003Cfonttable>`\u002F`\u003Ccolortable>` and page dimensions. See `references\u002Fcdxml-schema-reference.md`.\n6. **Text**: use `°C` for temperatures and `Δ` for heat (both render); keep charges inline (`H+`, `OH-`) since Indigo has no superscript; avoid other non-Latin-1 characters. Render heteroatoms via `\u003Cn Element=...>`, not free `\u003Ct>` text; don't add decorative flags (\"Chiral\"\u002F\"racemic\") — use wedge bonds. Keep labels clear of the arrow line: names under the structure, conditions offset above\u002Fbeside the arrow. (`build_scheme` does all of this — `0 C`→`0 °C`, `heat`→`Δ`, subscripts, spacing — automatically.)\n7. **Deliver the CDXML and PNG together, and run `check_scheme.check_all` first.** The render and the critic catch overlaps, duplicate\u002Fdegenerate arrows, dropped intermediates, and connectivity errors before the user sees them.\n\n## Common Recipes\n\n### Recipe: Batch SMILES → CDXML files\n\n```python\nfrom rdkit import Chem\nfrom rdkit.Chem import rdChemDraw, rdDepictor\nfrom pathlib import Path\n\nrdDepictor.SetPreferCoordGen(True); Path(\"out\").mkdir(exist_ok=True)\nfor i, smi in enumerate([\"CCO\", \"c1ccccc1\", \"CC(=O)O\"]):\n    m = Chem.MolFromSmiles(smi); rdDepictor.Compute2DCoords(m)\n    Path(f\"out\u002Fmol_{i}.cdxml\").write_text(rdChemDraw.MolToChemDrawBlock(m), encoding=\"utf-8\")\n```\n\n### Recipe: Pretty-print CDXML for inspection\n\n```python\nimport xml.dom.minidom as minidom\nprint(minidom.parseString(open(\"esterification.cdxml\", encoding=\"utf-8\").read())\n      .toprettyxml(indent=\"  \")[:1500])\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| Exception on `MolToChemDrawBlock` | RDKit built without ChemDraw support | Check `Chem.HasChemDrawCDXSupport()`; install a build with the Revvity parser |\n| `UnicodeDecodeError` writing CDX | `rdChemDraw` CDX path is broken | Use legacy `Chem.MolToCDXMLBlock(mol, CDXMLFormat.CDX)`, or write CDXML |\n| Structure written flat\u002Foverlapping | No 2D coordinates | Call `rdDepictor.Compute2DCoords(mol)` before writing |\n| Edited reaction lost arrows\u002Ftext | File round-tripped through a Mol | Edit the XML tree (`ElementTree`); RDKit writes structures only |\n| Reaction won't re-parse | `\u003Cstep>` references missing ids (collision after merge) | Renumber fragment ids globally unique; update `ReactionStep*` |\n| Structures\u002Farrows mismatched size | `\u003CCDXML BondLength=\"\">` empty | Set a numeric `BondLength` (e.g. `30`) on the root |\n| `mols` tuple empty on read | Wrong format, or unsanitizable structure | Retry with `sanitize=False`; confirm the file is genuine CDX\u002FCDXML |\n| Doubled labels (\"OO\", \"BrBr\") | Free-text `\u003Ct>` on top of `Element` nodes | Remove the free labels; let `\u003Cn Element=...>` render the symbol |\n| Stray line crosses a structure | Duplicate or degenerate `\u003Carrow>` | Run `check_scheme`; unique id + real length (`Head3D`≠`Tail3D`) per arrow |\n| Conditions text overlaps a structure | Text placed on the structure, not over the arrow gap | Center conditions over the arrow midpoint; widen structure spacing |\n| Text renders wrong\u002Fblank | non-ASCII, or `\u003Cs font>` id missing from `\u003Cfonttable>` | Keep text ASCII; reference an existing `font id` |\n| No PNG \u002F render error | `epam.indigo` missing, or loaded as molecule when it has arrows | `pip install epam.indigo`; try `loadReaction` before `loadMolecule` |\n| \"Chiral\"\u002F\"racemic\" printed above structures | Decorative flag text added as `\u003Ct>` | Remove it — stereochemistry is shown by wedge bonds; `check_scheme` flags it |\n| A name or label sits on an arrow | Text placed on the arrow line | Names go under the structure, conditions offset above\u002Fbeside the arrow; `check_scheme` flags text on an arrow |\n| `stoi: no conversion` loading in Indigo | `\u003CCDXML BondLength=\"\">` empty | Set a numeric `BondLength` (e.g. `30`) before rendering |\n| `ModuleNotFoundError`\u002F`FileNotFoundError` on a helper script | `import`ed or `open()`ed the `\u002FSciAgent-Skills\u002F...` path from Python | That path is reachable only via the read-file tool, not the sandbox filesystem — copy the script into the workdir first (Workflow 4), then import |\n| `import indigo` fails after a \"successful\" `pip install` | pip installed into a different Python than the runtime (system `\u002Fusr\u002Flocal` vs the pixi\u002Fkernel env) | Install into the running interpreter (`%pip install` or `python -m pip install`), or `pixi add epam.indigo`; don't shell out to a different `python` |\n| A charge (`H+`) renders as a giant `+` | Indigo draws a standalone `+` as a reaction-plus symbol, and superscript (face 64) mangles ion text | Keep charges inline (`H+`, `OH-`), face 0 — a true raised superscript is not achievable in the Indigo preview. Subscripts (face 32) and `°C`\u002F`Δ` render fine |\n\n## Bundled Resources\n\nThe `scripts\u002F` files can be read from the skill path but **not imported from there** — copy the one you need into your working directory (`read_file` it, write locally), then `import` or run it (see Workflow 4 for the exact copy snippet). Each is self-contained and depends only on rdkit (+ epam.indigo).\n\n- `references\u002Fcdxml-schema-reference.md` — element\u002Fattribute cheat-sheet (`n`, `b`, `arrow`, `graphic`, `step`\u002F`scheme`, `t`\u002F`s`, `fonttable`, `colortable`), coordinate conventions, enum tables, and a copy-paste document header.\n- `scripts\u002Fbuild_reaction_scheme.py` — assemble a multi-step scheme from `(smiles, name, conditions)` steps and render the PNG in one call; auto-sizes cells so structures never overlap. Library (`build_scheme(...)`) or CLI (`python build_reaction_scheme.py steps.json out.cdxml out.png \"Title\"`).\n- `scripts\u002Fcheck_scheme.py` — pre-delivery validator\u002Fcritic. `check_all(path, expect=..., perspective_ids=...)` rebuilds each molecule from the drawing, sanitizes, prints formulas for a mass-balance check, and flags duplicate ids, fragment overlaps, degenerate arrows, non-ASCII text, decorative flag words (\"Chiral\"), and labels sitting on an arrow line.\n\n## Related Skills\n\n- **rdkit-cheminformatics** — descriptors, fingerprints, SMARTS; analysis once molecules are parsed\n- **datamol-cheminformatics** — higher-level RDKit wrapper for batch standardization before drawing\n- **openbabel** — multi-format 2D\u002F3D conversion when you need formats beyond ChemDraw\n\n## References\n\n- [RDKit `rdkit.Chem.rdChemDraw`](https:\u002F\u002Fwww.rdkit.org\u002Fdocs\u002Fsource\u002Frdkit.Chem.rdChemDraw.html) — `MolsFromChemDraw*`, `ReactionsFromChemDraw*`, `MolToChemDrawBlock`, `CDXFormat`\n- [RDKit depiction docs](https:\u002F\u002Fwww.rdkit.org\u002Fdocs\u002Fsource\u002Frdkit.Chem.Draw.rdMolDraw2D.html) — 2D coordinates and CoordGen\n- [CDX\u002FCDXML format specification (CambridgeSoft SDK mirror)](https:\u002F\u002Fchemapps.stolaf.edu\u002Fiupac\u002Fcdx\u002Fsdk\u002F) — arrows, graphics, reactions, text\n- [RDKit CDXML test fixtures](https:\u002F\u002Fgithub.com\u002Frdkit\u002Frdkit\u002Ftree\u002Fmaster\u002FCode\u002FGraphMol\u002Ftest_data\u002FCDXML) — real ChemDraw-authored `.cdxml`\n- [Indigo toolkit (`epam.indigo`)](https:\u002F\u002Flifescience.opensource.epam.com\u002Findigo\u002F) — CDXML loading and PNG rendering\n",{"name":5,"license":15,"description":7},"master","63f17866001c5ca854bf2fa0b678ce277133de5b","skills\u002Fawesome-skills\u002Frdkit-chemdraw-cdxml",0,"https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS","https:\u002F\u002Fbg-szy.github.io\u002FTOP-SKILLS\u002F","https:\u002F\u002Fgithub.com\u002Fbg-szy","https:\u002F\u002Fwww.ecust.edu.cn\u002F","a student of East China University of Science and Technology","2026-11-15 03:38:02",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add bg-szy\u002FTOP-SKILLS --skill rdkit-chemdraw-cdxml",{"tool":40,"command":41},"bunx","bunx skills add bg-szy\u002FTOP-SKILLS --skill rdkit-chemdraw-cdxml",{"tool":43,"command":44},"pnpm","pnpm dlx skills add bg-szy\u002FTOP-SKILLS --skill rdkit-chemdraw-cdxml","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Frdkit-chemdraw-cdxml\u002FSKILL.md",true,[],[49,58,65,72,79,86],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":57},"01M7DXW9N826PKXK174PVW3038","serpmaven","Scrape Google search results (SERP) to JSON with SERP Maven (serpmaven) - a real Chrome browser on a residential proxy with sticky sessions. Run it as a CLI, a Python library, a local HTTP search API (`serve`), an MCP server or a Docker image; set the proxy login, workers, pages and cost tracking. Use when the user wants Google results, rank tracking, a self-hosted SERP API, or live Google search for an AI agent.","MIT","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fserpmaven\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":57},"01M7DXVHSTWDV65475QEQ915M7","revnu-landing-page-audit","Find out why a landing page isn't turning visitors into signups, demos or sales. Audits one page against what the ad, post or search that sends people there promised, then checks the first screen, proof, call to action, friction and mobile. Returns at most 7 prioritized fixes, plus what is fine and what could not be checked; rewrites specific lines and fixes the page in the repo when asked. Never promises a conversion lift. Works without a Revnu account. Use when the user says or asks: \"audit my landing page\", \"why isn't this page converting\", \"review my homepage\", \"my ads get clicks but no signups\", \"people bounce from the pricing page\", \"CRO review\", \"improve conversion rate\", \"is my hero section clear\", \"roast my landing page\", \"rewrite my headline\", \"what's wrong with this page\", \"landing page feedback\", \"make the signup page convert better\". Not for SEO or AI-search audits, page speed engineering on its own, or building a new page from scratch.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-landing-page-audit\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":57},"01M7DXV8X2D7B3VTD4HHYYHTGR","revnu-growth-context","Write down once who buys, what they're stuck on, what it costs, what proof you have and what you've already tried, so every growth task starts from facts instead of a questionnaire. Creates or updates .agents\u002Frevnu-growth.md from the repo, the live site and the user, and imports an existing product-marketing.md. Use when the user says \"set up our marketing context\", \"who is our ideal customer\", \"write our ICP\", \"describe the product for marketing\", \"positioning doc\", \"what's our brand voice\", \"remember this about our customers\", \"log what we tried\", \"what have we learned from marketing\", \"we changed pricing, update the context\", \"update our growth notes\", \"summarize the business for the agent\", \"import my product-marketing.md\", \"start a growth doc\", or before a first marketing, SEO, outreach or launch task when no context file exists. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-growth-context\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":57},"01M7DXV0DGJ1G0A60PAHC6J3C5","revnu-get-listed","Get onto the third-party pages AI answers and search cite when buyers ask for the best tool in your category: \"best X\" roundups, directories, review sites, GitHub awesome lists, community threads and comparison pages. Finds which ones are cited, ranks them by fit and effort, and drafts each submission, PR or pitch by the target's own rules. Use when the user says \"get us listed\", \"which directories should we submit to\", \"how do we get into best-of lists\", \"why does ChatGPT recommend competitors and not us\", \"get mentioned in AI answers\", \"submit to awesome lists\", \"get on G2\", \"where are our competitors listed\", \"pitch listicle authors\", \"find backlink opportunities\", \"launch directories\", \"get into roundups\", \"Product Hunt alternatives\", \"where should we be listed\", \"get cited by Perplexity\". Never submits, pays or posts without a yes. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-get-listed\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":57},"01M7DXTSPMGT9D6DSS0HP9BSTA","revnu-ai-readiness-audit","Audit whether your website gives ChatGPT, Perplexity, Claude, Gemini and Google's AI Overviews something worth quoting, and fix the pages that don't. Use when the user says or asks \"is my site ready for AI search\", \"audit my site for AI answers\", \"AEO audit\", \"GEO audit\", \"why doesn't ChatGPT quote our pricing\", \"make our pages citable by AI\", \"do I need llms.txt\", \"does schema help with ChatGPT\", \"check our structured data\", \"is our content visible without JavaScript\", \"AI SEO audit\", \"optimize our homepage for AI answers\", \"LLM SEO check\", \"why does AI get our product wrong\", \"fix our site for AI Overviews\". Checks fetchability and indexability, answers in the raw HTML, entity facts, schema (including JS-injected markup), headings, dates and llms.txt, then gives at most 10 prioritised fixes and edits the repo when asked. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-ai-readiness-audit\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":57},"01M7DXSZHCVTRS620GC3S97JZV","proxy-troubleshooting","Diagnose residential proxy failures, with NodeMaven's gateway as the reference - 407 with correct credentials, 406, 410, 500, a connection that hangs, ERR_TUNNEL_CONNECTION_FAILED in a browser, Playwright or Puppeteer ignoring proxy credentials, a sticky session that changes IP, geo-targeting that is silently ignored, passwords with special characters, and unexpected traffic from headless Chrome. Use when a proxy connection fails, returns the wrong location, or costs more traffic than expected.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fproxy-troubleshooting\u002FSKILL.md",[],[]]