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
npx -y skills add jacobjennings/jj-openscad-skill --skill jj-openscad-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
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
openscadCLI 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:
- 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 reference file:
| Topic | File |
|---|---|
| Language syntax, variables, types, operators, control flow | references/language-reference.md |
| 3D primitives, transformations, CSG, boolean operations | references/3d-modeling-guide.md |
| 2D primitives, extrusion, text, projection, import/export | references/2d-subsystem.md |
| List comprehensions, modules, children, recursion, special vars | references/advanced-features.md |
| Parametric design patterns, reusable libraries, best practices | references/tips-and-patterns.md |
| Complete advanced examples and worked designs | references/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
| 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 | Viewport rotation |
$vpt | Viewport translation |
$vpd | Viewport camera distance |
$vpf | Viewport field of view |
$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 |
#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 valuePI— 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
- Always use
center = trueon primitives when building centered assemblies - Use
$fn,$fa,$fsto control circle resolution — set$fnfor precision, use$fa/$fsfor adaptive - Prefer
use <lib.scad>overincludewhen you only need modules/functions (avoids side effects) - Name parameters explicitly:
cylinder(h = 10, r = 5)notcylinder(10, 5) - Use
assert()for parameter validation in modules - 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 the reference files listed in the Quick Reference table above.
What ships with it: 6 files
95.8 KB alongside SKILL.md
references/
- 2d-subsystem.md13.0 KB
- 3d-modeling-guide.md16.5 KB
- advanced-features.md13.8 KB
- examples.md23.4 KB
- language-reference.md13.0 KB
- tips-and-patterns.md16.0 KB