agentleFS
KevoyuanKevoyuan/AgentSCAD/skills/scad-coding/SKILL.md

scad-coding

Skill26 starsChanged 5 months agoMITView on GitHub

Plan geometry from a persisted request-evidence contract and write valid editable OpenSCAD.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Put all user-editable numeric parameters at the top level before modules or geometry.

    line 20
  2. Very specific:

    Use descriptive snake_case names and never use OpenSCAD reserved words.

    line 21
  3. Very specific:

    Put all geometry in module generated_part(), then call generated_part().

    line 22
  4. Distinctive:

    Prefer available reviewed library modules when they fit.

    line 41
  5. Distinctive:

    Add all required holes, openings, clearances, buttons, ports, ribs, mounts, and other planned features.

    line 42
  6. Distinctive:

    Keep the OpenSCAD artifact as the source of truth: every editable parameter must be a literal top-level assignment.

    line 43
  7. Distinctive:

    Use millimeters unless the generation plan explicitly says otherwise.

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

OpenSCAD Coding Agent

You receive a persisted request-evidence contract. Apply the SCAD planning guidance to choose the geometry, then implement the user's request faithfully. Empty modeling_plan and design_rationale fields mean that no geometry strategy has been selected yet.

Output

Return exactly one scad fenced code block containing the complete artifact. Do not return JSON or prose.

Artifact contract

  • Put all user-editable numeric parameters at the top level before modules or geometry.
  • Use descriptive snake_case names and never use OpenSCAD reserved words.
  • Put all geometry in module generated_part(), then call generated_part(); exactly once.
  • Choose a single body, multiple parts, or an assembly according to the user's request and intended use. Printable solids must be manifold.
  • For an explicitly functional, independently manufacturable, or removable assembly, preserve every required part instance, connection, motion, fitting surface, and requested dimension. Use distinct named part modules with identifiable local frames and compose them within generated_part(). Never fuse separate mating bodies or replace required repeated instances with representative blocks merely to make the model connected or fit the compile budget.
  • For such an assembly, add the versioned /* AGENTSCAD_ASSEMBLY_V1 JSON comment contract described below, plus a top-level agentscad_part = "all"; selector. generated_part() must draw the complete assembly for "all" and exactly the corresponding part definition in its local frame for each declared selector. Never apply instance assembly transforms to a standalone part export. A valid selector or JSON is a declaration, not proof of part identity or fit.
  • Preserve specified mating axes, clearances, motion limits, and assembly or removal paths. Keep missing conditions explicit rather than claim an unknown fit or manufacturing process is verified. Drive actual geometry from movement controls; an animation, parameter, or function alone does not prove motion, collision clearance, assembly, or physical function.

Assembly comment contract: start with /* AGENTSCAD_ASSEMBLY_V1, then one valid JSON object, then END_AGENTSCAD_ASSEMBLY */. No other keys are allowed. Use this structure (empty arrays and nulls are appropriate when details are unknown):

{"schemaVersion":1,"units":"mm","coordinateSystem":"right-handed",
 "parts":[{"id":"base","name":"Base","selector":"base","source":"generated","material":null}],
 "instances":[{"id":"base1","partId":"base","subassemblyId":null,"transform":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}],
 "subassemblies":[],"connections":[],"groundedInstanceId":"base1","motions":[],"operations":[],"manufacturing":null,"assumptions":[],"unknowns":[]}

Transforms are row-major, right-handed local-to-assembly rigid poses. A subassembly is { "id", "name", "parentId" }. Each connection is { "id", "type", "a", "b", "frameA", "frameB", "range", "pitchMm", "ratio", "allowedContact" }: type is fixed, revolute, prismatic, screw, gear, or other; frames are null or { "origin": [x,y,z], "direction": [x,y,z] } in the corresponding local frame; range is null or { "min", "max", "unit": "deg"|"mm" }; unknown pitch and ratio are null; allowedContact is an array of strings. A motion is { "id", "inputConnectionId", "range" }. An operation is { "id", "action": "assemble"|"disassemble", "instanceId", "waypoints": [16-number rigid transforms], "tools": [] }. Manufacturing is null or { "process", "material", "machine", "notes" } with nullable strings. Every referenced ID must exist and each part selector must be unique. Never fabricate specified dimensions, contact surfaces, or manufacturing assumptions; list missing conditions in unknowns.

For a known ideal screw path, an operation may use waypoints: [] and screwTrajectory: {axis:{origin:[x,y,z],direction:[x,y,z]},hand:"right"|"left",leadMm:number,startAngleDeg:number,endAngleDeg:number}. The axis is world-space, the instance pose is the start, angles are degrees, and the positive lead is millimetres per revolution. Positive right-hand rotation advances along the axis, left-hand against it. A declaration alone does not prove engagement, continuous clearance, or physical functionality.

  • CGAL can union solids sharing a full face and subtract cutters ending flush with a surface. Coplanarity alone is not a defect. Avoid connections only along an edge or point, zero-thickness remnants, and degenerate solids. Use a small _merge_tol overlap or cutter extension when useful for parameter robustness; preserve specified dimensions and mating surfaces.
  • The 1.2 mm FDM default applies to wall/feature width; a planar sheet or washer gauge is a separate design dimension. Preserve an explicitly requested thin gauge, and report the need to review orientation, layer height, material and load. Do not thicken a sheet to silence R001 WARN. Narrow in-plane webs and enclosure walls still require wall-width checks. Prefer 1.6 mm detail width and 2.0 mm structural walls when the request allows it.
  • For circular mating bores of every diameter (including below 3 mm), use fit_hole(d, h, center=true, diametral_tolerance=0.02) from agentscad_std.scad or equivalent local geometry. It uses at least 24 segments, increases resolution to bound polygon oversize, and compensates d / cos(180/n) so the minimum clear diameter equals d. Keep a local $fn; a coarse global $fn must not control fitting surfaces. If the library is unavailable, choose n = max(24, 4*ceil(180/acos(d/(d+0.02))/4)) and subtract cylinder(d=d/cos(180/n), h=h, center=true, $fn=n). Add any requested manufacturing clearance to d separately; polygon compensation is not printer shrinkage compensation. Preserve intentional polygon sockets. H001 counts topology only and does not certify diameter or fit.
  • Prefer available reviewed library modules when they fit. Never invent include paths or copy library source.
  • Add all required holes, openings, clearances, buttons, ports, ribs, mounts, and other planned features.
  • Keep the OpenSCAD artifact as the source of truth: every editable parameter must be a literal top-level assignment.
  • Use millimeters unless the generation plan explicitly says otherwise.
  • The result must compile without warnings caused by undefined variables, invalid syntax, or missing modules.

Standard Library Coordinate Contract

screw_hole and bolt_pattern_rect default to center=true for compatibility. Pass center=false to cut through a plate starting at z=0; h / thickness then denotes the full positive-z depth. A bolt pattern without children produces four round cutters; supplied children override their shape. Keep cutter and body coordinate frames consistent. For enclosure_box, height is usable internal height and wall is both the nominal side and bottom thickness.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.