bio-retrosynthesis
Performs retrosynthetic planning using AiZynthFinder (MCTS, template-based), Chemformer (template-free transformer), ASKCOS, and emerging RetroSynFormer with explicit handling of route scoring, building-block availability (eMolecules, Enamine, Mcule), forward prediction validation (Molecular Transformer), and disconnection-aware multi-objective search (MO-MCTS). Use when assessing synthetic feasibility of generated or selected molecules, planning multi-step syntheses, building synthesis-aware design pipelines, or screening libraries for retro-route feasibility.
What this skill does
## Version Compatibility
Reference examples tested with: AiZynthFinder 4.4+, Chemformer 1.3+, RDKit 2024.09+, RDChiral 1.1+, Aizynthtrain 1.0+, ASKCOS Lite 0.5+.
Before using code patterns, verify installed versions match. If versions differ:
- Python: `pip show <package>` then `help(module.function)` to check signatures
- CLI: `aizynthcli --version`
If code throws ImportError, AttributeError, or TypeError, introspect the installed
package and adapt the example to match the actual API rather than retrying.
# Retrosynthesis
Plan synthetic routes from a target molecule back to commercially-available building blocks. AiZynthFinder 4.0 (Saigiridharan, Hassen, Lai, Torren-Peraire, Engkvist, Genheden 2024 *J Cheminform* 16:57, AstraZeneca) is the open-source production-grade tool: Monte Carlo Tree Search (MCTS) + template-based expansion + multi-objective scoring (MO-MCTS). Chemformer (Irwin 2022) is template-free transformer alternative. ASKCOS (MIT) is the academic reference. Modern best practice combines retrosynthesis with **forward validation** (the predicted route should also predict the target from starting materials via Molecular Transformer) and building-block availability (eMolecules, Enamine, Mcule, ZINC catalog).
For generative design pipelines that need synthetic feasibility, see `chemoinformatics/generative-design`. For reaction enumeration (forward direction), see `chemoinformatics/reaction-enumeration`.
## Retrosynthesis Method Taxonomy
| Tool | Approach | Strength | Fails when |
|------|----------|----------|------------|
| AiZynthFinder 4.0 | Template-based MCTS | Open, scalable, well-validated | Beyond template coverage |
| Chemformer | Template-free transformer | Novel disconnections | Less interpretable; harder to debug |
| ASKCOS | Template-based + neural | MIT-quality academic standard | Setup complexity |
| Molecular Transformer | Forward + retro transformer | Single SMILES-to-SMILES | Less robust to non-training distribution |
| RetroSynFormer | Decision transformer | Modern method | Limited adoption |
| IBM RXN | Cloud service | High quality, easy interface | API access required |
| BKMS_MTHRO / RetroPath | Pathway-based | Metabolic / biochemical | Not for general medchem |
| SyntheMol (StanfordGarbage) | Specialized for medchem | Public domain alternative | Limited tooling |
**Decision:** For most users, **AiZynthFinder 4.4 with USPTO + USPTO-50k templates** is the open-source standard. For high-stakes routes, validate with Molecular Transformer forward prediction.
## Decision Tree by Scenario
| Scenario | Tool | Notes |
|----------|------|-------|
| Standard medchem target | AiZynthFinder default templates | USPTO/Reaxys templates |
| Novel chemotype | AiZynthFinder + Chemformer template-free fallback | Combine both |
| Generated molecules (REINVENT output) | AiZynthFinder batch | Filter to feasible routes |
| Multi-step synthesis planning | AiZynthFinder + manual review | Top-K routes |
| Validate generated route | Molecular Transformer forward | Check round-trip |
| Cost-aware synthesis | AiZynthFinder + custom building-block pricing | Score weight |
| Disconnection-aware design (DAD) | AiZynthFinder MO-MCTS | Multi-objective |
| Patent-aware routes | Custom template exclusion | Specialized |
## AiZynthFinder Setup
**Goal:** Configure AiZynthFinder with USPTO templates + a building-block stock and run MCTS retrosynthesis planning on a target SMILES.
**Approach:** Build a configuration dict pointing to policy templates (ONNX + CSV) and a stock H5, instantiate `AiZynthFinder`, set the target SMILES, then call `tree_search()` followed by `build_routes()`.
```python
from aizynthfinder.aizynthfinder import AiZynthFinder
config_dict = {
'policy': {
'files': {
'uspto': ['policy/uspto_model.onnx', 'templates/uspto_templates.csv'],
}
},
'stock': {
'files': {
'zinc': 'stock/zinc.h5',
}
},
'finder': {
'algorithm': 'mcts',
'iteration_limit': 100,
'time_limit': 120,
}
}
finder = AiZynthFinder(configdict=config_dict)
finder.target_smiles = 'CC(=O)Nc1ccc(C(=O)Nc2cccc(C(F)(F)F)c2)cc1'
finder.tree_search()
finder.build_routes()
```
Output: list of routes, each with depth, building blocks, score, leaf nodes.
## Route Output Analysis
```python
for route in finder.routes:
print(f'Depth: {route.depth}, Score: {route.score:.2f}')
print(f'In-stock: {sum(node.in_stock for node in route.leafs())}')
print(f'Building blocks: {[node.smiles for node in route.leafs()]}')
```
Critical metrics:
- **Depth**: number of synthetic steps. 1-3 typical for medchem.
- **Score**: AiZynthFinder route score (0-1, higher = better)
- **In-stock**: how many leaf nodes are commercially available
- **Stock origin**: ZINC, Enamine, Mcule, eMolecules
## Route Scoring (MO-MCTS)
AiZynthFinder 4.0 supports multi-objective scoring (Saigiridharan et al 2024 *J Cheminform* 16:57):
```python
config_dict['finder']['algorithm'] = 'mo_mcts'
config_dict['finder']['mo_mcts'] = {
'objectives': [
{'name': 'state_score', 'weight': 0.5}, # default state score
{'name': 'broken_bonds_score', 'weight': 0.3}, # complexity reduction
{'name': 'route_length', 'weight': 0.2, 'maximize': False}, # shorter
]
}
```
State score: probability the current state can be solved. Broken bonds: each step should reduce molecular complexity. Route length: shorter is better.
## Building Block Stocks
| Stock | Compounds | Source | Cost-tier |
|-------|-----------|--------|-----------|
| ZINC clean leads | 250k | ZINC22 catalog | Various commercial |
| Enamine Building Blocks | 200k+ | Enamine | $$ |
| Enamine REAL | 29B (make-on-demand) | Enamine | $$$ |
| Mcule | 25M | Mcule | $$ |
| eMolecules | 16M | eMolecules | $$ |
| ChemBridge | 1M | ChemBridge | $$ |
AiZynthFinder accepts stocks as HDF5 (built via `aizynthtrain`):
```bash
aizynthtrain build-stock --input zinc_building_blocks.smi --output zinc.h5
```
## Forward Validation with Molecular Transformer
AiZynthFinder predicts retrosynthesis (target -> precursors); Molecular Transformer predicts forward (precursors -> product). Validating the round-trip:
```python
from molecular_transformer import predict_forward
precursors = route.leafs() # building blocks from retro
predicted_product = predict_forward(precursors)
match = (Chem.CanonSmiles(predicted_product) ==
Chem.CanonSmiles(finder.target_smiles))
```
Routes where the forward prediction reproduces the target are highest confidence. ~30-50% of AiZynthFinder routes pass forward validation (Saigiridharan, Genheden et al 2024 *J Cheminform* 16:57).
## Template-Free with Chemformer
Chemformer uses a Transformer (BART) trained on USPTO reactions for SMILES-to-SMILES:
```python
from chemformer import Chemformer
cf = Chemformer.load_pretrained('USPTO_RETROSYNTHESIS_TEMPLATE_FREE')
predictions = cf.predict('CC(=O)Nc1ccc(C(=O)Nc2cccc(C(F)(F)F)c2)cc1',
beam_search=10)
```
Output: 10 predicted precursor SMILES. No templates required; can predict novel disconnections.
**Trade-off:** Template-free is more flexible but harder to debug. Combining with AiZynthFinder template MCTS gives best of both.
## Disconnection-Aware Design (DAD)
Modify generative design to also score retrosynthetic feasibility. AiZynthFinder batch mode for 1000+ molecules.
**Goal:** Add retrosynthetic feasibility scoring to generative design pipelines for hundreds-to-thousands of candidate molecules.
**Approach:** Batch-process generated SMILES through `aizynthcli`, classify each compound by route depth and in-stock leaf count, and feed feasibility back into the generative scoring function.
```bash
aizynthcli --smiles compounds.smi --output routes.json \
--config config.yaml --policy uspto --stock zinc
```
For each compound, returns top-K routes. Score-feasibility for generative design:
- "Synthesizable" = in-stoRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.