Writes liquid-handling protocols for Opentrons OT-2 and Flex robots using the official Protocol API v2. Automates pipetting, hardware modules, labware setup, and deck layouts.
Opentrons is a Python-based lab automation platform for Flex and OT-2 robots. Write Protocol API v2 protocols for liquid handling, control hardware modules (heater-shaker, thermocycler), manage labware, for automated pipetting workflows.
This skill should be used when:
| Scenario | Use Instead |
|---|---|
| One script driving Hamilton/Tecan liquid handlers, plate readers, or mixed vendors | alterlab-pylabrobot |
| Sending an experiment to a remote cloud lab (Ginkgo Cloud Lab RACs) | alterlab-ginkgo-cloud |
| Protein expression/binding assays run by Adaptyv Bio's foundry | alterlab-adaptyv |
| Publishing the written wet-lab protocol with a DOI | alterlab-protocolsio |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-pylabrobot) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
Every Opentrons protocol follows a standard structure:
from opentrons import protocol_api
# Metadata (descriptive only here; apiLevel lives in requirements)
metadata = {
'protocolName': 'My Protocol',
'author': 'Name <[email protected]>',
'description': 'Protocol description',
}
# apiLevel goes in exactly ONE of metadata/requirements: opentrons rejects a protocol
# that sets it in both. robotType is required for Flex protocols.
requirements = {
'robotType': 'Flex', # or 'OT-2'
'apiLevel': '2.22' # lowest level that has every feature you use (see below)
}
# Run function
def run(protocol: protocol_api.ProtocolContext):
trash = protocol.load_trash_bin('A3') # Flex: load a trash bin (or waste chute) before any drop_tip
# Protocol commands go here
Key elements:
protocol_api from opentronsmetadata for name/author/description; requirements for robotType + apiLevelrun() receiving a ProtocolContext; all protocol logic goes inside itprotocol.load_trash_bin(slot) or protocol.load_waste_chute() first, or drop_tip() fails with NoTrashDefinedErrorChoosing apiLevel: the latest is 2.29 (Flex robot software 9.1.1+; the opentrons 9.1.x package simulates up to it). Useful floors: 2.16 trash-bin/waste-chute loaders; 2.20 liquid-presence detection; 2.21 Absorbance Plate Reader; 2.22 Labware.load_liquid()/load_empty(); 2.24 liquid classes (transfer_with_liquid_class); 2.25 Flex Stacker; 2.27 concurrent module commands. Use the lowest level that covers your features so older robots can still run the protocol, and check it with opentrons_simulate.
Loading Instruments (Pipettes):
def run(protocol: protocol_api.ProtocolContext):
# Load pipette on specific mount
left_pipette = protocol.load_instrument(
'flex_1channel_1000', # Instrument name (Flex convention)
'left', # Mount: 'left' or 'right'
tip_racks=[tip_rack] # List of tip rack labware objects
)
Common pipette load names (these are the exact instrument_name strings — do NOT invent
p1000_single_flex-style names; Flex uses the flex_<channels>_<volume> convention):
flex_1channel_50, flex_1channel_1000, flex_8channel_50, flex_8channel_1000, flex_96channel_1000p20_single_gen2, p300_single_gen2, p1000_single_gen2, p20_multi_gen2, p300_multi_gen2Loading Labware:
# Load labware directly on deck
plate = protocol.load_labware(
'corning_96_wellplate_360ul_flat', # Labware API name
'D1', # Deck slot (Flex: A1-D3, OT-2: 1-11)
label='Sample Plate' # Optional display label
)
# Load tip rack
tip_rack = protocol.load_labware('opentrons_flex_96_tiprack_1000ul', 'C1')
# Load labware on adapter
adapter = protocol.load_adapter('opentrons_flex_96_tiprack_adapter', 'B1')
tips = adapter.load_labware('opentrons_flex_96_tiprack_200ul')
Loading Modules:
# Temperature module (Flex + OT-2)
temp_module = protocol.load_module('temperature module gen2', 'D3')
temp_plate = temp_module.load_labware('corning_96_wellplate_360ul_flat')
# Heater-Shaker module (Flex + OT-2)
hs_module = protocol.load_module('heaterShakerModuleV1', 'D1')
hs_plate = hs_module.load_labware('corning_96_wellplate_360ul_flat')
# Thermocycler module (takes up specific slots automatically)
tc_module = protocol.load_module('thermocyclerModuleV2')
tc_plate = tc_module.load_labware('nest_96_wellplate_100ul_pcr_full_skirt')
# Magnetic Module (OT-2 ONLY) — an active, motorized module. Flex does not
# support it; on Flex use the unpowered Magnetic Block instead (see below).
mag_module = protocol.load_module('magnetic module gen2', '1') # OT-2 numeric slot
mag_plate = mag_module.load_labware('nest_96_wellplate_100ul_pcr_full_skirt')
# Magnetic Block (Flex ONLY) — unpowered; labware is moved on/off it with the
# Gripper. There is no engage/disengage; it has no motors.
mag_block = protocol.load_module('magneticBlockV1', 'C2')
block_plate = mag_block.load_labware('nest_96_wellplate_100ul_pcr_full_skirt')
Basic Operations:
# Pick up tip
pipette.pick_up_tip()
# Aspirate (draw liquid in)
pipette.aspirate(
volume=100, # Volume in µL
location=source['A1'] # Well or location object
)
# Dispense (expel liquid)
pipette.dispense(
volume=100,
location=dest['B1']
)
# Drop tip
pipette.drop_tip()
# Return tip to rack
pipette.return_tip()
Complex Operations:
# Transfer (combines pick_up, aspirate, dispense, drop_tip)
pipette.transfer(
volume=100,
source=source_plate['A1'],
dest=dest_plate['B1'],
new_tip='always' # 'always', 'once', or 'never'
)
# Distribute (one source to multiple destinations)
pipette.distribute(
volume=50,
source=reservoir['A1'],
dest=[plate['A1'], plate['A2'], plate['A3']],
new_tip='once'
)
# Consolidate (multiple sources to one destination)
pipette.consolidate(
volume=50,
source=[plate['A1'], plate['A2'], plate['A3']],
dest=reservoir['A1'],
new_tip='once'
)
Advanced Techniques:
# Mix (aspirate and dispense in same location)
pipette.mix(
repetitions=3,
volume=50,
location=plate['A1']
)
# Air gap (prevent dripping)
pipette.aspirate(100, source['A1'])
pipette.air_gap(20) # 20µL air gap
pipette.dispense(120, dest['A1'])
# Blow out (expel remaining liquid)
pipette.blow_out(location=dest['A1'].top())
# Touch tip (remove droplets on tip exterior)
pipette.touch_tip(location=plate['A1'])
Flow Rate Control:
# Set flow rates (µL/s)
pipette.flow_rate.aspirate = 150
pipette.flow_rate.dispense = 300
pipette.flow_rate.blow_out = 400
Well Access Methods:
# By name
well_a1 = plate['A1']
# By index
first_well = plate.wells()[0]
# All wells
all_wells = plate.wells() # Returns list
# By rows
rows = plate.rows() # Returns list of lists
row_a = plate.rows()[0] # All wells in row A
# By columns
columns = plate.columns() # Returns list of lists
column_1 = plate.columns()[0] # All wells in column 1
# Wells by name (dictionary)
wells_dict = plate.wells_by_name() # {'A1': Well, 'A2': Well, ...}
Location Methods:
# Passing a Well aspirates 1 mm above its bottom by default
pipette.aspirate(100, well)
# top()/bottom() are exact: z=0 is the top rim / the well bottom itself
pipette.dispense(100, well.top()) # at the rim
pipette.aspirate(100, well.top(z=-2)) # 2 mm below the rim
pipette.aspirate(100, well.bottom(z=2)) # 2 mm above the bottom (z=0 would touch it)
# Center of well
pipette.aspirate(100, well.center())
Control temperature, magnetic, heater-shaker, thermocycler, and absorbance-reader modules. Each module context exposes its own set / wait / deactivate methods plus status properties (e.g. temp_module.set_temperature, hs_module.set_and_wait_for_shake_speed, tc_module.execute_profile). On Flex, the active Magnetic Module is replaced by the unpowered Magnetic Block (magneticBlockV1).
Full per-module code recipes (Temperature, Magnetic Module vs Flex Magnetic Block, Heater-Shaker, Thermocycler PCR cycling, Absorbance Plate Reader): see references/hardware_modules.md. The corresponding method/property tables are in references/api_reference.md.
Define Liquids:
# Define liquid types
water = protocol.define_liquid(
name='Water',
description='Ultrapure water',
display_color='#0000FF' # Hex color code
)
sample = protocol.define_liquid(
name='Sample',
description='Cell lysate sample',
display_color='#FF0000'
)
Load Liquids into Wells (API 2.22+):
# Mark starting contents per labware (volumes in µL)
reservoir.load_liquid(wells=['A1'], volume=50000, liquid=water)
plate.load_liquid(wells=['A1', 'A2'], volume=100, liquid=sample)
plate.load_liquid_by_well({'A3': 50, 'A4': 75}, liquid=sample)
# Mark wells as empty
plate.load_empty(['B1', 'B2'])
Well.load_liquid(liquid, volume) still works but is deprecated from 2.22; there is no Well.load_empty().
Execution Control:
# Pause protocol
protocol.pause(msg='Replace tip box and resume')
# Delay
protocol.delay(seconds=60)
protocol.delay(minutes=5)
# Comment (appears in logs)
protocol.comment('Starting serial dilution')
# Home robot
protocol.home()
Conditional Logic:
# Check if simulating
if protocol.is_simulating():
protocol.comment('Running in simulation mode')
else:
protocol.comment('Running on actual robot')
Rail Lights (OT-2 and Flex, API 2.5+):
# Turn lights on
protocol.set_rail_lights(on=True)
# Turn lights off
protocol.set_rail_lights(on=False)
When using multi-channel pipettes:
# Load 8-channel pipette
multi_pipette = protocol.load_instrument(
'p300_multi_gen2',
'left',
tip_racks=[tips]
)
# Access entire column with single well reference
multi_pipette.transfer(
volume=100,
source=source_plate['A1'], # Accesses entire column 1
dest=dest_plate['A1'] # Dispenses to entire column 1
)
# Column-wise with an 8-channel: target the row-A well of each column
for column_top in plate.rows()[0]: # A1, A2, ... A12
multi_pipette.transfer(100, reservoir['A1'], column_top)
With an 8-channel pipette, address row A wells only; targeting B1–H1 would put the other nozzles off the plate.
Reusable end-to-end templates cover the most common workflows: serial dilution (diluent fill plus mix-after cascade across a row), plate replication (whole-plate wells()-to-wells() copy), and PCR setup (master-mix distribute, per-sample transfer, thermocycler cycling).
Full worked-example protocols for each pattern: see references/protocol_patterns.md. Runnable .py versions are in the scripts/ directory (serial_dilution_template.py, basic_protocol_template.py, pcr_setup_template.py).
apiLevel that covers the features you use and that your robot's software accepts (confirm with opentrons_simulate)protocol.comment() for debugging and loggingnew_tip='once' when appropriate to save tipsfrom opentrons import protocol_api, the requirements/metadata, run(protocol), the thermocycler execute_profile, etc.), not only as a saved .py file — the user and reviewers read the answer, and a file left in the workspace is not visible to them.Common Issues:
For detailed API documentation, see references/api_reference.md in this skill directory.
For example protocol templates, see scripts/ directory.
Part of the AlterLab Academic Skills suite.
evals/evals.json (opens in a new tab)references/api_reference.md (opens in a new tab)references/hardware_modules.md (opens in a new tab)references/protocol_patterns.md (opens in a new tab)scripts/basic_protocol_template.py (opens in a new tab)scripts/pcr_setup_template.py (opens in a new tab)scripts/serial_dilution_template.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Not loaded · from alterlab-writing-tools
Claude Code won't load this skill
It ships in alterlab-writing-tools at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
Generated from the plugin's indexed repository (alterlab-ieu/alterlab-academic-skills) — no native marketplace selected
npx claudepluginhub p/alterlab-ieu-alterlab-writing-tools241 skills in this plugin
/alterlab-abm-mesaBuilds agent-based models of social systems with Mesa 3 — the current AgentSet API (model.agents.shuffle_do('step'), auto-assigned unique_id, mandatory super().__init__(rng=...)), cell spaces (mesa.discrete_space OrthogonalMooreGrid / classic mesa.space grids), the DataCollector, batch_run parameter sweeps, and SolaraViz — for emergence, segregation, diffusion, opinion dynamics, and cooperation models. It uses the Mesa 3.x API (the old mesa.time schedulers like RandomActivation are removed) and treats the model as a generative theory to be validated, not just run. Use when the request mentions an agent-based model, Mesa, simulating interacting agents, or emergent macro behavior from micro rules. For discrete-event (queueing/process) simulation prefer alterlab-simpy; for reinforcement learning prefer alterlab-stable-baselines3. Part of the AlterLab Academic Skills suite./alterlab-academic-careerPrepares academic career documents and professional-development materials for faculty and researchers. Use when drafting academic CVs, research statements, teaching philosophies, diversity statements, faculty-position cover letters, tenure dossiers, promotion narratives, academic portfolios, or mentorship statements, and when planning conference-networking strategy, building academic web presence, setting up ORCID profiles, or understanding impact metrics. Part of the AlterLab Academic Skills suite.2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job