# Cadquery Part Detailing

> Take a functional CadQuery part (already produced by `cadquery-part` — primary body, additive/subtractive features, mating interfaces) and bring it up to a high level of geometric finish by adding fillets, chamfers, ribs, gussets, bosses, lead-in chamfers on holes, and rounded plate corners. Use after `cadquery-part` produces the functional geometry and before `cadquery-manufacturability` enforces DFM, or whenever the user says "detail this part", "add fillets", "round the corners", or "make this look machined".

- Skill: `leoai-org/cadquery-part-detailing` (Agent Skill)
- Install (CLI): `npx skillmds@latest add leoai-org/cadquery-part-detailing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leoai-org/cadquery-part-detailing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: leoai-org (https://skillmd.com/u/leoai-org)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/leoai-org/cadquery-part-detailing

---


# CadQuery part detailing — geometric finish pass

## Purpose

Make the part **look and behave like engineered hardware**: ribs, gussets, stress-relief fillets, hole lead-ins, rounded plate outlines. The functional solid from `cadquery-part` must already assemble and interference-check clean **before** this pass.

## What this pass is NOT

| Do NOT add | Why |
|------------|-----|
| New holes, slots, tapped features | `cadquery-part` or `cadquery-manufacturability` |
| Clearance / counterbore / tap drill | DFM |
| Vendor BOM / SKU comments | DFM |
| Shells or wall thickness changes | Functional |
| Fastener patterns | DFM |

If functional geometry is missing a rib **required for strength**, add it here — but do not add mounting holes.

## Authoritative rules

`cad-generation.txt` — Design Realism, Edge Selectors, fillets/chamfers last, sketch-level fillets when possible.

## Inputs

- `parts/<function_name>.py` after functional pass + local interference OK
- Mechanical role: cantilevered walls, handled edges, molded corners
- Mating direction (usually +Z) for lead-in chamfers

## Build order — strict

1. **Re-open** the functional file — preserve parameters and functional block; append a `# ---- Detailing ----` section.
2. **Structural reinforcement** (single-extrusion `union` each):
   - Ribs / gussets on cantilevers: `polyline(...).close().extrude(t)`
   - Boss **pads** only where functional pass left thin material around an existing hole — do not re-drill
3. **Lead-in chamfers** on existing hole entries and spigot leads — small (0.3–0.8 mm), 1–2 string selectors
4. **Fillets last** — inside corners first, then external ergonomics; radius ≤ 40% of local wall thickness
5. **Sketch-level rounding** for plate outlines when the whole perimeter should be round:

```python
plate = (
    cq.Workplane("XY")
    .sketch().rect(w, h).vertices().fillet(r).finalize()
    .extrude(t)
)
```

Prefer sketch-level for plate corners — post-extrusion `edges(">Z")` often fails silently.

6. `result = build_<function_name>()` — update the builder to return the detailed body, not a orphan variable.

## Template (append inside `build_*()`)

```python
    # ---- Detailing: reinforcement ----
    gusset = (
        cq.Workplane("XZ", origin=(gx, 0, gz))
        .polyline([(0, 0), (rib_l, 0), (0, rib_h)]).close()
        .extrude(rib_t)
    )
    part = part.union(gusset)

    # ---- Detailing: lead-in chamfers (holes face +Z) ----
    part = part.edges("|Z").edges(">Z").chamfer(0.5)

    # ---- Detailing: fillets (inside corners) ----
    part = part.edges("|Z").fillet(1.5)

    return part
```

## Anti-patterns

- Fillets before all unions/cuts in this section complete
- `cq.selectors.*`
- Fillet radius > local thickness
- Duplicating ribs/bosses already in functional pass
- New `cut()` features except tiny lead-in chamfers on existing geometry

## Validation

Orchestrator runs **`cadquery-render`** then compares to functional renders:
- Sharp edge where fillet expected → selector failed; tighten (`|Z` + `>X`) or use sketch fillet
- New clash with neighbor → reposition rib or hand to interference skill

Re-run **local `cadquery-interference-check`** after detailing — ribs often cause clashes.

## Output

Same file `parts/<function_name>.py`, same `build_<function_name>()`, with detailing inside the builder. Top-level `result = build_<function_name>()`.

