Swmm Builder logo

Swmm Builder

Community
Zhonghao1995
swmm-builder

Assemble a runnable SWMM INP deterministically from subcatchment geometry/attributes, merged parameter JSON, network JSON, and climate references. Use when creating auditable INP + manifest artifacts for downstream swmm-runner/calibration.

Overview

PublisherZhonghao1995
Repositoryagentic-swmm-workflow
Skill nameswmm-builder
Stars
33
Forks
15
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Zhonghao1995 on GitHub. Read the source before you install it.

Installation

Install the Swmm Builder AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Zhonghao1995/agentic-swmm-workflow/tree/main/skills/swmm-builder
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Zhonghao1995/agentic-swmm-workflow.git /tmp/agentic-swmm-workflow
mkdir -p .claude/skills
cp -r /tmp/agentic-swmm-workflow/skills/swmm-builder .claude/skills/swmm-builder
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Swmm Builder in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Swmm Builder on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Swmm Builder is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

SWMM Builder (INP assembly layer)

Part of Agentic SWMM — install the project first for the executable toolchain (aiswmm CLI, SWMM solver, MCP servers).

Contract

Build a runnable SWMM .inp using explicit file inputs:

  • subcatchments.csv (shape/area/outlet/routing basics)
  • merged params JSON from swmm-params
  • network JSON from swmm-network
  • rainfall/time-series references from swmm-climate
  • optional options config JSON

The builder writes:

  • final SWMM INP text (--out-inp)
  • manifest JSON (--out-manifest) with source paths + SHA256 + key metadata
  • strict validation diagnostics for critical sections ([OPTIONS], [RAINGAGES], [TIMESERIES], [SUBCATCHMENTS], [SUBAREAS], [INFILTRATION], and current network sections)

Inputs

Subcatchments CSV schema (required)

Required columns:

  • subcatchment_id
  • outlet
  • area_ha
  • width_m
  • slope_pct

Optional columns:

  • rain_gage (falls back to default gage from climate/config)
  • curb_length_m (default 0)
  • snow_pack (default blank)

Params JSON (required)

Expected to match skills/swmm-params/scripts/merge_swmm_params.py output:

  • sections.subcatchments (id, pct_imperv)
  • sections.subareas (id, runoff/subarea fields)
  • sections.infiltration (id, Green-Ampt fields)
  • Required fields are now validated strictly with type/range checks (for example %Imperv and routing percentages must be 0..100).

Network JSON (required)

Expected to match skills/swmm-network schema (junctions, outfalls, conduits, etc.). Builder now validates required network fields used to emit [JUNCTIONS], [OUTFALLS], [CONDUITS], [XSECTIONS], [COORDINATES], and [VERTICES].

Climate references (required in MVP)

Provide either:

  • --timeseries-text directly, or
  • --rainfall-json produced by swmm-climate/format_rainfall.py (must include outputs.timeseries_text)

For [RAINGAGES], provide either:

  • --raingage-json from swmm-climate/build_raingage_section.py, or
  • rely on default deterministic gage generation from rainfall series_name.

--raingage-json supports both the original single-gage form and a multi-gage form:

json
{
  "gages": [
    {
      "id": "RG1",
      "rain_format": "VOLUME",
      "interval_min": 5,
      "scf": 1.0,
      "source": {"kind": "TIMESERIES", "series_name": "TS_RG1"}
    },
    {
      "id": "RG2",
      "rain_format": "VOLUME",
      "interval_min": 5,
      "scf": 1.0,
      "source": {"kind": "TIMESERIES", "series_name": "TS_RG2"}
    }
  ]
}

The timeseries text must include rows for every referenced series_name, and each subcatchment rain_gage must reference one of the emitted gage IDs.

Validation behavior:

  • Missing critical fields fail fast with explicit section-scoped errors.
  • [TIMESERIES] rows are validated for series-name consistency and basic token/time/value correctness.
  • Manifest includes validation plus validation_diagnostics metadata.

Scripts

  • scripts/build_swmm_inp.py
    • single entrypoint that reads all inputs and writes INP + manifest.

MCP

MCP wrapper location:

  • mcp/swmm-builder/server.js (was previously skills/swmm-builder/scripts/mcp/; moved during the mcp/ root restructure)

