Agent skill

Locational Marginal Prices

by benchflow-ai in benchflow-ai/skillsbench

Extract locational marginal prices (LMPs) from DC-OPF solutions using dual values.

Apache-2.0Auto-check passed

Install Locational Marginal Prices

skills CLI
$ npx skills add benchflow-ai/skillsbench --skill locational-marginal-prices -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install benchflow-ai/skillsbench locational-marginal-prices --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/benchflow-ai/skillsbench.git skills-src && mkdir -p .claude/skills && cp -r skills-src/tasks/energy-market-pricing/environment/skills/locational-marginal-prices .claude/skills/locational-marginal-prices && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
locational-marginal-prices
GitHub stars
1.8k
Token cost
~1.2k tokens
SKILL.md length
283 words
Files
1
Skills in repo
189
Repo updated
First seen
Licence
Apache-2.0

At a glance

Extract locational marginal prices (LMPs) from DC-OPF solutions using dual values.

  • Works in 3 steps: Store references to the balance… → Solve the problem → Read the dual values after solving
  • Computing nodal electricity prices
  • SKILL.md covers LMP Extraction from CVXPY, LMP Sign Convention, Reserve Clearing Price and Finding Binding Lines, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Locational Marginal Prices is an agent skill from benchflow-ai/skillsbench. Extract locational marginal prices (LMPs) from DC-OPF solutions using dual values. Use when computing nodal electricity prices, reserve clearing prices, or performing price impact analysis.

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: SkillsBench evaluates how well skills work and how effective agents are at using them. The licence is Apache-2.0.

When your agent uses it

  • Computing nodal electricity prices
  • Reserve clearing prices
  • Performing price impact analysis

Example prompts

  • “/locational-marginal-prices”

Requirements

  • Python 3

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Store references to the balance constraints
  2. Solve the problem
  3. Read the dual values after solving

What it can do on your machine

Read from SKILL.md and the folder at commit 9a1f4dd. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Locational Marginal Prices loads about 1.2k tokens when it runs. Until then it costs about 54 tokens; SKILL.md has 283 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~54
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from benchflow-ai/skillsbench at commit 9a1f4dd, republished under its Apache-2.0 licence (© benchflow-ai). 283 words, ~1,184 tokens.

