Work with an AI agent
The extension ships an agent skill called pywr-model. A
skill is a set of instructions and scripts that an AI agent, such as GitHub Copilot or
Claude Code, loads when your request needs it. With it, the agent knows the layout of
Pywr v1 and Pywr v2 models, looks up the fields of each type in the schemas of the
extension instead of writing them from memory, and checks the model after each change.
You do not have to name the skill: ask about your model and the agent loads it.
What you can ask
Section titled “What you can ask”- Change a model: “Add a reservoir upstream of the treatment works, with a compensation flow of 5 Ml/d”, “Turn the demand of Town into a monthly profile”, “Rename the node River and update everything that uses it”.
- Start a model: “Create a Pywr v2 model with a catchment, a reservoir and two demands”.
- Fix a model: “Why does this model not load?”
- Explain a model: “How are the upland reservoirs balanced against the pumped storage?”, “Where does the water for Town come from when the reservoir is low?”
When it changes a model, the agent:
- Finds the version of the model and reads the guide for that version.
- Looks up the fields of every node, parameter or recorder type it adds.
- Edits only the part of the file that needs to change, so you can review the change as a diff. Positions, comments and editor settings are kept.
- Checks the model the same way the Problems panel does, and fixes the errors it introduced.
- Tells you what changed in the network, the costs it chose and what you must supply, such as a data file.
When it explains a model, the agent follows each storage through the network to the demands and lists the rules that act on it: the control curves, the limits on the abstractions, the transfers switched on by a storage and the demand restrictions. It says which values it could not read, for example because a data file is missing.
The skill needs Python 3 on your computer to run its script. No Python package is needed.
Use it with GitHub Copilot
Section titled “Use it with GitHub Copilot”The skill is installed with the extension. Open the Chat view, choose the Agent mode and ask about your model.
To see that the skill is available, type / in the chat box: pywr-model is in the
list. You can also type /pywr-model followed by your request to use it on purpose.
Use it with Claude Code
Section titled “Use it with Claude Code”Claude Code reads skills from its own skills folder, so the extension copies the skill there for you.
-
Open the Command Palette (Ctrl Shift P, or Cmd Shift P on macOS) and type Pywr: Install the skill for Claude Code.
-
Choose where to install it:
- For all your projects copies it to
~/.claude/skills/pywr-model. - For the name workspace folder copies it to
.claude/skills/pywr-modelin that folder. Commit the folder to share the skill with the people who work on the project.
When the skill is already there, the extension asks before it replaces it.
- For all your projects copies it to
-
Start a new Claude Code session and ask about your model.
Use it with other agents
Section titled “Use it with other agents”Copy the pywr-model folder from the folder of the extension, for example
~/.vscode/extensions/s-simoncelli.pywr-vscode-<version>/skills/pywr-model
(%USERPROFILE%\.vscode\extensions\... on Windows), into the skills folder of your
agent: ~/.agents/skills/ for all your projects or .agents/skills/ for one project.
When more than one version of the extension is installed, copy from the latest one.
An installed copy still reads the schemas from the installed extension, so it follows the extension when it is updated. Install it again after an update to get a newer version of the skill itself.