agentsclimarketplace

Jj openscad skill

Skill jacobjennings/jj-openscad-skill/jj-openscad-skill

Generate OpenSCAD code for 3D CAD modeling. Use when the user asks to create, modify, or reason about OpenSCAD (.scad) files, 3D models, parametric designs, CSG operations, 2D/3D geometry, extrusion, or solid modeling. Covers all OpenSCAD language features including primitives, transformations, boolean operations, list comprehensions, modules, functions, and advanced patterns. Also use for questions about OpenSCAD syntax, best practices, or parametric design patterns.From its SKILL.md

Install
npx -y skills add jacobjennings/jj-openscad-skill --skill jj-openscad-skill

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

9.6 KB, ~2.6k tokens by cl100k_base, as published. Nobody here has run it

OpenSCAD Code Generation Skill

CRITICAL RULE: NO TOOLS

Do NOT use any external tools, linters, compilers, renderers, or validation checks when generating OpenSCAD code. This means:

  • Do NOT run openscad CLI or any OpenSCAD binary
  • Do NOT use linters, syntax checkers, or static analysis tools
  • Do NOT attempt to render, preview, or export models
  • Do NOT use make, cmake, or build systems for OpenSCAD files
  • Do NOT run any scripts to validate or test generated code

Generate code purely from knowledge. Write syntactically correct, idiomatic OpenSCAD code directly. If the user asks to verify or test code, explain that tool-based verification is not available and provide reasoning about correctness from the language specification instead.

How to Write OpenSCAD Code

OpenSCAD is a declarative, functional 3D compiler — not an interactive modeller. Code describes geometry; the engine renders it. Key principles:

  1. Parametric by default — use variables, not magic numbers
  2. Modules for reuse — encapsulate geometry in named modules with parameters
  3. CSG composition — build complex shapes from primitives via union, difference, intersection
  4. 2D → 3D pipeline — define 2D profiles, extrude to 3D
  5. Functional style — prefer list comprehensions and functions over imperative loops

Quick Reference

For detailed information on any topic, read the corresponding reference file:

TopicFile
Language syntax, variables, types, operators, control flowreferences/language-reference.md
3D primitives, transformations, CSG, boolean operationsreferences/3d-modeling-guide.md
2D primitives, extrusion, text, projection, import/exportreferences/2d-subsystem.md
List comprehensions, modules, children, recursion, special varsreferences/advanced-features.md
Parametric design patterns, reusable libraries, best practicesreferences/tips-and-patterns.md
Complete advanced examples and worked designsreferences/examples.md

Core Syntax at a Glance

// Variables
width = 10;
height = 20;
name = "bracket";

// Conditional assignment
x = (width > 5) ? 10 : 20;

// Function literal
f = function(x) x * 2;

// Module definition
module my_box(w, h, d) {
    cube([w, h, d], center = true);
}

// Function definition
function add(a, b) = a + b;

// Include (imports code, executes top-level statements)
include <lib.scad>

// Use (imports modules/functions only, no top-level execution)
use <lib.scad>

3D Primitives

sphere(r = 10);              // or sphere(d = 20);
cube([10, 20, 30], center = true);
cube(10);                    // shorthand for cube([10,10,10])
cylinder(h = 20, r = 5, center = true);
cylinder(h = 20, r1 = 10, r2 = 5);  // truncated cone
polyhedron(points = [...], faces = [...]);

2D Primitives

circle(r = 10);              // or circle(d = 20);
square([10, 20], center = true);
polygon(points = [[0,0], [10,0], [5,10]]);
text("Hello", size = 10, font = "Liberation Sans");

Transformations

translate([x, y, z]) { ... }
rotate([x, y, z]) { ... }          // Euler angles
rotate(a = 45, v = [0, 0, 1]) { ... } // axis-angle
scale([x, y, z]) { ... }
mirror([1, 0, 0]) { ... }          // mirror across YZ plane
resize([x, y, z]) { ... }
color("red", alpha = 0.5) { ... }
color([1, 0, 0, 0.5]) { ... }      // RGBA 0-1
multmatrix(m) { ... }              // 4x4 transform matrix
offset(r = 2) { ... }              // 2D offset
offset(delta = 2, chamfer = true) { ... }
hull() { ... }                     // convex hull of children
minkowski() { ... }                // Minkowski sum

Boolean / CSG Operations

union() { ... }                    // default if not specified
difference() { body(); holes(); }
intersection() { ... }

Extrusion

linear_extrude(height = 10, center = true, twist = 90, slices = 50) {
    circle(r = 5);
}
rotate_extrude(angle = 270, $fn = 100) {
    translate([10, 0, 0]) circle(r = 2);
}

Control Flow