Exposed tools:

  • build_inp — assemble a runnable SWMM INP + manifest from subcatchments CSV, area-weighted params JSON, network JSON, rainfall JSON + timeseries text, and an options-config JSON. Required args: subcatchmentsCsvPath, paramsJsonPath, networkJsonPath, outInpPath, outManifestPath. Optional: rainfallJsonPath, raingageJsonPath, timeseriesTextPath, configJsonPath, defaultGageId, waterQualityJsonPath (path to a WQ config JSON — enables [POLLUTANTS]/[LANDUSES]/[BUILDUP]/[WASHOFF]/[COVERAGES]/ [LOADINGS] sections for pollutant buildup/washoff simulation). The subcatchments CSV must carry outlet values that point to real upstream junctions (use swmm-network-mcp.assign_subcatchment_outlets first if it currently points to the literal outfall).

Smoke example

The builder requires upstream outputs from swmm-params and swmm-climate. Generate them first, then call build_swmm_inp.py:

bash
# 1. Generate merged params from the bundled examples
mkdir -p /tmp/builder-smoke
python3 skills/swmm-params/scripts/landuse_to_swmm_params.py \
  --input skills/swmm-params/examples/landuse_input.csv \
  --output /tmp/builder-smoke/landuse.json
python3 skills/swmm-params/scripts/soil_to_greenampt.py \
  --input skills/swmm-params/examples/soil_input.csv \
  --output /tmp/builder-smoke/soil.json
python3 skills/swmm-params/scripts/merge_swmm_params.py \
  --landuse-json /tmp/builder-smoke/landuse.json \
  --soil-json /tmp/builder-smoke/soil.json \
  --output /tmp/builder-smoke/merged_params.json

# 2. Format rainfall from the bundled climate example
python3 skills/swmm-climate/scripts/format_rainfall.py \
  --input skills/swmm-climate/examples/rainfall_event.csv \
  --out-json /tmp/builder-smoke/rainfall.json \
  --out-timeseries /tmp/builder-smoke/rainfall_timeseries.txt

# 3. Build the INP
python3 skills/swmm-builder/scripts/build_swmm_inp.py \
  --subcatchments-csv skills/swmm-builder/examples/subcatchments_input.csv \
  --params-json /tmp/builder-smoke/merged_params.json \
  --network-json skills/swmm-network/examples/basic-network.json \
  --rainfall-json /tmp/builder-smoke/rainfall.json \
  --config-json skills/swmm-builder/examples/options_config.json \
  --out-inp /tmp/builder-smoke/example_model.inp \
  --out-manifest /tmp/builder-smoke/example_manifest.json

Water quality sections

Pass --water-quality-json <path> to enable pollutant buildup/washoff simulation. The JSON must satisfy the schema in skills/swmm-water-quality/SKILL.md. Omit the flag for pure hydrology runs (Water Quality: NO in the INP).

bash
# Build an INP with water quality (TSS, 1 landuse, executed example):
python3 skills/swmm-builder/scripts/build_swmm_inp.py \
  --subcatchments-csv skills/swmm-builder/examples/subcatchments_input.csv \
  --params-json /tmp/builder-smoke/merged_params.json \
  --network-json skills/swmm-network/examples/basic-network.json \
  --water-quality-json /tmp/wq_example.json \
  --out-inp /tmp/wq_model.inp \
  --out-manifest /tmp/wq_manifest.json

The builder validates all cross-references (pollutant/landuse/subcatchment consistency) before writing the INP.

Known limitations

  • No automatic polygon export, LID controls, snowpack, or RTC rules.
  • Assumes one raingage source for all subcatchments unless rain_gage is explicitly set per row.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Swmm Builder AI skill do?

Assemble a runnable SWMM INP deterministically from subcatchment geometry/attributes, merged parameter JSON, network JSON, and climate references. Use when creating auditable INP + manifest artifacts for downstream swmm-runner/calibration.

Why use Swmm Builder on TypingMind?

Because you install it once and use it with any model. Swmm Builder is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Swmm Builder in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Zhonghao1995/agentic-swmm-workflow/tree/main/skills/swmm-builder. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Swmm Builder?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Swmm Builder?

As many as you like. As long as a model supports skills, you can use Swmm Builder with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Swmm Builder AI skill free?

Yes. It is published on GitHub by Zhonghao1995 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