llm-mechanical-designer
Skill16 starsChanged 16 days agoMITView on GitHub
Designs and optimizes 2-D trusses with an LLM-in-the-loop FEM workflow (Jadhav & Barati Farimani, "Large Language Model Agent as a Mechanical Designer") — the agent proposes nodes, members and discrete cross-sections, an exact truss FEM scores each design, and ranked history plus optimize/constraint prompts drive iterative refinement. Use when the user wants a truss or frame layout designed, wants to minimize stress, mass or stress-to-weight under constraints, or asks to reproduce the paper's tasks.
In this repository34 other files it gives its agents.
- skills/cadsmith-text-to-cad/references/agents.mdAGENTS.md
- agentscad-fdm-dfamSkill
- am-alloy-screeningSkill
- am-literature-ragSkill
- cadsmith-text-to-cadSkill
- cfd-simulation-setupSkill
- design-review-packageSkill
- dfm-reviewSkill
- drawing-gdt-reviewSkill
- engineering-calc-reportSkill
- equation-discoverySkill
- image2gcodeSkill
- lattice-inverse-designSkill
- linkage-synthesisSkill
- llm-3d-print-monitorSkill
- lpbf-defect-predictionSkill
- lpbf-superresSkill
- machine-element-sizingSkill
- material-selectionSkill
- mechanical-teardownSkill
- mechanics-visualsSkill
- meltpool-geometrySkill
- parametric-part-cadSkill
- query2cad-freecadSkill
- quick-feaSkill
- rocketsmithSkill
- sketch-to-cadSkill
- sls-process-optimizationSkill
- stress-field-surrogateSkill
- thermal-fluids-calcSkill
- thermal-porositySkill
- tolerance-stackupSkill
- worked-problem-generatorSkill
- my-new-skillSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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
- Distinctive: line 37
Put a direct diagonal from the load node to each support.
- Distinctive: line 40
Keep coordinates simple (two decimals), since LLMs are weak at fine floating-point tuning.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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.
Files
LLM Agent as a Mechanical Designer (truss design loop)
Paper: Y. Jadhav, A. Barati Farimani, Large Language Model Agent as a Mechanical Designer, J. Engineering Design (2026), arXiv:2404.17525. Reference code: github.com/BaratiLab/LLLM-Agent-Mechanical-Designer. You are the LLM in the loop. The FEM is code (scripts/truss_fem.py), and its stresses match the paper's reference code to 1e-4.
When to use
- "Design a truss that carries X with max stress Y and mass under Z."
- "Minimize the stress-to-weight ratio of this bracket truss."
- Reproducing or teaching Task 1 / Task 2 from the paper (
t1v1–t1v3,t2v1–t2v3). - Any 2-D pin-jointed structure with discrete section sizes. Write the task as JSON with the same keys as
scripts/tasks.pyand pass--custom-task task.json.
Workflow
- Start a run.
This writespython scripts/design_loop.py init --task t1v1 --run runs/t1v1runs/t1v1/prompt_next.md(the INITIAL prompt). - Answer the prompt yourself. Work through the scratchpad sections in order (they're there so the geometry reasoning happens before the numbers), then save only the JSON block to
design.json. Keep fixed nodes exactly where they are, and use area IDs from the table. - Evaluate. Never estimate stresses yourself.
The output gives the FEM result, the critical members, the ranked history, andpython scripts/design_loop.py eval --run runs/t1v1 design.jsonmode_next: OPTIMIZE if the design is feasible, CONSTRAINT if not. It also writes the next prompt. - Repeat steps 2–3 using
prompt_next.md. Change a few things per iteration. In OPTIMIZE mode, set"stop": trueonce improvements fall below about 2%; stopping is refused while the design is infeasible. The budget is 25 iterations. - Report.
Report the best design table (nodes, members, area IDs, member stresses), max |σ|, mass, and SWR against the limits, the number of iterations and FEM calls, and the plot. A good comparison point from the paper: the LLM loop needed tens of FEM calls, where NSGA-II used 500 generations × 100 population.python scripts/design_loop.py best --run runs/t1v1 # best_design.json + best.png
Design heuristics the paper's best runs used
- Deepen the truss over the load node; raising an apex cuts chord forces.
- Put a direct diagonal from the load node to each support.
- Size by force: big areas on the 2–3 critical members, IDs 1–2 elsewhere.
- Fewer members is often better. Minimal triangulated layouts sat on the low-mass Pareto edge.
- Keep coordinates simple (two decimals), since LLMs are weak at fine floating-point tuning. Refine positions in small, deliberate steps.
Conventions (identical to the reference code)
Load [m, a] → Fx = m·cos a, Fy = m·sin a (so [-10, -45] points up-left). A pinned support fixes x and y; a roller fixes y. Stress is axial, tension positive, with E = 29.6e6. Mass = Σ L·A(area id). Units follow the paper ("Pa", "m").
Limits
2-D, linear-elastic, pin-jointed. No buckling check: add an Euler check for compression members if the user needs one (P_cr = π²EI/L²). The prompt templates are re-written from the paper's structure, not copied verbatim.
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
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.

