/text-to-cad:robot-simulationfrom text-to-cad
Generates, edits, and validates robot/world description files (URDF, SRDF, MJCF) for ROS, MoveIt, and MuJoCo. Helps create robot models from CAD joints or author XML by hand.
Ships in text-to-cad. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A robot is described for its consumers in XML: a URDF for its structure (ROS, RViz, robot_state_publisher), an SRDF beside it for MoveIt's planning semantics, and an MJCF for MuJoCo. There are two routes to one:
cad model export writes the URDF or MJCF, with frames, limits, masses,
inertias and meshes exact from the kernel. The file is regenerated, never edited.| Task | Start with | Reference |
|---|---|---|
| A URDF or MJCF from a CAD model | The model's declarations, then cad model export <id> robot.xml or .urdf | Generate from CAD, from CAD |
| Collision shapes, joint dynamics, actuators for MuJoCo | A MuJoCo function, run with cad run | The MuJoCo function, MuJoCo environment |
| A robot from a vendor's STEP | Read it, group parts into links, find each axis, declare, export | From a vendor STEP |
| A MuJoCo scene: several robots, objects, a world | spec() for each piece, composed with MuJoCo's own MjSpec | MuJoCo environment |
| Tune a MuJoCo model's physics | cad mujoco check's model-health findings, one parameter at a time | Tuning, MJCF checks |
| A URDF by hand | The .urdf and its ledger, then cad urdf validate | Authoring (frames and signs, the ledger), checks |
| MoveIt groups, end effectors, states, collision pairs | A .srdf beside the URDF, then cad srdf validate | Authoring (end effectors, disabled collisions, the ledger), checks |
| An MJCF by hand | robot.xml and a scene.xml that includes it, then cad mujoco check | Authoring, checks |
| Link meshes for a hand-written file | One mesh per link, in the link's frame | Meshes |
| Mass, centre of mass, inertia | Materials on the CAD parts; else a formula or a script, never intuition | Inertials |
| A four-bar in the viewer | <tcad:four_bar> on the derived URDF joint | Four-bar |
| See the robot or a pose | cad urdf snapshot, cad srdf snapshot; an MJCF in MuJoCo Studio | Snapshots |
| Work across formats, or convert a URDF to MJCF | Which file owns what | Interoperability |
Written for cad==0.11.22. Before first use in a chat, run cad --version. If it fails, or cad is missing or older
than 0.11.12, run uv tool install --force cad. If it is older than the release this skill was written for, run
cad update.
If cad is a major or minor version newer than this skill, tell the person to update the text-to-cad plugin: https://github.com/earthtojake/text-to-cad A project written for an earlier version may need changes; the migration guides say what: https://github.com/earthtojake/text-to-cad/tree/main/docs/migrations
MuJoCo (cad mujoco check, cad run mujoco-studio, a script that imports mujoco) and CoACD
(decompose()) are fetched by cad the first time they are needed, about 20 MB and 4 MB; nothing to
install. cad <command> --help is the complete, current interface.
The model says what is true of the machine, in its body (the cad skill's kinematics reference
covers the mechanism itself), and the export writes each format from it:
| In the model | Says | Written as |
|---|---|---|
| build123d joints, connected | Links, joints, and each joint's range around the as-built pose, which is zero | Bodies and joints; links and joints |
mechanism_state(...) | Named poses; name one home | MJCF keys (URDF has none) |
gear_pair, rack_and_pinion_pair | A follower joint on its leader | <equality><joint>; <mimic> |
part.material, mass(), point_mass() | Density, a measured total, a lump the CAD leaves out | Exact <inertial>s |
frame(part, name, location) | A tool point, a mount, a sensor | A site; an empty link |
body(part, name) | A part kept as its own body | A child body; a link on a fixed joint |
limits(assembly, joint, effort=, velocity=) | The drive's datasheet limits | actuatorfrcrange; <limit> |
link(part_or_assembly, name) | A link's name (base_link) | Body and link names |
free(assembly) | Not bolted to the world | <freejoint>; a floating root |
from cad.build123d import body, frame, free, limits, link, mass, point_mass
frame(palm, "tcp", bd.Pos(0, 0, 65)) # mm, in the palm's own frame
body(camera, "camera") # fixed to the palm, a body of its own
limits(root, "left", effort=2, velocity=1.5) # N*m, rad/s: the servo's datasheet
point_mass(palm, 120, bd.Pos(0, 0, 20), name="motor") # g, mm in the palm's own frame
mass(palm, 410) # g: the palm as weighed, its motor included
link(palm, "base_link") # the palm's link, named as ROS names a base
free(root) # on a mobile base: not bolted to the world
cad run src/gripper.py
cad model ranges "$ID" # stops where the parts meet, to write into the joints
cad model export "$ID" sim/gripper.xml
cad model export "$ID" description/gripper.urdf --zero home
$ID is the id: line the run printed; the suffix picks the format, and meshes are written beside
the file. Each export says what it wrote (links, joints, total mass, couplings, frames, keys) with a
warning for anything left out: read it first, since a mass of 0 or a missing joint is a model to fix.
An MJCF export also writes a scene.xml beside it once (floor, light), which is yours to edit.
From CAD has each declaration in full, joint ranges, the zero pose and
--zero.
cad model snapshot "$ID" out.png --pose <state>) and that the collision shapes suit the physics.A plain export holds no chosen collision shape, joint dynamics or actuator: each part collides as its
own mesh's convex hull, and nothing drives the joints. Those are a simulation's choices, made in a
plain Python function beside the model that turns the robot into a mujoco.MjSpec, edits it with
MuJoCo's own API and returns it:
# src/gripper_mujoco.py
import mujoco
from cad.mujoco import collisions, fit, save, spec
from gripper import gripper
def gripper_mujoco() -> mujoco.MjSpec:
s = spec(gripper())
for part in ("palm", "left", "right"):
fit(s, part, "box") # the kernel's box of the part's exact solid
for geom in collisions(s, "left") + collisions(s, "right"):
geom.friction = [1.1, 0.005, 0.0001] # sliding, torsional, rolling
left = s.joint("left")
left.armature = 0.002 # kg*m^2
left.damping = [0.1, 0, 0] # N*m*s/rad, a 3-vector in MuJoCo 4
grip = s.add_actuator(name="grip", target="left", trntype=mujoco.mjtTrn.mjTRN_JOINT)
grip.set_to_position(kp=20, dampratio=1, inheritrange=True)
return s
if __name__ == "__main__":
save(gripper_mujoco(), "sim/gripper.xml")
cad run src/gripper_mujoco.py
cad mujoco check sim/scene.xml
spec, fit, decompose, collisions, parts and save are the only helpers; they name a part by
its label path, as cad model inspect prints it. Everything else is MuJoCo's API. save writes the
file with its meshes, and a scene.xml where there is none, then prints the check's warnings, what
the model collides as and its contact excludes: read them against the choices the function made. This
file replaces the plain export (MuJoCo environment).
For a robot that has a CAD model here, generate the URDF or MJCF and author only what it does not carry: the SRDF, a MuJoCo scene. Each format owns one thing:
<robot name>, exactly one such URDF.scene.xml that includes the robot's.What holds for every format:
<compiler angle="radian"/>, since
MuJoCo's default is degrees.cad srdf validate
on the SRDF beside it.The trap in each format, and where its contract is:
<origin> is the parent-link-frame transform to
the joint frame at zero, the child link frame coincides with the joint frame, <axis> is in the
joint frame, and visual, collision and inertial origins are each in the link frame
(frames and signs).qpos is radians regardless), and a geom or joint inherits from its default class. Split the robot
from its world, and clear every model-health warning before tuning physics
(authoring).cad urdf validate path/to/robot.urdf
cad urdf validate path/to/robot.urdf --packages robot_description=/path/to/pkg
cad srdf validate path/to/robot.srdf --strict
cad mujoco check path/to/scene.xml
cad mujoco check path/to/scene.xml --strict --json
cad urdf snapshot path/to/robot.urdf review.png --pose '{"shoulder_pitch": 30}'
cad srdf snapshot path/to/robot.srdf review.png --pose arm/ready
cad run mujoco-studio --model path/to/scene.xml
| Change | Check it with |
|---|---|
| A CAD model's mechanism or declarations | Run it, export again (or run its MuJoCo function again), validate the file; cad model snapshot at each mechanism state first, where the joint signs show |
| A MuJoCo function or a scene script | Run it and read what save printed, then cad mujoco check on the scene |
Any .urdf | cad urdf validate until clean; check_urdf when installed; cad srdf validate on an SRDF beside it |
| A joint origin, axis, sign or limit | Every movable joint moved through its limits, in the viewer or in snapshots at --pose values. Only this catches a flipped sign |
| A mesh, its scale or placement | A snapshot: about 1000x too large or small is a scale bug |
| An inertial | The sanity gates |
Any .srdf | cad srdf validate, which cross-checks every name, chain, state and pair against the URDF; named states in a snapshot |
| Any MJCF | cad mujoco check: MuJoCo's own compile, the model-health checks, what collides and the contact excludes |
| MuJoCo physics | One parameter changed, checked, and run in MuJoCo Studio against the baseline (tuning) |
| A ROS or MoveIt consumer | Its own load where available: RViz, the TF tree, MoveIt Setup Assistant |
--strict
fails on warnings, --json prints the result as one object, and the exit status is 1 for a file
that fails and 2 for a command refused.--pose takes degrees (metres for a slide), though the files hold radians.cad command draws an MJCF. cad run mujoco-studio serves MuJoCo Studio's web viewer for the
person, reloading as the file changes; it listens on every network interface with no
authentication, so it is for this computer or a trusted network.scale, that a planning group suits the task or that a gain is right. Report which
checks ran, which were skipped, and the assumptions made
(report shape).Show the person each model you create or change as soon as its first run succeeds, and any model
or file they ask to see. A model's page is the view: line its run prints, and a file's is the url
that cad viewer --json FILE [FILE ...] prints for it (never guess the port). Show it with
the first of these you have:
cad_show among your tools (your host may prefix it): call it with the model's id or the file's
absolute path; its description says the rest.preview_start with the page's url, or its navigate):
open the page there yourself, and give the person the link as well.The page follows every run of the model. A file you export is a download: give its path. Showing is
for the person: to check your own work, review with cad <type> snapshot, never a screenshot
of the page. If it fails to launch, say so.
An MJCF is the exception: the viewer and cad_show do not open one. Show the person the CAD
model it was generated from, and for the MJCF itself run cad run mujoco-studio --model FILE and
give them the URL it prints.
LICENSE (opens in a new tab)agents/openai.yaml (opens in a new tab)references/from-a-vendor-step.md (opens in a new tab)references/from-cad.md (opens in a new tab)references/guardrails.md (opens in a new tab)references/inertials.md (opens in a new tab)references/interoperability.md (opens in a new tab)references/meshes.md (opens in a new tab)references/mjcf-authoring.md (opens in a new tab)references/mjcf-checks.md (opens in a new tab)references/mujoco-environment.md (opens in a new tab)references/snapshots.md (opens in a new tab)references/srdf-authoring.md (opens in a new tab)references/srdf-checks.md (opens in a new tab)references/urdf-authoring.md (opens in a new tab)references/urdf-checks.md (opens in a new tab)references/urdf-four-bar.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub earthtojake/text-to-cad --plugin text-to-cad8 skills in this plugin
/cadDesigns and edits 3D CAD - parametric parts, assemblies, mechanisms and 2D cut profiles, written as build123d Python and shown live in the text-to-cad viewer. Use for any request to model, change, measure, inspect, animate, export or convert a part or a CAD file (STEP, STL, 3MF, GLB, DXF, xbf), for references and Quick Edit prompts copied from the viewer, and to check whether a part can be machined, cut and bent, molded or printed. Not for robot descriptions, which the robot-simulation skill writes./engineering-drawingMakes an engineering drawing of a part as a PDF, projected from its 3D geometry so the drawing follows the model, with dimensioned orthographic views, hole callouts, notes and a title block. Use when the person asks for a drawing, a dimensioned sheet, shop or manufacturing drawings, a blueprint, or "2D views of this part". Not for DXF cut layouts or flat patterns, which the cad skill makes./feaChecks whether a part, or an assembly of bonded parts, is strong enough under its loads, as a linear static stress study (FEA). Use when the person asks whether a part will hold, break or bend too much, where it is most stressed, how much load it takes, how to make it stronger or lighter, or for FEA, a stress analysis or a strength simulation. Reports peak stress, safety factor against yield and deflection. Static loads only, not vibration, buckling, heat, fatigue or impact./pcbDesigns, edits and reviews KiCad circuit boards and schematics (.kicad_pcb, .kicad_sch). Use for any request about a PCB, a schematic or a circuit - parts and nets, placement and routing, ERC and DRC, a review before ordering from JLCPCB, PCBWay or another fab, and fabrication files, a BOM, a netlist or a STEP of the board. Not for the enclosure or other mechanical parts, which the cad skill makes./print3dGets a part 3D printed - slices an .stl, .3mf or .obj into G-code with OrcaSlicer and, for a Bambu Lab printer, hands it to Bambu's own app. Use when the person wants a model sliced, printed or sent to their printer (Prusa, Bambu Lab, Creality, Voron and most FDM printers). Whether a part will print well is the cad skill's check./renderRenders photoreal images and videos of a text-to-cad model, a STEP or an xbf with Blender - a hero shot, a product or README picture, a turntable, or a film of a model's motion. Use when the person wants a picture or a video for people to look at. Not for checking geometry, which the cad skill's snapshot does.Other plugins' skills for the same job