Authoring CAD with AI
Ask for a part in plain English. The agent writes it, runs it on a CAD kernel, and checks the result before handing it back.
"a 40×20×10 mm bracket with two M4 holes"
│ agent writes bracket.brep.ts and runs
▼ it on an OpenCascade kernel
────────────────────────────────────────────────────
✓ valid solid ✓ volume ≈ 7,750 mm³ (within 1%)
✓ snapshots rendered → bracket.step ready to hand offAn LLM can't see geometry. Code that reads correctly can still produce a solid that is broken, empty, or the wrong size, and the model has no way to notice. brepjs-cad closes that gap: the agent writes the part, runs it against the kernel, and reads back what the kernel measured instead of judging the code by eye.
What it checks
Every part gets three independent verdicts:
- Validity: is it a manifold solid with positive volume? (the kernel's
validSolidbrand) - Intent: does it match the dimensions you asked for? (
measureVolume/measureArea/ bounds vs anexpectedblock) - Shape: does it look like the request? (multi-view PNG snapshots, for the agent or you to review)
STEP is the validated deliverable; GLB, STL, and snapshots are derived previews.
What you install
brepjs-cad is two parts that work together:
- The skill teaches the agent the workflow (brief → author → verify → repair) and carries the API references and examples it draws on.
- The runtime is the CLI the skill drives. It loads your part on a kernel, checks validity, measures volume / area / bounds, renders snapshots, and exports STEP.
They install separately because Claude Code loads skills from plugins (a git marketplace), while the runtime has to live wherever your project's brepjs resolves. You install both once.
Install the skill (Claude Code plugin)
The skill ships through the brepjs plugin marketplace, which is this git repo. Add the marketplace once, then install the plugin. In a Claude Code session, use the slash commands:
/plugin marketplace add andymai/brepjs
/plugin install brepjs@brepjsOr do the same non-interactively from a terminal — handy for scripts and dotfiles:
claude plugin marketplace add andymai/brepjs
claude plugin install brepjs@brepjsClaude Code now knows the workflow and will run the CLI for you. There is no npm step for the skill; plugins aren't loaded from node_modules.
Install the runtime (npm)
Add the CLI to the project where you want parts verified:
npm i -D brepjs-cadThat's the whole install. brepjs-cad bundles its own brepjs + occt-wasm, so it runs in an empty directory with nothing else set up. In an existing brepjs project it automatically prefers your locally installed brepjs and kernel (via a Node module-resolution hook), so your verified parts bind to the exact version you ship. There is no drift between what you verify and what you build.
It runs occt-wasm as its only kernel, rather than the auto-detect fallback chain, so verification results are reproducible on one known engine.
Prefer not to install anything? Run it straight from npm:
npx -y -p brepjs-cad brep part.brep.tsAsk for a part
With the skill installed, just ask for a part in plain English — Claude reaches for the brepjs pipeline on its own:
a 40×20×10 mm bracket with two M4 holes 30 mm apart
It scopes the spec, designs the build sequence, authors the .brep.ts, verifies it on the kernel, and hands back a STEP file. To drive the pipeline explicitly, use the slash commands the plugin installs:
/brepjs:cad a wall bracket for a 40 mm pipe with two M4 holes/brepjs:cad runs the whole pipeline and pauses for your confirmation between phases. To run a single phase, invoke it directly: /brepjs:brainstorm, /brepjs:design, /brepjs:implement, /brepjs:verify, or /brepjs:polish.
The .brep.ts contract
A model is a TypeScript module whose default export is a zero-argument function returning a shape (or a Result<shape>):
// bracket.brep.ts
import { box } from 'brepjs';
export default () => box(40, 20, 10, { centered: true });Declare intent with an expected block and the CLI asserts it, so you confirm the part is the right part, not only a valid one:
// bracket.brep.ts
import { box } from 'brepjs';
export const expected = { volume: 8000, tolerancePct: 1 };
export default () => box(40, 20, 10, { centered: true });Author parts in an ESM context (the CLI's default). A CommonJS project needs "type": "module" in package.json, or name the file .mts.
Quickstart
# scaffold a parameterized part
npx -y -p brepjs-cad brep init bracket
# author bracket/bracket.brep.ts, then verify (type-check + geometry) and write the report
npx -y -p brepjs-cad brep verify bracket/bracket.brep.ts --check --json report.json
# review it visually, then export the validated STEP
npx -y -p brepjs-cad brep verify bracket/bracket.brep.ts --snapshot shots/
npx -y -p brepjs-cad brep verify bracket/bracket.brep.ts --step bracket.stepThe command exits non-zero whenever the report is not ok, so it drops straight into CI or an agent loop.
Next steps
- The Verify Loop: the author → verify → repair workflow and how to read the report
- CLI Reference: every subcommand, flag, and exit code
- Examples: the example gallery the skill draws on
- Eval & Scorecard: how the skill measures itself