agentleFS
gugu-2gugu-2/Prompt-CAD/skills/tolerance-analyzer/SKILL.md

tolerance-stackup-analyzer

Skill2 starsChanged 6 months agoMITView on GitHub

Performs a statistical Monte Carlo tolerance stack-up analysis to predict assembly fit and interference probabilities based on manufacturing variance.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When you are designing a multi-part assembly with tight fits, moving parts, or critical clearances.

    line 11
  2. Distinctive:

    When you need to justify tolerance allocations (e.g., why a hole must be 4.2mm instead of 4.0mm).

    line 13
  3. Distinctive:

    Run the simulation script with your JSON definition.

    line 72

≈ “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

Tolerance Stack-Up Analyzer

This skill performs a statistical Monte Carlo tolerance stack-up analysis on an assembly. It simulates manufacturing variations (e.g., ISO 2768, 3D printing, CNC machining) to calculate the probability that the final assembly will fit together (clearance > 0).

When to Use

  • When you are designing a multi-part assembly with tight fits, moving parts, or critical clearances.
  • To verify if chosen manufacturing methods (FDM vs CNC) will reliably produce working parts.
  • When you need to justify tolerance allocations (e.g., why a hole must be 4.2mm instead of 4.0mm).

How to Use

1. Create a Stack-Up JSON Definition File You must act as the bridge between the 3D geometry and the analyzer. Look at the build123d design and construct a 1D tolerance loop in JSON. Identify the dimensions that form the gap/clearance. Assign direction: 1 to dimensions that increase the gap. Assign direction: -1 to dimensions that decrease the gap.

Example stackup.json:

{
  "name": "Motor Mount Assembly Stack-Up",
  "target_gap_min_mm": 0.05,
  "target_gap_max_mm": 0.50,
  "components": [
    {
      "name": "Housing Inner Width",
      "nominal_mm": 50.0,
      "direction": 1,
      "tolerance_type": "standard",
      "tolerance_standard": "ISO 2768-m"
    },
    {
      "name": "Motor Body Width",
      "nominal_mm": 42.0,
      "direction": -1,
      "tolerance_type": "symmetric",
      "tolerance_value": 0.1,
      "distribution": "normal"
    },
    {
      "name": "Spacer Thickness",
      "nominal_mm": 7.8,
      "direction": -1,
      "tolerance_type": "standard",
      "tolerance_standard": "FDM_standard"
    }
  ]
}

Supported Standards:

  • ISO 2768-f (Fine)
  • ISO 2768-m (Medium)
  • ISO 2768-c (Coarse)
  • ISO 2768-v (Very Coarse)
  • FDM_standard (Typical 3D printing, ±0.2mm)
  • FDM_precision (Tuned 3D printing, ±0.1mm)
  • CNC_standard (Typical machining, ±0.1mm)
  • CNC_precision (Tight machining, ±0.02mm)
  • CNC_aerospace (Extreme tight machining, ±0.005mm)

Tolerance Types:

  • "standard": Provide "tolerance_standard".
  • "symmetric": Provide "tolerance_value" (e.g. 0.1 for ±0.1).
  • "bilateral": Provide "tolerance_value" as an array [lower, upper] (e.g. [-0.05, 0.1]).

2. Run the Analysis Script Run the simulation script with your JSON definition.

python skills/tolerance-analyzer/scripts/analyze_stackup.py --config stackup.json --iterations 100000 --plot output_plot.png

3. Interpret the Results The script will output a JSON report with statistical bounds and pass/fail assessments. Review the probability_of_interference and probability_out_of_spec. If the design fails, you must adjust the nominal dimensions or choose a tighter manufacturing standard in your CAD script.

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.