// For loop (in module context — creates geometry)
for (i = [0:10]) { translate([i*5, 0, 0]) cube(3); }
for (i = [0:2:10]) { ... }         // step of 2
for (i = [1, 3, 7, 9]) { ... }    // list
for (i = list, j = list2) { ... }  // nested

// If statement
if (condition) { ... }
if (condition) { ... } else { ... }

// Let statement
let (x = 5, y = 10) { ... }

// Intersection for
intersection_for(i = [0:5]) { ... }

List Comprehensions

// Generate
[for (i = [0:10]) i * 2]
[for (i = [0:10]) if (i % 2 == 0) i]

// Flatten
[for (a = list1) each a]

// Let
[for (i = [0:10]) let (x = i*2) x + 1]

// Nested
[for (i = [0:3]) for (j = [0:3]) [i, j]]

Special Variables

VariablePurpose
$faMinimum angle (degrees) for circle resolution
$fsMinimum size (mm) for circle resolution
$fnFixed number of segments for circles
$tAnimation step (0-1)
$vprViewport rotation
$vptViewport translation
$vpdViewport camera distance
$vpfViewport field of view
$previewtrue in preview (F5), false in render (F6)
$childrenNumber of children in a module

Modifier Characters

PrefixNameEffect
*DisableDisable the object
!RootShow only this object (and its children)
#DebugHighlight/transparent debug view
%BackgroundShow as transparent background
#cube(10);        // highlight for debugging
%sphere(5);       // show as transparent background
!cylinder(r=3);   // show only this subtree
*cube(10);        // disabled, not rendered

Mathematical Functions

abs, sign, sin, cos, tan, acos, asin, atan, atan2, floor, round, ceil, ln, log, pow, sqrt, exp, rands, min, max, norm, cross, len, concat, lookup, str, chr, ord, search

Type Test Functions

is_undef, is_bool, is_num, is_string, is_list, is_function

Other Functions

echo(...), render(convexity), children([idx]), assert(condition, message), version(), version_num(), parent_module(idx)

Constants

  • undef — undefined value
  • PI — mathematical constant π (~3.14159)

Import/Export

// Import 2D
import("file.dxf");
import("file.svg");

// Import 3D
import("file.stl", convexity = 10);
import("file.off");
import("file.amf");
import("file.3mf");

// Surface (heightmap)
surface(file = "data.dat", center = true);
surface(file = "image.png", center = true);

// Export is done via GUI or CLI: -o output.stl

Community Libraries

When the user needs specialized functionality, suggest these well-known libraries:

  • BOSL2 — Comprehensive: attachments, threading, gears, beziers, math, shapes
  • NopSCADlib — Hardware parts (screws, bearings, PCBs), BOM generation
  • dotSCAD — Math-heavy: path generation, fractals, Voronoi, maze
  • BOLTS — Standard parts database (ISO screws, bearings, profiles)
  • Round Anything — Rounded corners and fillets on 2D/3D shapes
  • threads.scad — Thread generation (metric, imperial, custom)
  • YAPP — Parametric electronics enclosure generator
  • STEMFIE — Construction set parts library
  • Catch'n'Hole — Snap-fit and catch mechanism generator
  • Pathbuilder — Path-based 2D shape builder
  • SCON — JSON serialization for OpenSCAD
  • Constructive — Constraint-like mechanical part composition
  • StoneAgeLib — General-purpose 3D printing utilities (CC0)
  • UB.scad — Full 3D printing workflow solution
  • Functional OpenSCAD — Functional programming extensions
  • Mark's Enclosure Helper — Parametric enclosure generator
  • funcutils — Functional utility functions
  • Tray — Organizational tray generator
  • Altair's 2D Library — Extended 2D shapes
  • Doll House — Architectural modeling
  • Dimensions — Dimension annotation for models

Best Practices

  1. Always use center = true on primitives when building centered assemblies
  2. Use $fn, $fa, $fs to control circle resolution — set $fn for precision, use $fa/$fs for adaptive
  3. Prefer use <lib.scad> over include when you only need modules/functions (avoids side effects)
  4. Name parameters explicitly: cylinder(h = 10, r = 5) not cylinder(10, 5)
  5. Use assert() for parameter validation in modules
  6. Use $preview to switch between fast preview and full render geometry
  7. Use modifier characters (#, %) for debugging without modifying code
  8. Keep modules small and composable — one module = one logical part
  9. Use list comprehensions instead of imperative for-loops for data transformation
  10. Document with comments — OpenSCAD has no docstring convention

For detailed patterns, advanced examples, and complete worked designs, read the reference files listed in the Quick Reference table above.

What ships with it: 6 files

95.8 KB alongside SKILL.md

Keep looking

Skills are one crate of 326,367. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.