---
name: fdmguard
description: Function-first checks for 3D-printed (FDM) parts. Use BEFORE choosing a print orientation, splitting a part into pieces, reorienting it, adding keels, joints, pins or screws to make it print better, before carving pockets or clearances for mating parts, and BEFORE telling a human that a part fits or is ready to print. Runs an insertion-path sweep, thin-neck and thin-strip checks, hole-fit sizing, a bed-contact stability screen, and builds a trade-off table that always includes the unchanged original geometry.
---

# fdmguard: function first, print quality second

**A part that prints beautifully but cannot be assembled (or falls over mid-print) is a failed part. Function first, print quality second.**
Judge every print choice by function first (does it assemble, stay on the
bed while printing, move, hold, survive handling) and only then by print quality (supports, flat faces, hole
roundness).

Every print choice (orientation, splitting into pieces, adding joints) is a
trade-off. Always include **"keep the original author's geometry unchanged"**
as an option, compare all options in one table, and let a human decide.

## When to use this skill

- You are choosing a print orientation (especially a tilted or "diagonal" one).
- You are about to split, reorient, re-joint, or add a keel/peg/screw to a
  printed part "to make it print better".
- You are carving a pocket, slot or clearance for a mating part.
- You changed hole sizes for pins, filament pins or screws.
- You are about to say "this fits", "this is ready to print", or "this prints
  without supports".

## Install

```sh
uv tool install fdmguard     # or: pip install fdmguard
uvx fdmguard --help          # or run it without installing
fdmguard skill --install ~/.claude/skills   # install or update this skill
```

As an MCP server instead of the CLI: `claude mcp add fdmguard -- uvx fdmguard serve`.
The tools (`check_insertion`, `check_necks`, `check_strips`, `check_holes`,
`check_stability`, `tradeoff`) take the same options and return the same JSON.

Add `--json` to any check for one machine-readable JSON document per call; still trust the exit code
(format: docs/JSON.md in the repository).

## Check order

Run the checks in this order, on EVERY option you are comparing (the original
included). Do not stop at the first FAIL: record every result, because a
failing option still belongs in the trade-off table as "gated out". Exit code
0 = PASS, 1 = FAIL (or nothing checked), 2 = bad input (never a pass).

1. **insertion** (every pair of mating parts, along the real assembly path)
   ```sh
   fdmguard insertion moving_seated.stl fixed.stl --direction=-z --travel 20
   ```
   The moving mesh is in its SEATED pose. `--direction` is the motion
   direction during assembly. `--travel` must start the part fully outside
   the fixed part. Declare intentional snap tabs with
   `--allow name:x0,y0,z0,x1,y1,z1`. The tool prints the seated-only result
   next to the path result: if seated passes and the path fails, the part
   cannot be assembled. Every option that changes a mating part needs its own run.
   If the part twists, swings or moves in more than one step (bayonet, hinge,
   slide then drop), give the real motion with `--path` (legs in assembly
   order, ending seated):
   ```sh
   fdmguard insertion plug.stl socket.stl --path '[{"translate": {"direction": "-z", "distance": 25}}, {"rotate": {"axis": "z", "point": [0, 0, 0], "angle": 90}}]'
   ```
   Do not approximate a rotation with a straight move.
2. **necks** (every part you split or trimmed)
   ```sh
   fdmguard necks part.stl            # erosion r = 0.7 mm
   ```
3. **strips** (flat plates and thin printed parts, in print orientation)
   ```sh
   fdmguard strips part.stl --width 1.6 --up z
   ```
   Report both the thin fraction and the marginal 1.6-1.8 mm fraction.
4. **holes** (every pin or screw hole)
   ```sh
   fdmguard holes --pin 1.75 --fit slip part.stl
   ```
5. **stability** (every orientation you consider, mesh in print orientation)
   ```sh
   fdmguard stability part_oriented.stl
   ```
   FAIL below 20 mm² first-layer contact, above height / contact width 10,
   or when the centre of mass is not over the base.
6. **tradeoff** (always, before recommending a print plan)
   ```sh
   fdmguard tradeoff options.yaml
   ```
   Put the original geometry in the file with `original: true`. Put a gate
   you did not check as `unknown`, not `pass`.

## Rule: show the table, do not decide silently

If any check FAILs for the plan you were about to propose, say so plainly and
do not call the part ready to print.

Paste the trade-off table into your reply. Say which option the tool suggests
and why. Then ask the human to choose. Do not change a part's geometry, split
it, or add hardware on your own because it lowers support use.

## Tolerance defaults (FDM, PLA; starting points, calibrate per printer)

| What | Default | Why |
|---|---|---|
| FDM over-size in sweeps | grow 0.1 mm, in-plane | printed parts come out slightly big |
| Sweep step | 0.25 mm | small enough to catch a short rim |
| Seated pocket clearance | +0.2-0.25 mm per side | zero clearance on a seat face jams |
| Slip-fit pin hole | nominal + 0.35 (1.75 filament -> 2.10) | FDM holes print 0.1-0.3 mm small |
| Printed peg in printed hole | >= 0.4 mm diametral clearance | both sides are printed |
| Screw clearance | nominal + 0.6 (M3 -> 3.6) | |
| Self-tapping pilot | nominal - 0.2 (M3 -> 2.8) | |
| Neck erosion radius | 0.7 mm (catches necks < ~1.4 mm) | a 0.5 x 0.9 mm strip snapped in handling |
| Minimum strip width | 1.6 mm per layer | narrow strips on flat plates break |
| Snap region | <= 12 mm long overlap; warn > 1.0 mm deep | a long rigid rim is not a snap |
| Bed contact | >= 20 mm² first layer; height / contact width <= 10 (warn > 5) | a 54 mm part on 0.5 mm² topples |

## Anti-patterns

- **Calling an undercut a snap.** A snap is a small, flexible feature (about
  10 mm wide, under 1 mm of deflection, with room to flex). A 20 mm rigid rim
  that overlaps the mating part by 0.5 mm during insertion is an undercut.
  Forcing it breaks PLA. Do not draw an "allowed" box around it.
- **Optimising support percentage alone.** Zero supports means nothing if the
  halves cannot be assembled or the split leaves a 0.5 mm neck.
- **Seated-pose-only clearance.** Carving a pocket at the seated pose (+0.3 mm)
  and checking only that pose proves nothing about the path. Sweep the moving
  part from outside to seated. Cut pockets with the swept volume, not the
  seated volume.
- **Choosing orientation by support % alone.** A "diagonal" orientation with
  2.8% support but 0.5 mm² of bed contact on a 54 mm tall part topples or
  detaches. Standing it on a face (127 mm² contact, round vertical bore, 21.5%
  support) was the right choice. Run `stability` on every orientation.
- **Thickness-only checks on flat plates.** A 1.76 mm plate passes a wall
  thickness check while most of it is 1.6-1.8 mm wide strips. Use `strips`.
- **Silent "improvements".** Changing the author's geometry without showing
  the original as an option in a table.
- **Treating "not checked" as "passed".** Unknown gates stay UNVERIFIED.

## Limits (say these when they apply)

- Insertion paths are straight moves and rotations about fixed axes (`--path`).
  Screw motions (rotate and advance together) are not supported.
- In-plane grow is an approximation of FDM over-size. It is not a print simulation.
- Necks use a voxel grid: accuracy about half the pitch (0.025 mm by default).
- Hole detection only finds round holes whose axis is along `--up`, at least
  `--min-depth` (1 mm) deep.
- All tolerances are starting points. Calibrate with real prints.