Download SKILL.mdSave it as .claude/skills/locational-marginal-prices/SKILL.md (or your agent's skills folder).
name
locational-marginal-prices
description
Extract locational marginal prices (LMPs) from DC-OPF solutions using dual values. Use when computing nodal electricity prices, reserve clearing prices, or performing price impact analysis.

Locational Marginal Prices (LMPs)

LMPs are the marginal cost of serving one additional MW of load at each bus. In optimization terms, they are the dual values (shadow prices) of the nodal power balance constraints.

LMP Extraction from CVXPY

To extract LMPs, you must:

  1. Store references to the balance constraints
  2. Solve the problem
  3. Read the dual values after solving
python
import cvxpy as cp

# Store balance constraints separately for dual extraction
balance_constraints = []

for i in range(n_bus):
    pg_at_bus = sum(Pg[g] for g in range(n_gen) if gen_bus[g] == i)
    pd = buses[i, 2] / baseMVA

    # Create constraint and store reference
    balance_con = pg_at_bus - pd == B[i, :] @ theta
    balance_constraints.append(balance_con)
    constraints.append(balance_con)

# Solve
prob = cp.Problem(cp.Minimize(cost), constraints)
prob.solve(solver=cp.CLARABEL)

# Extract LMPs from duals
lmp_by_bus = []
for i in range(n_bus):
    bus_num = int(buses[i, 0])
    dual_val = balance_constraints[i].dual_value

    # Scale: constraint is in per-unit, multiply by baseMVA to get $/MWh
    lmp = float(dual_val) * baseMVA if dual_val is not None else 0.0
    lmp_by_bus.append({
        "bus": bus_num,
        "lmp_dollars_per_MWh": round(lmp, 2)
    })

LMP Sign Convention

For a balance constraint written as generation - load == net_export:

  • Positive LMP: Increasing load at that bus increases total cost (typical case)
  • Negative LMP: Increasing load at that bus decreases total cost

Negative LMPs commonly occur when:

  • Cheap generation is trapped behind a congested line (can't export power)
  • Adding load at that bus relieves congestion by consuming local excess generation
  • The magnitude can be very large in heavily congested networks (thousands of $/MWh)

Negative LMPs are physically valid and expected in congested systems — they are not errors.

Reserve Clearing Price

The reserve MCP is the dual of the system reserve requirement constraint:

python
# Store reference to reserve constraint
reserve_con = cp.sum(Rg) >= reserve_requirement
constraints.append(reserve_con)

# After solving:
reserve_mcp = float(reserve_con.dual_value) if reserve_con.dual_value is not None else 0.0

The reserve MCP represents the marginal cost of providing one additional MW of reserve capacity system-wide.

Finding Binding Lines

Lines at or near thermal limits (≥99% loading) cause congestion and LMP separation. See the dc-power-flow skill for line flow calculation details.

python
BINDING_THRESHOLD = 99.0  # Percent loading

binding_lines = []
for k, br in enumerate(branches):
    f = bus_num_to_idx[int(br[0])]
    t = bus_num_to_idx[int(br[1])]
    x, rate = br[3], br[5]

    if x != 0 and rate > 0:
        b = 1.0 / x
        flow_MW = b * (theta.value[f] - theta.value[t]) * baseMVA
        loading_pct = abs(flow_MW) / rate * 100

        if loading_pct >= BINDING_THRESHOLD:
            binding_lines.append({
                "from": int(br[0]),
                "to": int(br[1]),
                "flow_MW": round(float(flow_MW), 2),
                "limit_MW": round(float(rate), 2)
            })

Counterfactual Analysis

To analyze the impact of relaxing a transmission constraint:

  1. Solve base case — record costs, LMPs, and binding lines
  2. Modify constraint — e.g., increase a line's thermal limit
  3. Solve counterfactual — with the relaxed constraint
  4. Compute impact — compare costs and LMPs
python
# Modify line limit (e.g., increase by 20%)
for k in range(n_branch):
    br_from, br_to = int(branches[k, 0]), int(branches[k, 1])
    if (br_from == target_from and br_to == target_to) or \
       (br_from == target_to and br_to == target_from):
        branches[k, 5] *= 1.20  # 20% increase
        break

# After solving both cases:
cost_reduction = base_cost - cf_cost  # Should be >= 0

# LMP changes per bus
for bus_num in base_lmp_map:
    delta = cf_lmp_map[bus_num] - base_lmp_map[bus_num]
    # Negative delta = price decreased (congestion relieved)

# Congestion relieved if line was binding in base but not in counterfactual
congestion_relieved = was_binding_in_base and not is_binding_in_cf
Economic Intuition
  • Relaxing a binding constraint cannot increase cost (may decrease or stay same)
  • Cost reduction quantifies the shadow price of the constraint
  • LMP convergence after relieving congestion indicates reduced price separation

© benchflow-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in tasks/energy-market-pricing/environment/skills/locational-marginal-prices of benchflow-ai/skillsbench.

Open the folder on GitHubat commit 9a1f4dd

Compare with similar skills

Locational Marginal Prices next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Locational Marginal Prices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Locational Marginal Prices this skillbenchflow-ai/skillsbench1.8k—~1.2kAutomated safety check: PassApache-2.0
Pricingsickn33/agentic-awesome-skills47k1 repos~1.9kAutomated safety check: PassMIT
Pricing Strategyphuryn/pm-skills27k—~913Automated safety check: PassMIT
Pricing Strategyalirezarezvani/claude-skills28k1 repos~3.5kAutomated safety check: PassMIT
Extractalirezarezvani/claude-skills28k—~1.4kAutomated safety check: PassMIT
Pricing Strategistalirezarezvani/claude-skills28k—~2.3kAutomated safety check: PassMIT

Similar skills

  • Pricing

    sickn33/agentic-awesome-skills

    When the user wants help with pricing decisions, packaging, or monetization strategy.

    47k GitHub starsUsed in 1 repo~1.9k tokens
    Sales & SupportAuto-check passed
  • Pricing Strategy

    phuryn/pm-skills

    Analyze and design pricing strategies including pricing models, competitive pricing analysis, willingness-to-pay estimation, and price elasticity.

    27k GitHub stars~913 tokensUpdated yesterday
    Sales & SupportAuto-check passed
  • Pricing Strategy

    alirezarezvani/claude-skills

    Design, optimize, and communicate SaaS pricing — tier structure, value metrics, pricing pages, and price increase strategy.

    28k GitHub starsUsed in 1 repo~3.5k tokens
    Sales & SupportAuto-check passed
  • Extract

    alirezarezvani/claude-skills

    Turn a proven pattern or debugging solution into a standalone reusable skill with SKILL.md, reference docs, and examples.

    28k GitHub stars~1.4k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Pricing Strategist

    alirezarezvani/claude-skills

    A skill your agent uses when designing or revisiting product pricing — selecting a pricing model (subscription seat-based, usage-based, value-based, freemium, or hybrid), running Van Westendorp…

    28k GitHub stars~2.3k tokensUpdated 1 mo ago
    Sales & SupportAuto-check passed
  • SaaS Pricing Strategist

    sickn33/agentic-awesome-skills

    Design, optimize, and test pricing strategies for SaaS products using data-driven frameworks, competitive analysis, and psychological pricing principles.

    47k GitHub starsUsed in 1 repo~1.5k tokens
    Marketing & SEOAuto-check passed

More from benchflow-ai/skillsbench

All 189 skills in this repo
  • Lean4 Memories

    benchflow-ai/skillsbench

    This skill should be used when working on Lean 4 formalization projects to maintain persistent memory of successful proof patterns, failed approaches, project conventions, and user preferences…

    1.8k GitHub stars~3.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Senior Data Engineer

    benchflow-ai/skillsbench

    World-class data engineering skill for building scalable data pipelines, ETL/ELT systems, real-time streaming, and data infrastructure.

    1.8k GitHub stars~5.9k tokensUpdated 2 mo ago
    Auto-check passed
  • Ac Branch Pi Model

    benchflow-ai/skillsbench

    AC branch pi-model power flow equations (P/Q and |S|) with transformer tap ratio and phase shift, matching acopf-math-model.md and MATPOWER branch fields.

    1.8k GitHub stars~1.1k tokensUpdated 2 mo ago
    Auto-check passed
  • Civ6lib

    benchflow-ai/skillsbench

    Civilization 6 district mechanics library. An agent skill from benchflow-ai/skillsbench.

    1.8k GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed
  • D3 Visualization

    benchflow-ai/skillsbench

    Build deterministic, verifiable data visualizations with D3.js (v6).

    1.8k GitHub stars~1.5k tokensUpdated 2 mo ago
    Auto-check passed
  • Dc Power Flow

    benchflow-ai/skillsbench

    DC power flow analysis for power systems. An agent skill from benchflow-ai/skillsbench.

    1.8k GitHub stars~717 tokensUpdated 2 mo ago
    Auto-check passed

Questions about Locational Marginal Prices

What does Locational Marginal Prices do?

Extract locational marginal prices (LMPs) from DC-OPF solutions using dual values. Locational Marginal Prices is an agent skill from benchflow-ai/skillsbench. Extract locational marginal prices (LMPs) from DC-OPF solutions using dual values.

When should I use Locational Marginal Prices?

Locational Marginal Prices fits situations like: computing nodal electricity prices; reserve clearing prices; performing price impact analysis.

How do I install Locational Marginal Prices in Claude Code?

Run `npx skills add benchflow-ai/skillsbench --skill locational-marginal-prices -a claude-code`. Or copy the skill folder (tasks/energy-market-pricing/environment/skills/locational-marginal-prices in benchflow-ai/skillsbench) into .claude/skills/locational-marginal-prices in your project. Claude Code loads it when a task matches its description.

How do I install Locational Marginal Prices in Codex?

Run `npx skills add benchflow-ai/skillsbench --skill locational-marginal-prices -a codex`. Or copy the skill folder (tasks/energy-market-pricing/environment/skills/locational-marginal-prices in benchflow-ai/skillsbench) into .agents/skills/locational-marginal-prices in your project. Codex loads it when a task matches its description.

Can I use Locational Marginal Prices in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add benchflow-ai/skillsbench --skill locational-marginal-prices -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/locational-marginal-prices, .gemini/skills/locational-marginal-prices, .github/skills/locational-marginal-prices and .opencode/skills/locational-marginal-prices in your project.

What does Locational Marginal Prices need to run?

SKILL.md names no scripts, command-line tools or credentials: Locational Marginal Prices is instructions for the agent only. Our summary lists: Python 3.

Does Locational Marginal Prices access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Locational Marginal Prices safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Locational Marginal Prices use?

Locational Marginal Prices is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Locational Marginal Prices use?

About 1.2k tokens (SKILL.md is roughly 4.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Locational Marginal Prices?

Skills that share tags, products or a category with Locational Marginal Prices: Pricing (sickn33/agentic-awesome-skills, 47k stars), Pricing Strategy (phuryn/pm-skills, 27k stars), Pricing Strategy (alirezarezvani/claude-skills, 28k stars) and Extract (alirezarezvani/claude-skills, 28k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Locational Marginal Prices?

benchflow-ai (a GitHub organization) maintains it in benchflow-ai/skillsbench, which has 1,835 GitHub stars. The repository holds 189 skills in this directory. The repository was last updated on July 23, 2026.

Source: benchflow-ai/skillsbench on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.