Jj openscad lite skill
Skill jacobjennings/jj-openscad-lite-skill/jj-openscad-lite-skill
Lightweight OpenSCAD code generation skill 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
npx -y skills add jacobjennings/jj-openscad-lite-skill --skill jj-openscad-lite-skillAssembled 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
7.3 KB, ~2.0k tokens by cl100k_base, as published. Nobody here has run it
OpenSCAD Code Generation Skill (Lite)
CRITICAL RULE: NO TOOLS
Do NOT use any external tools, linters, compilers, renderers, or validation
checks when generating OpenSCAD code. Do NOT run openscad CLI, linters,
renderers, or build systems. Generate code purely from knowledge.
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:
- Parametric by default — use variables, not magic numbers
- Modules for reuse — encapsulate geometry in named modules with parameters
- CSG composition — build complex shapes from primitives via
union,difference,intersection - 2D → 3D pipeline — define 2D profiles, extrude to 3D
- Functional style — prefer list comprehensions and functions over imperative loops
Quick Reference
For detailed information on any topic, read the corresponding section in the single combined reference file:
| Topic | Section in references/reference.md |
|---|---|
| Language syntax, variables, types, operators, control flow | Language Reference |
| 3D primitives, transformations, CSG, boolean operations | 3D Modeling |
| 2D primitives, extrusion, text, projection, import/export | 2D Subsystem |
| List comprehensions, modules, children, recursion, special vars | Advanced Features |
| Parametric design patterns, reusable libraries, best practices | Tips and Patterns |
Core Syntax at a Glance
// Variables (immutable, no reassignment)
width = 10; height = 20; name = "bracket";
// Conditional assignment / ternary
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 vs Use
include <lib.scad> // imports code, executes top-level statements
use <lib.scad> // imports modules/functions only
Primitives
// 3D
sphere(r = 10); sphere(d = 20);
cube([10, 20, 30], center = true); cube(10); // shorthand
cylinder(h = 20, r = 5, center = true);
cylinder(h = 20, r1 = 10, r2 = 5); // truncated cone
polyhedron(points = [...], faces = [...]);
// 2D
circle(r = 10); 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 (degrees)
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: round offset
offset(delta = 2, chamfer = true) { ... } // 2D: chamfered
hull() { ... } // convex hull
minkowski() { ... } // Minkowski sum (expensive)
Boolean / CSG Operations
union() { ... } // default if not specified
difference() { body(); holes(); }
intersection() { ... }
Extrusion
linear_extrude(height = 10, center = true, twist = 90, slices = 50, scale = 0.5) {
circle(r = 5);
}
rotate_extrude(angle = 270, $fn = 100) {
translate([10, 0, 0]) circle(r = 2); // must be in positive X half-plane
}
Control Flow
// For loop (geometry context — no break/continue)
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]) { ... } // explicit list
for (i = list, j = list2) { ... } // nested (parallel)
// If statement (no else-if chain; use ternary)
if (condition) { ... }
if (condition) { ... } else { ... }
// Let statement (creates new scope)
let (x = 5, y = 10) { ... }
// Intersection for
intersection_for(i = [0:5]) { ... }
List Comprehensions
[for (i = [0:10]) i * 2] // generate
[for (i = [0:10]) if (i % 2 == 0) i] // filter
[for (a = list1) each a] // flatten
[for (i = [0:10]) let (x = i*2) x + 1] // let binding
[for (i = [0:3]) for (j = [0:3]) [i, j]] // nested (product)
Special Variables
| Variable | Purpose |
|---|---|
$fa | Minimum angle (degrees) for circle resolution |
$fs | Minimum size (mm) for circle resolution |
$fn | Fixed number of segments for circles |
$t | Animation step (0-1) |
$vpr, $vpt, $vpd, $vpf | Viewport rotation, translation, distance, FOV |
$preview | true in preview (F5), false in render (F6) |
$children | Number of children in a module |
Modifier Characters
| Prefix | Name | Effect |
|---|---|---|
* | Disable | Disable the object |
! | Root | Show only this object (and its children) |
# | Debug | Highlight/transparent debug view |
% | Background | Show as transparent background |
Built-in Functions
- Math:
abs,sign,sin,cos,tan,acos,asin,atan,atan2,floor,round,ceil,ln,log,pow,sqrt,exp,rands,min,max,norm,cross - Type test:
is_undef,is_bool,is_num,is_string,is_list,is_function - List/String:
len,concat,str,chr,ord,search,lookup - Other:
echo,assert,render,children,version,version_num,parent_module - Constants:
undef,PI
Import/Export
// Import 2D: import("file.dxf"), import("file.svg")
// Import 3D: import("file.stl", convexity = 10), .off, .amf, .3mf
// Surface: surface(file = "data.dat", center = true), surface(file = "image.png")
// Export is done via GUI or CLI: -o output.stl
Best Practices
- Always use
center = trueon primitives when building centered assemblies - Use
$fn,$fa,$fsper-object, not globally - Prefer
use <lib.scad>overincludewhen you only need modules/functions - Name parameters explicitly:
cylinder(h = 10, r = 5)notcylinder(10, 5) - Use
assert()for parameter validation - Use
$previewto switch between fast preview and full render geometry - Use modifier characters (
#,%) for debugging without modifying code - Keep modules small and composable — one module = one logical part
- Use list comprehensions instead of imperative for-loops for data transformation
- Document with comments — OpenSCAD has no docstring convention
For detailed patterns, advanced examples, and complete worked designs, read references/reference.md.
What ships with it: 1 file
38.6 KB alongside SKILL.md
references/
- reference.md38.6 KB