Skip to content

Guide · Agent skill

How to use the pycalphad agent skill for phase equilibria

Updated · written with AI from the project's own documentation and checked against our catalogue data

The pycalphad skill teaches an AI agent to run thermodynamic equilibrium calculations for metal alloys. Given a composition, a pressure and a list of temperatures, the agent uses the pycalphad library and a CALPHAD-format database file (TDB) to report which phases are stable, their molar fractions and their compositions. This guide is for readers who have never used an agent skill, and it explains how to install the skill, how to ask for work in plain language, what it needs, and where its results should not be trusted.

pycalphad Phase EquilibriaK-Dense-AI/scientific-agent-skills · MIT

Quick start

  1. 1Download and unzip the skill. Download the skill ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into .claude/skills/ inside a project.
  2. 2Or upload it in the Claude apps. In the Claude apps, open Settings, go to Capabilities, then Skills, and upload the ZIP.
  3. 3Install the prerequisites. Make sure Python 3.12 or newer and uv are available, and that you have network access for installation.
  4. 4Prepare your database and composition. Identify the TDB file's source and valid range, then write the composition as N-1 mole fractions plus the pressure and temperatures.
  5. 5Ask for the calculation in plain words. Describe the alloy, the temperatures and the output you want, such as phase fractions, compositions or a lever-rule check.
  6. 6Run the script and review the report. Run the documented command into a new output directory, then check report.json for failed checks and read the limitations.

What is an agent skill, and what does this one make the agent do?

An agent skill is a folder of instructions and helper files that an AI agent loads when a task matches the skill's description. The skill's main instructions are in a file called SKILL.md, and it can also include scripts, reference notes and data files.

This skill is for equilibrium calculations only. At a fixed bulk composition, a specified pressure and a list of finite temperatures, the agent runs a bundled script that performs real pycalphad equilibria. The script checks mass balance, repeats the calculation at a higher sampling density and exports each stable composition set separately.

  • Reports stable phases and their molar phase fractions at each temperature
  • Reports phase compositions as elemental mole fractions
  • Checks that phase fractions sum to one and that the reconstructed bulk composition matches the request
  • Writes report.json and phase-equilibria.csv to an output directory

Install the pycalphad skill (ZIP or Claude apps)

Option 1, personal install: download the skill ZIP from this page and unzip it into ~/.claude/skills/ so that the pycalphad folder sits inside that directory.

Option 2, single project: unzip the ZIP into the .claude/skills/ folder of your project, so the skill applies only when you work in that project.

Option 3, Claude apps: upload the ZIP in the Claude apps under Settings, then Capabilities, then Skills.

The skill's calculations run locally. Installing the Python packages needs network access, as noted in the requirements section.

  • Personal: ~/.claude/skills/pycalphad/
  • Project: .claude/skills/pycalphad/ inside your project folder
  • Claude apps: Settings → Capabilities → Skills, then upload the ZIP

What do you need before running it?

You need Python 3.12 or newer, the pycalphad library, NumPy and uv. The documented run command uses uv to fetch the pinned pycalphad and NumPy versions, so you do not need to install them separately for that command. The skill is tested with the versions listed in its own requirements.

For real materials you also need a thermodynamic database in TDB format from a licensed or otherwise suitable source. The bundled file assets/ideal-cu-ni.tdb is a hypothetical teaching model, not an assessed Cu-Ni database, so it cannot be used to make real alloy decisions.

  • Python 3.12 or newer
  • pycalphad and NumPy (pinned in the run command)
  • uv, used by the documented run command
  • Network access for installation
  • A user-supplied TDB database for real materials

Trigger the skill with natural requests

You do not need special syntax. Describe the task in plain words that match the skill's use cases: alloy phase stability, equilibrium temperature sweeps, tie lines, lever-rule checks, or reproducible phase-fraction calculations with explicit components and mole-fraction conditions.

