Skip to content

mdbritt/claudecad

Repository files navigation

claudeCAD

ci license

A verification-first parametric CAD workspace built for designing with Claude Code. You describe a piece; the model writes parametric build123d code; geometry ships only after machine-checkable proofs pass — topological interlock, zero-interpenetration, working mechanisms — and lands in your CAD app (tested with Plasticity) as named, editable NURBS via STEP.

DISCLAIMER: entirely vibe coded with Fable 5, works best with your already exisiting Claude Max Subscription, assuming of course, you have one.

bracelet

Use it in your project

Two ways in — both end with you designing in chat while the gates verify:

Existing Claude Code project

/plugin marketplace add mdbritt/claudecad     # in Claude Code
/plugin install claudecad                     # installs the /cad skill
uv add claudecad                              # the library

Fresh project

uvx claudecad new mypart
cd mypart && uv sync

Then just describe the part in chat. The /cad skill drives the loop: build → verify (the gates are ground truth) → render → export. STEP lands in out/step/ only when verification passes.

Why this exists

LLMs are good at writing parametric geometry and bad at knowing when it's wrong. claudeCAD's answer is a design loop where verification is ground truth and renders are not evidence:

  1. Dimensions live in one params.py per design.
  2. uv run python -m designs.<name>.build builds solids and runs the gate:
    • interlock proven by the Gauss linking number of part centerlines,
    • non-interpenetration proven by exact boolean intersection (must be 0),
    • mechanisms proven by constructed states — e.g. a clasp tongue is built in relaxed AND compressed states; the gate asserts the compressed state slides free while the relaxed state is blocked (that differential is the click),
    • a failed gate blocks STEP export, period.
  3. Headless Blender renders gold studio shots for the human judgment pass.
  4. STEP export preserves part names for your CAD app's outliner.

The dated design docs in docs/superpowers/ carry the evidence trail for every load-bearing decision — including OCCT construction laws that took real adversarial testing to establish (why twisted closed tubes must be built as overlapping half-loop ruled lofts; why is_valid is necessary but nowhere near sufficient).

What the gates can prove

The hardware pack is the generality benchmark — three mechanism classes, each forcing its own verification law (all encoded in the /cad skill):

M8 bolt 608 bearing snap enclosure
M8×1.25 bolt + nut — thread mesh proven by the exact 2D axial-section clearance (helical symmetry): a real air gap on the true pitch, jams under axial shift and wrong pitch. 608 ball bearing — the 7-ball ring swept as one compound over a single 360/7° symmetry period; an eccentric-groove negative control proves the gate detects broken axisymmetry. Hinged snap box — off-origin partial-arc swing gates, a same-parameter travel-limit differential (free ≤100°, blocked ≥105°), and snap retention as a two-state differential.

Developing claudeCAD itself

git clone https://github.com/mdbritt/claudecad && cd claudecad
uv sync
uv run pytest                              # full verification suite
uv run python -m designs.simple_curb.build # build + verify a bracelet

View the result three ways:

  • Your CAD app: import out/step/simple_curb.step (named parts).
  • Bundled web viewer: tools/step_viewer/fetch_libs.sh once, then python3 -m http.server 8123 from the repo root and open http://localhost:8123/tools/step_viewer/?model=/out/step/simple_curb.step.
  • Renders (needs Blender, BLENDER_BIN to override the default path): uv run claudecad render out/glb/simple_curb.glb --outdir out/renders/simple_curb

Using it with Claude Code

The repo ships a project skill (.claude/skills/cad/SKILL.md) that teaches Claude the loop and its non-negotiable rules (mm-only params, never render unverified geometry, never weaken a check, constructed-state mechanism proofs). Open the repo in Claude Code and ask for a design; the skill does the rest. Start a new piece with uvx claudecad new (in-repo contributors: the template lives at claudecad/_scaffold/designs/_template/) — the step-by-step guide is docs/new-design-recipe.md.

What's here

claudecad/            domain-neutral core
  core/               exact centerline math (planar + twisted)
  verify.py           the gate: linking number, intersection, path clearance
  assembly.py         assembly finishing (relief cuts)
  jewelry/            DOMAIN PACK: links, chains, clasps, diamond-cut
  hardware/           DOMAIN PACK: carabiner (spring gate)
designs/              examples — each is params.py + build.py with a gate
tools/                STEP/GLB export, Blender renderer, web STEP viewer
docs/superpowers/     the evidence trail (specs + plans, dated)

The benchmark

The system was battle-tested by designing a Miami cuban bracelet end to end — twisted chirality-alternating links, chain-level diamond-cut, and a fully functional box clasp (hinged safety latches, folded-spring tongue whose click is proven, statically, by the relaxed-vs-compressed differential).

clasp detail

Contributing

See CONTRIBUTING.md. Short version: spec → plan → gate; never weaken a check; new domains come as domain packs.

License

Apache-2.0 — see LICENSE.

About

Verification-first parametric CAD for designing with Claude Code (build123d + provable geometry gates)

Resources

License

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors