Files
codecraft/server/resources/skills/cad/SKILL.md
T
Richard ZinkandClaude Opus 5.5 df1924b0a1 Add web terminal, git credentials, OpenSCAD, review loops, automations
- Web terminal (PTY over WebSocket, xterm.js, sandboxed, reattach with replay)
- Per-user git credentials and commit identity (credential store in the user's home)
- OpenSCAD tool (STL/3MF + preview renders, bounding box) and cad skill; 3D model card
- Craft phase inferred from tool activity when the agent does not report it
- Configurable review loop per mode (rounds, reviewer model, criteria)
- Delete config and Markdown agents from the agent editor
- Automations: cron-scheduled agents from Markdown job files, schedule tool, page
- change_directory tool (only on the user's request)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 22:00:38 +01:00

83 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: cad
description: Design parametric 3D models for 3D printing with OpenSCAD – from a description, a hand-drawn sketch or a photo. Renders STL/3MF and checks previews against the sketch.
---
# 3D models with OpenSCAD (for 3D printing)
You design printable parts as **parametric OpenSCAD code**, render them with the `openscad`
tool, look at the previews and refine until the part matches what the user wants.
## 1. Understand the part
- If the user attached a **sketch or photo**, describe what you see first: overall shape,
features (holes, slots, ribs, chamfers, text), views shown, and every **dimension written
on it** (with units). Hand-drawn sketches are not to scale – written numbers win over
proportions.
- List what is missing for a printable part (overall size, wall thickness, hole diameters,
screw sizes, fit with other parts). Ask with `ask_user` in **one** round, offering sensible
defaults the user can just accept (e.g. "wall 2 mm, M3 holes 3.4 mm"). Don't ask about
things you can reasonably assume.
## 2. Write the model
Create `<name>.scad` in the project (or `cad/<name>.scad` if the project has other content):
```openscad
// <Part name> – <one-line purpose>
// All dimensions in mm.
/* [Main dimensions] */
width = 60; // outer width (X)
depth = 40; // outer depth (Y)
height = 25; // outer height (Z)
wall = 2; // wall thickness
/* [Holes] */
hole_d = 3.4; // M3 clearance
/* [Quality] */
$fn = 64;
module body() { ... }
module holes() { ... }
difference() {
body();
holes();
}
```
Rules:
- **Every size is a named variable** at the top with a comment; group them with
`/* [Section] */` (shows up in OpenSCAD's customizer). No magic numbers in the geometry.
- Small, named `module`s; `difference()` / `union()` / `hull()` / `minkowski()` (sparingly –
slow) / `linear_extrude()` / `rotate_extrude()`.
- Model sits **on z = 0**, centred in X/Y unless the user wants otherwise.
- Holes and cut-outs extend a little past the surface (`+0.01`/`2*eps`) to avoid
coplanar faces (z-fighting, non-manifold results).
Printability (FDM defaults – adjust if the user says SLA/resin or names a printer/nozzle):
- Minimum wall 1.2 mm (3 × 0.4 mm nozzle), better 2 mm for load-bearing parts.
- Overhangs ≤ 45°; prefer chamfers over fillets on the bottom edge; bridges ≤ ~20 mm.
- Fits: +0.2 mm clearance for sliding fits, +0.3–0.4 mm for loose fits; press fits −0.05 mm.
Horizontal holes come out slightly small – add 0.2 mm or use a teardrop shape.
- Print orientation: flat largest face down; mention it in the summary.
- Text: `linear_extrude(0.6) text(..., size ≥ 5, font="Liberation Sans:style=Bold")`.
- Threads: use clearance holes plus heat-set inserts or nut traps instead of modelling threads,
unless the user asks for printed threads.
## 3. Render and check
- Run `openscad` with `formats: ["stl", "png"]` (add `"3mf"` for the final version) and the
views that show the important features (default iso, front, top).
- Check the **bounding box** against the required dimensions and the **warnings** (a
non-manifold result must be fixed before printing).
- Compare the previews with the sketch: proportions, feature positions, counts (holes, ribs),
orientation. Fix differences and render again. Two or three iterations are normal.
- For variants, use `params` to override variables instead of copying the file.
## 4. Deliver
Summarise briefly:
- Files: `.scad` (editable), `.stl` / `.3mf` (printable), previews.
- Final dimensions (bounding box) and the key parameters the user may want to change.
- Print hints: orientation, supports needed or not, suggested layer height/infill for the use.
- Assumptions you made.
The STL/3MF can be previewed in the file manager (3D view).