Give the agent the database, the components, the bulk mole fractions, the pressure and the temperatures. The skill asks for mole fractions, so convert weight percentages before you ask.

  • Which phases are stable in a Cu-Ni alloy with X(Ni)=0.5 at 900 K, 1100 K and 1300 K, using this TDB file?
  • Run an equilibrium temperature sweep for my alloy from 900 K to 1400 K and show phase fractions and compositions.
  • Check the lever rule for the two-phase region at 1100 K and show the tie-line endpoints.
  • Give me a reproducible phase-fraction calculation with the components listed and the database hash recorded.

Run the tested example

The skill's own example runs from the collection root, the folder that contains skills/pycalphad. If you installed the skill from the ZIP into another location, adjust the paths to match your folder layout. The script takes the database file, a JSON settings file and an output directory. Use a new output directory each time.

For the supplied hypothetical model at X(Ni)=0.5 and 101325 Pa, the skill reports FCC_A1 only at 900 K, a mix of 0.5 FCC_A1 and 0.5 LIQUID at 1100 K (with X(Ni) approximately 0.527307 in the solid and 0.472693 in the liquid), and LIQUID only at 1300 K.

  • Output: report.json (settings, file hashes, checks and results) and phase-equilibria.csv (one row per stable phase vertex per temperature)
  • The helper performs all calculations locally and does not upload the TDB file
uv run --no-project --python 3.12 --with pycalphad==0.11.2 --with numpy==2.5.3 python skills/pycalphad/scripts/equilibrate.py skills/pycalphad/assets/ideal-cu-ni.tdb skills/pycalphad/assets/equilibrium.json equilibrium-result

Read the results and their limits

Phase fractions in the CSV are molar fractions. The Gibbs energy column is the whole-system molar Gibbs energy, repeated for each vertex, not the energy of an individual phase.

The checks ask whether the calculation is internally consistent. They do not prove that the database is experimentally accurate, and they do not certify the global minimum. Failed checks stay visible in the report rather than being relabelled as convergence. The skill also asks the agent to state the database source, excluded phases and the limitations of the result.

  • Equilibrium only: it does not predict precipitation rates, retained metastable microstructures or properties of phases missing from the database
  • Pure-component or ultratrace results from a clipped multicomponent calculation should not be claimed as exact
  • Weight percentages must be converted to mole fractions by you before using the helper

What people use it for

  • Checking which phases are stable in a metal alloy over a range of temperatures
  • Verifying a lever-rule or tie-line calculation in a two-phase region against the exported phase compositions
  • Producing a reproducible, scripted phase-fraction calculation with a recorded database hash and settings
  • Teaching CALPHAD basics with the supplied hypothetical Cu-Ni teaching model

Frequently asked questions

How do I install the pycalphad skill?

Download the skill ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into the .claude/skills/ folder of a project. You can also upload the ZIP in the Claude apps under Settings, then Capabilities, then Skills.

What do I need to run the pycalphad skill?

You need Python 3.12 or newer, pycalphad, NumPy and uv, plus network access for installation. For real alloys you also need a TDB database from a suitable source.

Is the pycalphad skill free to use?

The skill is released under the MIT licence. The bundled Cu-Ni file is a hypothetical teaching model written for the skill, and real-material work needs a licensed, validated thermodynamic database.

Can I use the bundled Cu-Ni database for real alloy design?

No. The bundled file is a hypothetical ideal binary, not an assessed Cu-Ni database, and the skill says it should not be used for real material selection or heat-treatment decisions.

Does the pycalphad skill access the network when it runs?

The skill says its calculations run locally and that the script does not upload the TDB file. Network access is needed for installation of the required packages.

Can the skill predict precipitation or kinetics?

No. It computes equilibrium only. It does not predict precipitation rates, retained metastable microstructures or properties of phases missing from the database.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you are a materials scientist, student or engineer who needs scripted, reproducible equilibrium phase fractions over temperature sweeps and can supply a suitable TDB database. Pick something else if you need kinetics, precipitation or microstructure prediction, or if you have no validated database for your material.

Download the skill