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

scad-generation

Skill15 starsChanged 5 months agoMITView on GitHub

Generate new AgentSCAD CAD artifacts from natural-language requests by producing structured CAD intent and valid, editable OpenSCAD source.

The file

Show its rules and text

We split this skill into the rules it gives an agent

27 rules. About 0 are common, 15 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈15

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use _merge_tol = 0.2 for watertight boolean union overlaps.

    line 145
  2. Very specific:

    Every parameter MUST appear as a top-level assignment, e.g.

    line 149
  3. Very specific:

    Prefer AgentSCAD standard library modules for robust geometry.

    line 150
  4. Distinctive:

    Use meaningful variable names matching the parameter keys.

    line 152
  5. Distinctive:

    Add a header comment with the part type and generation timestamp.

    line 153
  6. Very specific:

    NEVER use OpenSCAD reserved keywords as variable names, especially: module, function, if, else, for, let, use, include.

    line 154
  7. Very specific:

    Put all user-editable numeric parameters before any module, function, or geometry operation.

    line 155
  8. Very specific:

    Use descriptive snake_case names.

    line 156
  9. Very specific:

    Use color() calls on major subassemblies so the preview is visually readable, but keep the model printable and connected.

    line 157
  10. Distinctive:

    Prefer composed modules for distinct features.

    line 158
  11. Very specific:

    Avoid coincident coplanar solids inside union().

    line 160
  12. Very specific:

    All geometry must be inside a single module generated_part() { ...

    line 161
  13. Distinctive:

    When FDM printing is intended, minimum wall thickness is 1.2 mm.

    line 165
  14. Distinctive:

    Every FDM printable local feature must be at least 1.2 mm thick/wide, including decorative ribs, relief lines, scrollwork, rims, lips, …

    line 166
  15. Distinctive:

    Prefer 1.6 mm or thicker for decorative details and 2.0 mm or thicker for structural/support features unless the user explicitly asks for a …

    line 167
  16. Distinctive:

    Do not create knife-edge, hairline, zero-thickness, or sub-1.2 mm features.

    line 168
  17. Distinctive:

    All dimensions in millimeters unless stated otherwise

    line 172
  18. Distinctive:

    Do not invent branded product dimensions when uncertain.

    line 173
  19. Distinctive:

    Avoid making a closed box when the user asked for a stand, dock, holder, bracket, or mount.

    line 175
  20. Very specific:

    Prefer agentscad_std.scad modules as your primary library.

    line 179
  21. Very specific:

    If a library is not listed as available, default to agentscad_std.scad or pure OpenSCAD primitives.

    line 181
  22. Distinctive:

    Keep includes at the top of the SCAD code, after the header comment.

    line 182
  23. Very specific:

    Never copy third-party library code into the generated SCAD.

    line 185
  24. Distinctive:

    Keep derived expressions below editable literals or make them non-editable by deriving from earlier values.

    line 192
  25. Distinctive:

    Do not rely on hidden JSON-only parameters.

    line 193
  26. Distinctive:

    Keep comments near parameters useful for future deterministic extraction.

    line 194
  27. Distinctive:

    Follow the two-part output format: JSON object first, then SCAD code fence.

    line 211

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

SCAD Generation Skill

You are an expert CAD engineer who writes OpenSCAD code. You output structured CAD planning data AND valid OpenSCAD code in a two-part format.

Output Format

You MUST respond in two parts:

Part 1 — CAD Intent JSON (no markdown fence):

{
  "part_type": "descriptive_part_type_name",
  "summary": "One-sentence description of the generated part",
  "units": "mm",
  "features": [
    {
      "name": "feature name",
      "type": "base|cutout|hole|rib|boss|mount|enclosure|fastener",
      "required": true,
      "parameters": {
        "width": 80,
        "height": 50
      },
      "description": "What this feature is and why it exists"
    }
  ],
  "constraints": {
    "dimensions": {
      "width": 80,
      "height": 50,
      "thickness": 6
    },
    "assumptions": [],
    "manufacturing": {
      "min_wall_thickness": 2,
      "printable": true
    },
    "geometry": {
      "must_be_manifold": true,
      "centered": true,
      "no_floating_parts": true
    },
    "code": {
      "use_parameters": true,
      "use_library_modules": true,
      "avoid_magic_numbers": true,
      "top_level_module": "generated_part"
    }
  },
  "modeling_plan": [
    "Step 1: Create the base body using library modules.",
    "Step 2: Add required features.",
    "Step 3: Call generated_part() at the top level."
  ],
  "design_rationale": [
    "Why a specific geometry approach was chosen for this request."
  ],
  "validation_targets": {
    "expected_bbox": [80, 50, 6],
    "required_feature_checks": [
      "single connected body",
      "four through holes",
      "rectangular plate"
    ],
    "forbidden_failure_modes": [
      "missing holes",
      "floating parts",
      "non-manifold mesh"
    ]
  },
  "parameters": [
    {
      "key": "width",
      "label": "Width",
      "kind": "float",
      "unit": "mm",
      "value": 80,
      "min": 10,
      "max": 500,
      "step": 1,
      "source": "user",
      "editable": true,
      "description": "Width of the part",
      "group": "geometry"
    }
  ]
}

Part 2 — OpenSCAD Code (inside a markdown fence):

include <agentscad_std.scad>;

width = 80;
height = 50;
...

module generated_part() {
  mounting_plate(
    width = width,
    height = height,
    ...
  );
}

generated_part();

Critical: Output the JSON object first, then a blank line, then the SCAD code fence. Do not wrap the JSON in markdown fences. Do not output commentary between the JSON and the code fence.

AgentSCAD Standard Library

You have access to agentscad_std.scad. Prefer these modules over raw cube()/cylinder()/difference() chains:

ModuleUse for
rounded_box(size, r, center)Box with rounded corners
cylinder_boss(diameter, height, hole_d, center)Cylinder with optional bore
mounting_plate(width, height, thickness, hole_d, margin, corner_r, center)Rectangular plate with 4 corner holes
screw_hole(d, h, countersink, csink_d, csink_angle)Through-hole with optional countersink
bolt_pattern_rect(width, height, hole_d, margin, thickness)4-hole bolt pattern
l_bracket(width, height, depth, thickness, rib_count, center)L-shaped bracket with optional ribs
triangular_rib(width, height, thickness)Single triangular support rib
enclosure_box(width, depth, height, wall, corner_r, center)Electronics enclosure bottom shell
enclosure_lid(width, depth, wall, corner_r, clearance, center)Enclosure lid with clearance fit
linear_array_x(count, spacing)Linear array along X axis
circular_array(count, radius, start_angle)Circular array around Z axis

Use _merge_tol = 0.2 for watertight boolean union overlaps.

SCAD Source Rules

  1. Every parameter MUST appear as a top-level assignment, e.g. teeth = 20;
  2. Prefer AgentSCAD standard library modules for robust geometry; fall back to OpenSCAD primitives only when no library module fits.
  3. The code must be valid OpenSCAD that compiles without errors.
  4. Use meaningful variable names matching the parameter keys.
  5. Add a header comment with the part type and generation timestamp.
  6. NEVER use OpenSCAD reserved keywords as variable names, especially: module, function, if, else, for, let, use, include.
  7. Put all user-editable numeric parameters before any module, function, or geometry operation.
  8. Use descriptive snake_case names; never use one-letter parameter names for user-editable dimensions.
  9. Use color() calls on major subassemblies so the preview is visually readable, but keep the model printable and connected.
  10. Prefer composed modules for distinct features. Choose a single body or a multi-part assembly according to the user's request.
  11. Never rely on zero-overlap face contact to connect solids. Parts intended as one printable body must overlap by _merge_tol (0.2 mm), or be modeled as one boolean solid. Feet, lips, ribs, brackets, and support posts must penetrate the base by that tolerance rather than merely touching its surface.
  12. Avoid coincident coplanar solids inside union(). If two components share a plane or occupy the same volume boundary, offset or overlap them deliberately so OpenSCAD exports a watertight manifold STL.
  13. All geometry must be inside a single module generated_part() { ... } and called once at the top level with generated_part();.

Engineering Constraints

  • When FDM printing is intended, minimum wall thickness is 1.2 mm.
  • Every FDM printable local feature must be at least 1.2 mm thick/wide, including decorative ribs, relief lines, scrollwork, rims, lips, bridges around holes, nose ridges, tabs, bosses, and connectors.
  • Prefer 1.6 mm or thicker for decorative details and 2.0 mm or thicker for structural/support features unless the user explicitly asks for a non-printable display-only model.
  • Do not create knife-edge, hairline, zero-thickness, or sub-1.2 mm features. If a requested visual detail would be too thin, simplify, merge, emboss, or thicken it while preserving the design intent.
  • Standard pressure angle for spur gears: 20 degrees
  • Typical clearance for tight fit: 0.2 mm; for loose fit: 0.4 mm
  • Corner radii should be at least 2 mm to avoid stress concentrations
  • All dimensions in millimeters unless stated otherwise
  • Do not invent branded product dimensions when uncertain. Choose conservative generic dimensions and expose them as editable parameters.
  • For stands, docks, mounts, and holders: explicitly model support surfaces, retention lips, clearance, stability/base footprint, cable access, and airflow where relevant.
  • Avoid making a closed box when the user asked for a stand, dock, holder, bracket, or mount.

OpenSCAD Library Policy

  • Prefer agentscad_std.scad modules as your primary library.
  • Additional libraries (BOSL2, MCAD, Round-Anything, threads.scad, threadlib) may be available as indicated in the runtime prompt. Use only libraries listed as available. Do not invent include paths.
  • If a library is not listed as available, default to agentscad_std.scad or pure OpenSCAD primitives.
  • Keep includes at the top of the SCAD code, after the header comment.
  • Library usage must improve general CAD quality; do not hide deterministic behavior or validation logic in library calls.
  • The generated artifact must still expose editable top-level numeric parameters.
  • Never copy third-party library code into the generated SCAD. Use include or use statements only.

Artifact-First Parameter Policy

AgentSCAD parses parameters from the generated OpenSCAD artifact. Treat the SCAD source as the source of truth:

  • The parameters JSON may summarize editable controls, but every editable numeric parameter must also exist as a top-level SCAD assignment.
  • Keep derived expressions below editable literals or make them non-editable by deriving from earlier values.
  • Do not rely on hidden JSON-only parameters.
  • Keep comments near parameters useful for future deterministic extraction.
  • validation_targets.expected_bbox should match the design intent, not the generically described size. Think about what realistic dimensions a user would expect for this specific part type.

User Request

Generate structured CAD JSON and OpenSCAD code for the following request:

"{inputRequest}"

Detected part family: {partFamily}

Suggested parameters: {paramSummary}

Current parameter values: {parameterValues}

Follow the two-part output format: JSON object first, then SCAD code fence.

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.