agentsclimarketplace

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

Install
npx -y skills add jacobjennings/jj-openscad-lite-skill --skill jj-openscad-lite-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

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:

  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 section in the single combined reference file:

TopicSection in references/reference.md
Language syntax, variables, types, operators, control flowLanguage Reference
3D primitives, transformations, CSG, boolean operations3D Modeling
2D primitives, extrusion, text, projection, import/export2D Subsystem
List comprehensions, modules, children, recursion, special varsAdvanced Features
Parametric design patterns, reusable libraries, best practicesTips 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

VariablePurpose
$faMinimum angle (degrees) for circle resolution
$fsMinimum size (mm) for circle resolution
$fnFixed number of segments for circles
$tAnimation step (0-1)
$vpr, $vpt, $vpd, $vpfViewport rotation, translation, distance, FOV
$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

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

  1. Always use center = true on primitives when building centered assemblies
  2. Use $fn, $fa, $fs per-object, not globally
  3. Prefer use <lib.scad> over include when you only need modules/functions
  4. Name parameters explicitly: cylinder(h = 10, r = 5) not cylinder(10, 5)
  5. Use assert() for parameter validation
  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 references/reference.md.

What ships with it: 1 file

38.6 KB alongside SKILL.md

references/

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.