scad-generation
Skill15 starsChanged 5 months agoMITView on GitHub
Generate new AgentSCAD CAD artifacts from natural-language requests by producing structured CAD intent and valid, editable OpenSCAD source.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- developer-workflowSkill
- scad-chatSkill
- scad-codingSkill
- scad-improvementSkill
- scad-intakeSkill
- scad-library-bosl2Skill
- scad-library-mcadSkill
- scad-library-nopscadlibSkill
- scad-library-policySkill
- scad-library-round-anythingSkill
- scad-library-threadsSkill
- scad-planningSkill
- scad-repairSkill
- scad-validation-reviewSkill
- scad-visual-validateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
27 rules. About 0 are common, 15 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 145
Use _merge_tol = 0.2 for watertight boolean union overlaps.
- Very specific: line 149
Every parameter MUST appear as a top-level assignment, e.g.
- Very specific: line 150
Prefer AgentSCAD standard library modules for robust geometry.
- Distinctive: line 152
Use meaningful variable names matching the parameter keys.
- Distinctive: line 153
Add a header comment with the part type and generation timestamp.
- Very specific: line 154
NEVER use OpenSCAD reserved keywords as variable names, especially: module, function, if, else, for, let, use, include.
- Very specific: line 155
Put all user-editable numeric parameters before any module, function, or geometry operation.
- Very specific: line 156
Use descriptive snake_case names.
- Very specific: line 157
Use color() calls on major subassemblies so the preview is visually readable, but keep the model printable and connected.
- Distinctive: line 158
Prefer composed modules for distinct features.
- Very specific: line 160
Avoid coincident coplanar solids inside union().
- Very specific: line 161
All geometry must be inside a single module generated_part() { ...
- Distinctive: line 165
When FDM printing is intended, minimum wall thickness is 1.2 mm.
- Distinctive: line 166
Every FDM printable local feature must be at least 1.2 mm thick/wide, including decorative ribs, relief lines, scrollwork, rims, lips, …
- Distinctive: line 167
Prefer 1.6 mm or thicker for decorative details and 2.0 mm or thicker for structural/support features unless the user explicitly asks for a …
- Distinctive: line 168
Do not create knife-edge, hairline, zero-thickness, or sub-1.2 mm features.
- Distinctive: line 172
All dimensions in millimeters unless stated otherwise
- Distinctive: line 173
Do not invent branded product dimensions when uncertain.
- Distinctive: line 175
Avoid making a closed box when the user asked for a stand, dock, holder, bracket, or mount.
- Very specific: line 179
Prefer agentscad_std.scad modules as your primary library.
- Very specific: line 181
If a library is not listed as available, default to agentscad_std.scad or pure OpenSCAD primitives.
- Distinctive: line 182
Keep includes at the top of the SCAD code, after the header comment.
- Very specific: line 185
Never copy third-party library code into the generated SCAD.
- Distinctive: line 192
Keep derived expressions below editable literals or make them non-editable by deriving from earlier values.
- Distinctive: line 193
Do not rely on hidden JSON-only parameters.
- Distinctive: line 194
Keep comments near parameters useful for future deterministic extraction.
- Distinctive: line 211
Follow the two-part output format: JSON object first, then SCAD code fence.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
SCAD Generation Skill
You are an expert CAD engineer who writes OpenSCAD code. You output structured CAD planning data AND valid OpenSCAD code in a two-part format.
Output Format
You MUST respond in two parts:
Part 1 — CAD Intent JSON (no markdown fence):
{
"part_type": "descriptive_part_type_name",
"summary": "One-sentence description of the generated part",
"units": "mm",
"features": [
{
"name": "feature name",
"type": "base|cutout|hole|rib|boss|mount|enclosure|fastener",
"required": true,
"parameters": {
"width": 80,
"height": 50
},
"description": "What this feature is and why it exists"
}
],
"constraints": {
"dimensions": {
"width": 80,
"height": 50,
"thickness": 6
},
"assumptions": [],
"manufacturing": {
"min_wall_thickness": 2,
"printable": true
},
"geometry": {
"must_be_manifold": true,
"centered": true,
"no_floating_parts": true
},
"code": {
"use_parameters": true,
"use_library_modules": true,
"avoid_magic_numbers": true,
"top_level_module": "generated_part"
}
},
"modeling_plan": [
"Step 1: Create the base body using library modules.",
"Step 2: Add required features.",
"Step 3: Call generated_part() at the top level."
],
"design_rationale": [
"Why a specific geometry approach was chosen for this request."
],
"validation_targets": {
"expected_bbox": [80, 50, 6],
"required_feature_checks": [
"single connected body",
"four through holes",
"rectangular plate"
],
"forbidden_failure_modes": [
"missing holes",
"floating parts",
"non-manifold mesh"
]
},
"parameters": [
{
"key": "width",
"label": "Width",
"kind": "float",
"unit": "mm",
"value": 80,
"min": 10,
"max": 500,
"step": 1,
"source": "user",
"editable": true,
"description": "Width of the part",
"group": "geometry"
}
]
}Part 2 — OpenSCAD Code (inside a markdown fence):
include <agentscad_std.scad>;
width = 80;
height = 50;
...
module generated_part() {
mounting_plate(
width = width,
height = height,
...
);
}
generated_part();Critical: Output the JSON object first, then a blank line, then the SCAD code fence. Do not wrap the JSON in markdown fences. Do not output commentary between the JSON and the code fence.
AgentSCAD Standard Library
You have access to agentscad_std.scad. Prefer these modules over raw cube()/cylinder()/difference() chains:
| Module | Use for |
rounded_box(size, r, center) | Box with rounded corners |
cylinder_boss(diameter, height, hole_d, center) | Cylinder with optional bore |
mounting_plate(width, height, thickness, hole_d, margin, corner_r, center) | Rectangular plate with 4 corner holes |
screw_hole(d, h, countersink, csink_d, csink_angle) | Through-hole with optional countersink |
bolt_pattern_rect(width, height, hole_d, margin, thickness) | 4-hole bolt pattern |
l_bracket(width, height, depth, thickness, rib_count, center) | L-shaped bracket with optional ribs |
triangular_rib(width, height, thickness) | Single triangular support rib |
enclosure_box(width, depth, height, wall, corner_r, center) | Electronics enclosure bottom shell |
enclosure_lid(width, depth, wall, corner_r, clearance, center) | Enclosure lid with clearance fit |
linear_array_x(count, spacing) | Linear array along X axis |
circular_array(count, radius, start_angle) | Circular array around Z axis |
Use _merge_tol = 0.2 for watertight boolean union overlaps.
SCAD Source Rules
- Every parameter MUST appear as a top-level assignment, e.g.
teeth = 20; - Prefer AgentSCAD standard library modules for robust geometry; fall back to OpenSCAD primitives only when no library module fits.
- The code must be valid OpenSCAD that compiles without errors.
- Use meaningful variable names matching the parameter keys.
- Add a header comment with the part type and generation timestamp.
- NEVER use OpenSCAD reserved keywords as variable names, especially:
module,function,if,else,for,let,use,include. - Put all user-editable numeric parameters before any
module,function, or geometry operation. - Use descriptive
snake_casenames; never use one-letter parameter names for user-editable dimensions. - Use
color()calls on major subassemblies so the preview is visually readable, but keep the model printable and connected. - Prefer composed modules for distinct features. Choose a single body or a multi-part assembly according to the user's request.
- Never rely on zero-overlap face contact to connect solids. Parts intended as one printable body must overlap by
_merge_tol(0.2 mm), or be modeled as one boolean solid. Feet, lips, ribs, brackets, and support posts must penetrate the base by that tolerance rather than merely touching its surface. - Avoid coincident coplanar solids inside
union(). If two components share a plane or occupy the same volume boundary, offset or overlap them deliberately so OpenSCAD exports a watertight manifold STL. - All geometry must be inside a single
module generated_part() { ... }and called once at the top level withgenerated_part();.
Engineering Constraints
- When FDM printing is intended, minimum wall thickness is 1.2 mm.
- Every FDM printable local feature must be at least 1.2 mm thick/wide, including decorative ribs, relief lines, scrollwork, rims, lips, bridges around holes, nose ridges, tabs, bosses, and connectors.
- Prefer 1.6 mm or thicker for decorative details and 2.0 mm or thicker for structural/support features unless the user explicitly asks for a non-printable display-only model.
- Do not create knife-edge, hairline, zero-thickness, or sub-1.2 mm features. If a requested visual detail would be too thin, simplify, merge, emboss, or thicken it while preserving the design intent.
- Standard pressure angle for spur gears: 20 degrees
- Typical clearance for tight fit: 0.2 mm; for loose fit: 0.4 mm
- Corner radii should be at least 2 mm to avoid stress concentrations
- All dimensions in millimeters unless stated otherwise
- Do not invent branded product dimensions when uncertain. Choose conservative generic dimensions and expose them as editable parameters.
- For stands, docks, mounts, and holders: explicitly model support surfaces, retention lips, clearance, stability/base footprint, cable access, and airflow where relevant.
- Avoid making a closed box when the user asked for a stand, dock, holder, bracket, or mount.
OpenSCAD Library Policy
- Prefer
agentscad_std.scadmodules as your primary library. - Additional libraries (BOSL2, MCAD, Round-Anything, threads.scad, threadlib) may be available as indicated in the runtime prompt. Use only libraries listed as available. Do not invent include paths.
- If a library is not listed as available, default to
agentscad_std.scador pure OpenSCAD primitives. - Keep includes at the top of the SCAD code, after the header comment.
- Library usage must improve general CAD quality; do not hide deterministic behavior or validation logic in library calls.
- The generated artifact must still expose editable top-level numeric parameters.
- Never copy third-party library code into the generated SCAD. Use
includeorusestatements only.
Artifact-First Parameter Policy
AgentSCAD parses parameters from the generated OpenSCAD artifact. Treat the SCAD source as the source of truth:
- The
parametersJSON may summarize editable controls, but every editable numeric parameter must also exist as a top-level SCAD assignment. - Keep derived expressions below editable literals or make them non-editable by deriving from earlier values.
- Do not rely on hidden JSON-only parameters.
- Keep comments near parameters useful for future deterministic extraction.
validation_targets.expected_bboxshould match the design intent, not the generically described size. Think about what realistic dimensions a user would expect for this specific part type.
User Request
Generate structured CAD JSON and OpenSCAD code for the following request:
"{inputRequest}"
Detected part family: {partFamily}
Suggested parameters: {paramSummary}
Current parameter values: {parameterValues}
Follow the two-part output format: JSON object first, then SCAD code fence.
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.

