agentleFS
BaratiLabBaratiLab/mechanical-engineering-skills/skills/llm-mechanical-designer/SKILL.md

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.

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
  1. Distinctive:

    Put a direct diagonal from the load node to each support.

    line 37
  2. Distinctive:

    Keep coordinates simple (two decimals), since LLMs are weak at fine floating-point tuning.

    line 40

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

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.py and pass --custom-task task.json.

Workflow

  1. Start a run.
    python scripts/design_loop.py init --task t1v1 --run runs/t1v1
    This writes runs/t1v1/prompt_next.md (the INITIAL prompt).
  2. 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.
  3. Evaluate. Never estimate stresses yourself.
    python scripts/design_loop.py eval --run runs/t1v1 design.json
    The output gives the FEM result, the critical members, the ranked history, and mode_next: OPTIMIZE if the design is feasible, CONSTRAINT if not. It also writes the next prompt.
  4. Repeat steps 2–3 using prompt_next.md. Change a few things per iteration. In OPTIMIZE mode, set "stop": true once improvements fall below about 2%; stopping is refused while the design is infeasible. The budget is 25 iterations.
  5. Report.
    python scripts/design_loop.py best --run runs/t1v1     # best_design.json + best.png
    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.

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.

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.