Logo von Swmm Network

Swmm Network

Community
Zhonghao1995
swmm-network

Network QA of an existing INP (disconnected nodes, missing outfalls, adverse or zero slopes) is one call, network_qa, so call it first. Also builds, validates and routes SWMM pipe-network models from raw municipal shapefiles or structured GIS/CAD exports. Use when handling junctions, conduits, outfalls, xsections, network field-mapping configs, or wiring subcatchments to upstream nodes. Requires real pipe data as SHP / GeoJSON / CSV — native CAD (DXF/DWG) is not parsed and must first be exported to one of these. For data-scarce areas where only a bbox is available and no pipe inventory exists, use `swmm-anywhere` instead.

Übersicht

HerausgeberZhonghao1995
Repositoryagentic-swmm-workflow
Skill-Nameswmm-network
Sterne
33
Forks
15
Mitgelieferte Dateien
25
LizenzMIT
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • Mitgelieferte Dateien: 25

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von Zhonghao1995 auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Swmm Network in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/Zhonghao1995/agentic-swmm-workflow/tree/main/skills/swmm-network
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

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-network .claude/skills/swmm-network
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Swmm Network in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Swmm Network automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Swmm Network nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

SWMM Network (pipe-system layer)

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

What this skill provides

  • A stable JSON schema for SWMM drainage-network structure.
  • Two complementary import paths:
    • Raw municipal shapefile path (prepare_storm_inputs → infer_outfall → reorient_pipes → import_city_network → qa) for typical city storm-pipe + manhole layers that arrive as bare LineString shapefiles.
    • Structured asset-DB path (import_city_network directly, or import_network for a fully field-mapped GeoJSON/CSV) when the source already contains explicit from/to nodes, inverts, and diameters.
  • A subcatchment-to-network wiring step (assign_subcatchment_outlets) that ensures surface runoff actually enters the pipe network at a real upstream junction rather than dumping straight to the outfall.
  • Topology / hydraulic-attribute QA (qa).
  • Lightweight introspection (summary).
  • Export from network JSON to core SWMM INP sections (export_inp).

When to use this skill

Use when a SWMM model needs a real pipe network. Specifically:

  • You have municipal storm-pipe shapefile(s) and want them imported into a SWMM-ready network.json.
  • You have a structured CAD/asset-DB export (CSV / GeoJSON with explicit topology) and want the same.
  • You need to attach subcatchments to upstream junctions instead of letting them dump to the outfall.
  • You need to QA an existing network.json before handing it to swmm-builder.

Do not use this skill when the user only wants subcatchment delineation (use swmm-gis) or only wants to run a finished INP (use swmm-runner).

MCP tools

mcp/swmm-network/server.js exposes nine tools. Pick by what stage of the pipeline you're at.

Raw-shapefile preparation chain

  1. prepare_storm_inputs — clip raw <municipal>StormGravityMain.shp (+ optional <municipal>StormManhole.shp) to a basin polygon and emit pipes.geojson, manholes.geojson, and a filled mapping.json from a template.

    • Args: pipesShpPath, manholesShpPath (optional), basinClipGeojsonPath, mappingTemplatePath, outDir, caseName, sourceDescription, diameterPolicy (optional).
    • Use templates/city_mapping_raw_shapefile.template.json as the mapping template.
    • Does not pick the outfall, fix flow direction, or snap drifting endpoints (those are separate tools).
  2. snap_pipe_endpoints — cluster nearby pipe endpoints (sub-millimetre to centimetre vertex drift) and snap each cluster to its centroid so adjacent pipes share identical endpoint coordinates. Without this, import_city_network infers separate junctions for drifting endpoints and the network ends up as disconnected fragments. Also drops pipes whose two endpoints collapse into the same cluster (self-loop conduits that SWMM rejects).

    • Args: pipesGeojsonPath, toleranceM, outPath.
    • Reports pipes_in / pipes_out / pipes_dropped_as_self_loops / clusters_merged / max_snap_distance_m.
    • Reasonable starting tolerance: 0.5–3 m for municipal storm pipe layers. Inspect the report before raising further.
  3. infer_outfall — pick a single outfall point from pipe endpoints. Two modes:

    • endpoint_nearest_watercourse (default; needs a watercourse GeoJSON).
    • lowest_endpoint (uses min y, no watercourse needed; assumes a projected, north-positive CRS).
    • Args: pipesGeojsonPath, watercourseGeojsonPath (mode-dependent), mode, outPath.
    • Emits a single-Point outfalls.geojson (node_id=OUT1, type=FREE, invert_elev=0.0).
  4. reorient_pipes — BFS from outfall vertices to flip LineString direction so it matches flow direction. Real municipal pipes are usually digitised arbitrarily and would otherwise produce bogus from_node/to_node assignments.

    • Args: pipesGeojsonPath, outfallsGeojsonPath, outPath, coordinatePrecision (default 3).
    • Reports pipes_reversed, pipes_unreached so connectivity gaps are visible.

Network assembly

  1. import_city_network — main adapter. Takes the prepared pipes+outfalls geojsons (or any structured pipe table) plus a mapping.json and emits network.json with inferred junctions if needed.

    • Args: pipesCsvPath OR pipesGeojsonPath, outfallsCsvPath OR outfallsGeojsonPath, optional junctions, mappingPath, outputPath.
    • For mapping.json: see templates/README.md (raw-shapefile vs structured-export shapes).
  2. import_network — older field-mapped import for GeoJSON/CSV when topology and inverts are explicit per row. Prefer import_city_network for new work.

