Back to Skills

gcode

Generate, inspect, dry-run, and statically validate plain FDM `.gcode` from 3D mesh files by orchestrating real slicer CLIs. Use when Codex needs to slice `.stl`, `.obj`, unsliced `.3mf`, `.ply`, `.glb`, or `.gltf` into printer-profiled G-code, discover local slicer backends, inspect whether a mesh is slice-ready, or validate generated G-code before any printer-specific handoff.

6,889stars816forksUpdated 6/25/2026

Security Assessment

Safe(100/100)
Security Score100/100

About gcode

A printer-agnostic workflow for generating, inspecting, dry-running, and statically validating plain FDM .gcode from 3D mesh files by orchestrating real slicer command-line tools. It is intended for slicing mesh formats such as .stl, .obj, unsliced .3mf, .ply, .glb, and .gltf into printer-profiled G-code, for discovering which local slicer backends are installed, and for confirming a mesh is slice-ready or that generated G-code is sound before any printer-specific handoff. It never uploads, starts, or packages print jobs.

The process is driven by a helper script, gcode_tool.py, exposing discover, inspect, slice, and validate subcommands. Every slice requires an explicit wrapper profile JSON that points to an absolute native slicer profile path and carries machine bounds and filament details; the wrapper supplies validation bounds and backend selection while the native profile remains the source of detailed process behavior. Slicing is done as a dry-run first to preview the command, then executed only after the command and profile look appropriate. The preferred backend order is OrcaSlicer, PrusaSlicer, then CuraEngine, and discovery checks both PATH and the usual OrcaSlicer app location. STL, OBJ, and unsliced 3MF are passed directly, while PLY, GLB, and GLTF are converted to temporary STL using trimesh when available.

Validation checks for non-empty content, temperature commands, movement and extrusion moves, XYZ bounds, and unknown-command warnings, and should always run before handing G-code to printer-specific workflows. The skill defines clear boundaries: STEP, DXF, SVG, URDF, and SDF inputs are rejected in v1, and Bambu archive creation and printer contact are out of scope. After producing or modifying a .gcode it hands the explicit file path to a cad-viewer skill when installed, and defers Bambu upload and start workflows to a bambu-labs skill. Reference files cover slicer backends and how to interpret validation output.

FAQ

Which input mesh formats are supported?

It accepts .stl, .obj, and unsliced .3mf directly, and converts .ply, .glb, and .gltf to temporary STL using trimesh; .step, .stp, .dxf, .svg, .urdf, and .sdf are rejected in v1.

Which slicer backends does it use and in what order?

It prefers OrcaSlicer, then PrusaSlicer, then CuraEngine, discovering them via the discover command which checks both PATH and the usual OrcaSlicer app location.

What goes in the required profile JSON?

A wrapper profile supplies a backend, an absolute native_config path, machine details like bed size and z height, optional motion bounds, and filament settings; the wrapper provides validation bounds and backend selection.

Does this skill talk to printers or create Bambu archives?

No. It generates plain .gcode only, never uploading, starting, or packaging jobs, and defers Bambu .gcode.3mf packaging and upload to a separate bambu-labs skill.

What does the validator check?

It verifies non-empty content, the presence of temperature, movement, and extrusion commands, XYZ bounds, and flags unknown-command warnings, and should run before any printer-specific handoff.

All Files

6 files
scripts/gcode_tool.py26.0 KB
View
SKILL.md5.6 KB
View
agents/openai.yaml0.2 KB
View
references/gcode-validation.md1.8 KB
View
references/slicer-backends.md3.2 KB
View
LICENSE1.0 KB
View

Install gcode

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill