Back to Creative & Visual

OpenSCAD Model Management

3d-printingopenscadcadparametric-designautomation
4.3 (44)2.6k📄 Apache-2.0🕒 2026-06-14Source ↗

Install this skill

npx skills add mitsuhiko/agent-stuff

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

What this skill does

  • Execute automated syntax checks on OpenSCAD source files
  • Generate multi-perspective visual previews including isometric views
  • Extract customizable model parameters for automated adjustment
  • Export validated designs to STL format for 3D printing
  • Pass custom parameters during the STL generation process

When to use it

  • Creating parametric 3D parts that require multiple size iterations
  • Validating geometry before sending files to a 3D printer
  • Generating documentation images for MakerWorld or project repositories
  • Testing custom script-based mechanical designs for symmetry and alignment

When not to use it

  • Complex freeform organic modeling better suited for Blender or Maya
  • Large-scale assemblies that exceed OpenSCAD's geometry processing limits

How to invoke it

Example prompts that trigger this skill:

  • Validate the syntax of my new 3D model file
  • Generate previews of the component from all angles to check for errors
  • Export an STL file for the current design with custom height parameters
  • Extract the list of adjustable variables from this OpenSCAD script
  • Create a set of isometric and side-view images for this design

Example workflow

  1. Write the initial OpenSCAD code with parameter definitions
  2. Run the validation tool to catch syntax errors
  3. Execute the multi-preview script to generate visual snapshots
  4. Inspect the PNG outputs for hidden geometric overlaps or misalignments
  5. Adjust parameters in the source and run the export-stl tool

Prerequisites

  • OpenSCAD installed on the local system
  • Bash environment for running shell-based tools

Pitfalls & limitations

  • !Syntax validation does not detect logical issues like floating geometry or non-manifold meshes
  • !Visual inspection is strictly manual and required to catch Z-fighting and alignment errors
  • !Large parametric ranges can lead to exported STL files that are overly dense or invalid

FAQ

Why is visual validation required?
Code syntax validation only confirms that the script runs, not that the output is physically sound or aesthetically correct. Visual checks catch issues like internal overlaps or disconnected parts.
Can I export different sizes of the same model?
Yes, the export tool accepts -D flags, allowing you to pass custom parameter values during the STL generation phase without editing the base source file.
What camera angles are supported for previews?
You can customize camera positions using a six-coordinate string representing rotation and distance. Standard presets for isometric, top, and side views are provided in the tool documentation.

How it compares

While manual operation requires clicking through the OpenSCAD GUI for every change, this skill enables a CLI-driven pipeline that integrates directly into automated dev workflows and CI/CD pipelines.

Source & trust

2.6k stars📄 Apache-2.0🕒 Updated 2026-06-14🛡 runs-shell

From the source: “# OpenSCAD Skill Create, validate, and export OpenSCAD 3D models. Supports parameter customization, visual preview from multiple angles, and STL export for 3D printing platforms like MakerWorld. ## Prerequisites OpenSCAD must be installed. Install via Homebrew: ```bash brew install openscad ``` ## T…”

View the full SKILL.md source

# OpenSCAD Skill

Create, validate, and export OpenSCAD 3D models. Supports parameter customization, visual preview from multiple angles, and STL export for 3D printing platforms like MakerWorld.

## Prerequisites

OpenSCAD must be installed. Install via Homebrew:
```bash
brew install openscad
```

## Tools

This skill provides several tools in the `tools/` directory:

### Preview Generation
```bash
# Generate a single preview image
./tools/preview.sh model.scad output.png [--camera=x,y,z,tx,ty,tz,dist] [--size=800x600]

# Generate multi-angle preview (front, back, left, right, top, iso)
./tools/multi-preview.sh model.scad output_dir/
```

### STL Export
```bash
# Export to STL for 3D printing
./tools/export-stl.sh model.scad output.stl [-D 'param=value']
```

### Parameter Extraction
```bash
# Extract customizable parameters from an OpenSCAD file
./tools/extract-params.sh model.scad
```

### Validation
```bash
# Check for syntax errors and warnings
./tools/validate.sh model.scad
```

## Visual Validation (Required)

**Always validate your OpenSCAD models visually after creating or modifying them.**

After writing or editing any OpenSCAD file:

1. **Generate multi-angle previews** using `multi-preview.sh`
2. **View each generated image** using the `read` tool
3. **Check for issues** from multiple perspectives:
   - Front/back: Verify symmetry, features, and proportions
   - Left/right: Check depth and side profiles
   - Top: Ensure top features are correct
   - Isometric: Overall shape validation
4. **Iterate if needed**: If something looks wrong, fix the code and re-validate

This catches issues that syntax validation alone cannot detect:
- Inverted normals or inside-out geometry
- Misaligned features or incorrect boolean operations
- Proportions that don't match the intended design
- Missing or floating geometry
- Z-fighting or overlapping surfaces

**Never deliver an OpenSCAD model without visually confirming it looks correct from multiple angles.**

## Workflow

### 1. Creating an OpenSCAD Model

Write OpenSCAD code with customizable parameters at the top:

