agentleFS
BaratiLabBaratiLab/mechanical-engineering-skills/skills/lpbf-defect-prediction/SKILL.md

lpbf-defect-prediction

Skill16 starsChanged 16 days agoMITView on GitHub

Predict laser powder bed fusion (L-PBF) defect regimes — keyholing, lack of fusion, balling, or none — from process parameters (material, laser power, scan speed, beam diameter, hatch spacing, layer thickness), check measured melt-pool dimensions against the standard defect criteria, and draw power–velocity process maps with a recommended window. Based on AdditiveLLM (Barati Farimani Lab) and the MeltpoolNet dataset. Use for metal AM parameter selection, "will these settings keyhole?", process windows, or porosity troubleshooting.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Default --split grouped holds out whole melt pools, typically about 88% exact match.

    line 52

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

L-PBF defect prediction (AdditiveLLM)

Takes a metal L-PBF parameter set and says which defect regime it most likely falls in. Can also draw the safe window across power and speed. The workflow follows AdditiveLLM (Pak & Barati Farimani, Additive Manufacturing Letters 2025): MeltpoolNet melt-pool data, labelled with three geometric criteria, augmented over hatch and layer, and learned as a multi-label classifier. Paper details and how this skill differs are in references/paper-notes.md.

Everything runs through scripts/lpbf.py (numpy, pandas, scikit-learn, matplotlib, pyarrow). The first run downloads MeltpoolNet (~1 MB) from github.com/BaratiLab/MeltpoolNet to ~/.cache/mechanical-engineering-skills/meltpoolnet. Set LPBF_CACHE to put it elsewhere.

Pick the mode from what the user has

User hasUseWhy
Measured or simulated melt-pool depth, width (and length)criteriaExact physics rules. No model, no uncertainty beyond the measurement.
Process parameters onlypredict (after build + train, once)Learned from about 2,400 experiments plus augmentation.
"What settings should I use?"mapPower–velocity map, defect-free region, most robust point, and where the data actually is.

Criteria (paper Eqs. 1–3)

python scripts/lpbf.py criteria --depth 120 --width 150 --length 420 --hatch 100 --layer 40
RegimeFires when
KeyholingW / D < 1.5
Lack of Fusion(h / W)² + (t / D)² > 1
BallingL / W > π

The labels are not exclusive. None means every criterion that could be evaluated passed. Missing inputs leave that criterion unevaluated, and the output says so. Never report "None" when a criterion was skipped.

Model (one-time, about 1 minute)

python scripts/lpbf.py build --out data.parquet      # ≈325k rows; prints label shares
python scripts/lpbf.py train --data data.parquet --model model.joblib   # grouped split by default
  • train prints exact-match accuracy (all four labels correct) and F1 for each label.
  • Default --split grouped holds out whole melt pools, typically about 88% exact match.
  • --split random reproduces the paper's protocol and scores about 98%. It is inflated by leakage, so never quote it as expected accuracy (see notes).
  • --no-monotone removes the physics constraints, for ablation only.

Predict and map

python scripts/lpbf.py predict --model model.joblib --material Ti-6Al-4V \
    --power 280 --velocity 1200 --beam 80 --hatch 100 --layer 30
python scripts/lpbf.py map --model model.joblib --material Ti-6Al-4V \
    --hatch 100 --layer 30 --beam 80 --out map.png [--pmax 500 --vmax 2500]
  • predict returns a probability for each regime, the predicted labels (None only if no defect head reaches 0.5), line and volumetric energy, and the model's validation scores.
  • map shades the regions where each defect head is above 0.5. Green means all three are below 0.5. Measured points for that material are drawn as circles. The output also reports the defect-free fraction and the most robust point (the largest smoothed margin).
  • Materials in the data include SS316L, SS17-4PH, IN625, IN718, IN738LC, Ti-6Al-4V, Hastelloy X, Cu10Sn, AlSi10Mg, Ti-48Al and others. Other alloys need --props density,Cp,k,Tm, and you should warn the user that the result is extrapolated.

How to report

  1. Give the regime and its probability, plus the energy numbers.
  2. Name the physical lever:
    • keyhole: lower power or raise speed;
    • LoF: lower hatch or layer, or raise energy;
    • balling: lower speed at the same energy, or reduce the power–speed product.
  3. Say whether the point lies inside the measured data (circles on the map) or is extrapolated. Green regions with no circles are guesses.
  4. For a real build, recommend a small DOE of single tracks and density cubes around the suggested point. The model narrows the search; it does not replace qualification.

Caveats to pass on

  • Labels come from single-track melt-pool geometry. They do not cover spatter, cracking, residual stress, contour or downskin effects.
  • W/D < 1.5 is a conservative keyhole rule. Many SS316L conduction-mode tracks trip it, so that material's map shows a narrow window.
  • Balling has few examples because it needs melt-pool length, so the balling head rarely fires.
  • To fine-tune an actual LLM as in the paper, data.parquet includes the Baseline [SEP] text. See references/finetune.md.

Cite: Pak & Barati Farimani, Addit. Manuf. Lett. 14 (2025) 100292; Akbari et al., MeltpoolNet, Addit. Manuf. 55 (2022) 102817.

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.