Subcatchment wiring (REQUIRED for the pipe network to actually carry water)

  1. assign_subcatchment_outlets — rewrite the outlet column of a subcatchments CSV so each subcatchment drains into a real upstream node (not the literal outfall). Without this step the pipe network sits idle in the SWMM model.
    • Args: subcatchmentsCsvIn, subcatchmentsGeojson, outCsv, mode.
    • Modes:
      • nearest_junction (default; needs networkJsonPath)
      • nearest_catch_basin (needs candidatesGeojsonPath + candidatesIdField)
      • manual_lookup (needs lookupCsvPath with columns subcatchment_id,outlet_node_id)

QA + export

  1. qa — run topology + required-attribute checks on a network. Args: networkJsonPath or inpPath (provide exactly one). inpPath runs the same checks on a SWMM .inp via inp_to_network.py — use it to QA a SWMManywhere-synthesized model (which emits an INP but no network.json) or any INP-only path, so structural QA is uniform across the real-data and synth paths. Returns a structured QA report (warnings include isolated_node, no_outfall_path, missing inverts, etc.). CLI: python3 scripts/network_qa.py --inp <model.inp>.

  2. export_inp — render a network.json to SWMM INP sections (junctions/outfalls/conduits/xsections/coordinates). Args: networkJsonPath. Used internally by swmm-builder; rarely called directly by an agent.

  3. summary — quick counts (junctions, outfalls, conduits, total length, system_layers, dual-system-ready flag). Args: networkJsonPath. For diagnostics.

Recommended orchestration

For a raw municipal shapefile dataset, the canonical chain is:

prepare_storm_inputs       → pipes.geojson + manholes.geojson + mapping.json
snap_pipe_endpoints        → pipes_snapped.geojson  (heal vertex drift; also drops self-loop pipes)
infer_outfall              → outfalls.geojson
reorient_pipes             → pipes_oriented.geojson
import_city_network        → network.json
qa                         → ok / warnings
assign_subcatchment_outlets → subcatchments_routed.csv  (required if subcatchments came from swmm-gis basin_shp_to_subcatchments)
   ↓
hand off to swmm-builder.build_inp

For a structured CAD export with explicit from/to nodes, skip prepare_storm_inputs/infer_outfall/reorient_pipes and call import_city_network directly with the CSVs.

Templates and examples

  • templates/city_mapping_raw_shapefile.template.json — fully-specified mapping for raw LineString-only pipe shapefiles. The adapter infers junctions from endpoints. Used by the prepare_storm_inputs chain.
  • templates/README.md — decision walkthrough between the two mapping shapes.
  • examples/city-dual-system/mapping.json — fully-specified mapping for structured exports with explicit from/to/x/y/invert columns.
  • examples/import-mapping.json + examples/import-junctions.geojson etc. — example inputs for the older import_network path.

Scripts (Python implementations behind the MCP tools)

  • scripts/prepare_storm_inputs.py — backs prepare_storm_inputs.
  • scripts/infer_outfall.py — backs infer_outfall.
  • scripts/reorient_pipes.py — backs reorient_pipes.
  • scripts/city_network_adapter.py — backs import_city_network.
  • scripts/network_import.py — backs import_network.
  • scripts/assign_subcatchment_outlets.py — backs assign_subcatchment_outlets.
  • scripts/network_qa.py — backs qa.
  • scripts/network_to_inp.py — backs export_inp.
  • scripts/minimal_stub_network.py — emits a 1-junction + 1-outfall stub network.json from a subcatchment shapefile that carries OUTLET/X/Y attrs. Use only for real-data smoke tests when no pipe-network geometry exists yet; the resulting network must not be treated as a calibrated drainage system.
  • scripts/schema/network_model.schema.json — stable schema target.

Conventions

  • Prefer explicit, machine-readable JSON in/out.
  • Keep node/link IDs unique and stable; the adapter generates J_AUTO_<x>p<y> IDs for inferred junctions.
  • MVP assumes gravity-network basics first (no pumps/weirs/orifices).
  • Dual-system-ready currently means representation and QA metadata, not fully coupled 1D/2D hydraulics.
  • All polygon area / distance calculations assume a projected CRS — the tools error early if a geographic CRS is supplied.

Known limitations

  • Pipe inverts default to 0.0 m when not provided. A DEM-based invert inference tool is open as BACKLOG.md F12.
  • infer_outfall always emits exactly one outfall (OUT1). Multi-outfall networks need a follow-up tool.
  • snap_pipe_endpoints only heals vertex drift, not physically missing pipes. If a basin clip cuts out a trunk sewer that connects two sub-graphs, the sub-graphs remain disconnected. A future "buffered basin clip" feature in prepare_storm_inputs would address this.

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill Swmm Network?

Network QA of an existing INP (disconnected nodes, missing outfalls, adverse or zero slopes) is one call, network_qa, so call it first. Also builds, validates and routes SWMM pipe-network models from raw municipal shapefiles or structured GIS/CAD exports. Use when handling junctions, conduits, outfalls, xsections, network field-mapping configs, or wiring subcatchments to upstream nodes. Requires real pipe data as SHP / GeoJSON / CSV — native CAD (DXF/DWG) is not parsed and must first be exported to one of these. For data-scarce areas where only a bbox is available and no pipe inventory exis...

Warum Swmm Network in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Swmm Network besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Swmm Network in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/Zhonghao1995/agentic-swmm-workflow/tree/main/skills/swmm-network ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Swmm Network nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Swmm Network verwenden?

So viele Sie möchten. In TypingMind können Sie Swmm Network mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Swmm Network kostenlos?

Ja. Der Skill wird von Zhonghao1995 auf GitHub unter der Lizenz MIT veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