$npx -y skills add Power-Agent/PowerSkills --skill pypsaProgressive-disclosure workflow for PyPSA studies. Use whenever the user wants to load or build a PyPSA network, inspect components or time series, run power flow, solve operational OPF, or run capacity-expansion / investment optimization — even when they just say "optimize the d
| 1 | # PyPSA workflow |
| 2 | |
| 3 | Start by creating or loading a named network handle. Use network inspection before optimization, and use operational optimization before investment optimization. |
| 4 | |
| 5 | ## Default tool ladder |
| 6 | 1. `load_network(file_path)` or `create_network(...)` to create the active network handle. |
| 7 | 2. `get_network_info(network_name)` and `get_component_details(...)` to understand topology, assets, and time series. |
| 8 | 3. `run_power_flow(network_name, linear=False)` for feasibility checks. |
| 9 | 4. `optimize_network(network_name, ...)` for dispatch or operational studies. |
| 10 | 5. `optimize_investment(network_name, ...)` for expansion questions. |
| 11 | 6. `import_from_csv_folder(...)` or `export_to_csv_folder(...)` once the network state is worth moving. |
| 12 | |
| 13 | ## Working rules |
| 14 | - Do not jump straight into expansion optimization when a dispatch study can answer the question. |
| 15 | - Use AC or DC power flow to sanity-check a network before relying on optimization outputs. |
| 16 | - Treat PyPSA as a planning and scheduling engine, not the final authority on detailed reactive mitigation. |
| 17 | |
| 18 | ## Escalation triggers |
| 19 | Quote the numbers that tripped each row (bus + v_mag_pu, element + loading, infeasibility cause) rather than saying "it failed". |
| 20 | |
| 21 | | Observation | Escalate to | |
| 22 | |---|---| |
| 23 | | Bus `v_mag_pu` < 0.95 or > 1.05 on an AC power flow | `voltage-violation-mitigation` | |
| 24 | | Line or transformer loaded > 100% of `s_nom` | `thermal-overload-mitigation` | |
| 25 | | `run_contingency_analysis` N-1 overload or post-outage islanding | `contingency-mitigation` | |
| 26 | | `optimize_network` / `optimize_investment` infeasible, reserve-short, or heavily curtailed | `operations-planning-mitigation` | |
| 27 | | `run_power_flow` fails to converge | `convergence-failure-mitigation` | |
| 28 | |
| 29 | ## Local assets in this skill |
| 30 | - `case39.nc` — a ready test network. |
| 31 | - `scripts/network_analysis.py` — inspection. |
| 32 | - `scripts/optimization_analysis.py` — OPF result review. |
| 33 | - `scripts/expansion_analysis.py` — capacity-expansion studies. |
| 34 | - `scripts/contingency_analysis.py` — local N-1 screening outside PowerMCP. |
| 35 | |
| 36 | ## Deliver |
| 37 | - The network handle and study type. |
| 38 | - The main feasibility or cost result. |
| 39 | - Whether the next step is mitigation, AC validation, or a larger optimization. |