```openscad
// Customizable parameters
wall_thickness = 2;        // [1:0.5:5] Wall thickness in mm
width = 50;                // [20:100] Width in mm
height = 30;               // [10:80] Height in mm
rounded = true;            // Add rounded corners

// Model code below
module main_shape() {
    if (rounded) {
        minkowski() {
            cube([width - 4, width - 4, height - 2]);
            sphere(r = 2);
        }
    } else {
        cube([width, width, height]);
    }
}

difference() {
    main_shape();
    translate([wall_thickness, wall_thickness, wall_thickness])
        scale([1 - 2*wall_thickness/width, 1 - 2*wall_thickness/width, 1])
        main_shape();
}
```

Parameter comment format:
- `// [min:max]` - numeric range
- `// [min:step:max]` - numeric range with step
- `// [opt1, opt2, opt3]` - dropdown options
- `// Description text` - plain description

### 2. Validate the Model
```bash
./tools/validate.sh model.scad
```

### 3. Generate Previews

Generate preview images to visually validate the model:
```bash
./tools/multi-preview.sh model.scad ./previews/
```

This creates PNG images from multiple angles. Use the `read` tool to view them.

### 4. Export to STL
```bash
./tools/export-stl.sh model.scad output.stl
# With custom parameters:
./tools/export-stl.sh model.scad output.stl -D 'width=60' -D 'height=40'
```

## Camera Positions

Common camera angles for previews:
- **Isometric**: `--camera=0,0,0,45,0,45,200`
- **Front**: `--camera=0,0,0,90,0,0,200`
- **Top**: `--camera=0,0,0,0,0,0,200`
- **Right**: `--camera=0,0,0,90,0,90,200`

Format: `x,y,z,rotx,roty,rotz,distance`

## MakerWorld Publishing

For MakerWorld, you typically need:
1. STL file(s) exported via `export-stl.sh`
2. Preview images (at least one good isometric view)
3. A description of customizable parameters

Consider creating a `model.json` with metadata:
```json
{
  "name": "Model Name",
  "description": "Description for MakerWorld",
  "parameters": [...],
  "tags": ["functional", "container", "organizer"]
}
```

## Example: Full Workflow

```bash
# 1. Create the model (write .scad file)

# 2. Validate syntax
./tools/validate.sh box.scad

# 3. Generate multi-angle previews
./tools/multi-preview.sh box.scad ./previews/

# 4. IMPORTANT: View and validate ALL preview images
#    Use the read tool on each PNG file to visually inspect:
#    - previews/box_front.png
#    - previews/box_back.png
#    - previews/box_left.png
#    - previews/box_right.png
#    - previews/box_top.png
#    - previews/box_iso.png
#    Look for geometry issues, misalignments, or unexpected results.
#    If anything looks wrong, go back to step 1 and fix it!

# 5. Extract and review parameters
./tools/extract-params.sh box.scad

# 6. Export STL with default parameters
./tools/export-stl.sh box.scad box.stl

# 7. Export STL with custom parameters
./tools/export-stl.sh box.scad box_large.stl -D 'width=80' -D 'height=60'
```

**Remember**: Never skip the visual validation step. Many issues (wrong dimensions, boolean operation errors, inverted geometry) are only visible when you actually look at the rendered model.

## OpenSCAD Quick Reference

### Basic Shapes
```openscad
cube([x, y, z]);
sphere(r = radius);
cylinder(h = height, r = radius);
cylinder(h = height, r1 = bottom_r, r2 = top_r);  // cone
```

### Transformations
```openscad
translate([x, y, z]) object();
rotate([rx, ry, rz]) object();
scale([sx, sy, sz]) object();
mirror([x, y, z]) object();
```

### Boolean Operations
```openscad
union() { a(); b(); }        // combine
difference() { a(); b(); }   // subtract b from a
intersection() { a(); b(); } // overlap only
```

### Advanced
```openscad
linear_extrude(height) 2d_shape();
rotate_extrude() 2d_shape();
hull() { objects(); }        // convex hull
minkowski() { a(); b(); }    // minkowski sum (rounding)
```

### 2D Shapes
```openscad
circle(r = radius);
square([x, y]);
polygon(points = [[x1,y1], [x2,y2], ...]);
text("string", size = 10);
```

Quoted from mitsuhiko/agent-stuff for reference — see the original for the authoritative, latest version.

📄 Full skill instructions — original source: mitsuhiko/agent-stuff
This skill provides a programmatic interface for developers to generate, iterate, and export 3D models using the OpenSCAD engine. It streamlines the mechanical design lifecycle by automating syntax validation, parameter extraction, and multi-angle preview generation. Ideal for engineers or makers building modular 3D-printable components, the tool ensures geometric integrity through visual regression testing from multiple perspectives. By automating the transition from code to STL, it allows for rapid prototyping of parametric objects while maintaining clear documentation of dimensions and constraints. The skill bridge helps developers maintain consistency across iterative design cycles, simplifying the publishing process for platforms like MakerWorld by enforcing high standards for geometry and parameter documentation.

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/openscad/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/mitsuhiko/agent-stuff/openscad/SKILL.md
  • Cursor: ~/.cursor/skills/mitsuhiko/agent-stuff/openscad/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/mitsuhiko/agent-stuff/openscad/SKILL.md

🚀 Install with CLI:
npx skills add mitsuhiko/agent-stuff

Read the Master Guide: Mastering Agent Skills

Recommended Rules

View more rules

Recommended Workflows

View more workflows

Recommended MCP Servers

View more MCP servers

Take It Further

Maximize your productivity with these powerful resources

📋

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
📖

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid creative & visual issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under Creative & Visual and is published by mitsuhiko, maintained in mitsuhiko/agent-stuff.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.