cadsmith-text-to-cad
Skill16 starsChanged 16 days agoMITView on GitHub
Generates dimensionally exact CadQuery CAD from natural language with the CADSmith multi-agent method — Planner, RAG-assisted Coder, sandboxed Executor, kernel-metric + three-view vision Validator, and Refiner in two nested loops (≤3 error repairs, ≤5 geometric refinements). Use when the user wants a part generated from a text description with verified dimensions, a STEP/STL from a spec, or wants to benchmark text-to-CAD output (Chamfer distance, F1, IoU).
- Installs packages
In this repository34 other files it gives its agents.
- skills/cadsmith-text-to-cad/references/agents.mdAGENTS.md
- agentscad-fdm-dfamSkill
- am-alloy-screeningSkill
- am-literature-ragSkill
- cfd-simulation-setupSkill
- design-review-packageSkill
- dfm-reviewSkill
- drawing-gdt-reviewSkill
- engineering-calc-reportSkill
- equation-discoverySkill
- image2gcodeSkill
- lattice-inverse-designSkill
- linkage-synthesisSkill
- llm-3d-print-monitorSkill
- llm-mechanical-designerSkill
- lpbf-defect-predictionSkill
- lpbf-superresSkill
- machine-element-sizingSkill
- material-selectionSkill
- mechanical-teardownSkill
- mechanics-visualsSkill
- meltpool-geometrySkill
- parametric-part-cadSkill
- query2cad-freecadSkill
- quick-feaSkill
- rocketsmithSkill
- sketch-to-cadSkill
- sls-process-optimizationSkill
- stress-field-surrogateSkill
- thermal-fluids-calcSkill
- thermal-porositySkill
- tolerance-stackupSkill
- worked-problem-generatorSkill
- my-new-skillSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Use this skill when correctness is checked against a stated spec.
- Very specific: line 17
Plan: Write plan.json following references/agents.md: components, target bbox (mm), holes (diameter, count), expected n_solids, and …
- Very specific: line 19
Code: Write part.py with named dimensions, ending with result = ....
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CADSmith: text → validated CadQuery
Paper: J. Barkley, R. Loghmani, A. Barati Farimani, CADSmith: Multi-Agent CAD Generation with Programmatic Geometric Validation, arXiv:2603.26512. On their 100-prompt benchmark it reached a 100% execution rate (versus 95% zero-shot), median IoU 0.963 (versus 0.809), and mean Chamfer distance 0.74 (versus 28.4).
Use this skill when correctness is checked against a stated spec. For quick parametric parts, parametric-part-cad is lighter. For FreeCAD macros, use query2cad-freecad.
Setup: pip install cadquery trimesh scipy rtree matplotlib.
Workflow
S=scripts/cadsmith.py. Keep everything for a part in runs/<name>/.
- Plan. Write
plan.jsonfollowingreferences/agents.md: components, target bbox (mm), holes (diameter, count), expectedn_solids, and constraints. Convert the prompt's diameters and pitch-circle diameters explicitly. Don't write code yet. - Retrieve.
python $S kb "<keywords from the plan: polarArray hole revolve keyway ...>". Read the entries, especially the pitfalls. - Code. Write
part.pywith named dimensions, ending withresult = .... - Execute (inner loop, at most 3 repairs).
On failure, save the traceback, runpython $S execute runs/x/part.py --out runs/x/v0python $S kb "<keywords>" --errors runs/x/v0_metrics.json, fix only what it implicates, and log withpython $S log --run runs/x --stage inner --note "...". After 3 failed repairs, stop and report a code-execution failure. - Validate (outer loop).
Then run the Judge frompython $S check --plan runs/x/plan.json --metrics runs/x/v0_metrics.json # deterministic python $S render runs/x/v0.stl --out runs/x/v0_views.png # iso / high-rear / frontreferences/agents.mdwith the prompt, code, metrics, check result, and image. Spawn an independent subagent for this when you can; the paper's point is that the generator mustn't grade itself. A kernel hard-fail (invalid or not watertight) fails regardless of the judge. - Refine (at most 5). Log each attempt with
python $S log --run runs/x --stage outer --note "<feedback>". When the ledger returnsescalate: true(iteration 3 and later), change the construction approach. - Deliver: STEP, STL, the three-view image,
part.py, the plan, and a table comparing the kernel bbox, volume, and hole counts with the spec. Say whether the judge was independent, and list any feature the renders couldn't confirm (small gaps at joints are the paper's documented near-miss).
Benchmarking (optional)
With a reference model: python $S eval gen.stl ref.stl gives the Chamfer distance (sum of the two directional mean squared nearest-neighbour distances over 10k points), F1 at τ = 1 mm, and voxel IoU at 1 mm (coarsened above 100 mm). Everything is in absolute mm after bbox-centring and ICP, as in the paper.
Prompt conventions that help (from the benchmark)
Explicit mm dimensions, axis-annotated orientation (XY base, Z up), origin-centred geometry, and coordinates for holes and slots. If the user's prompt lacks these, state the assumptions in the plan before coding.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

