Agent skill

Finite Horizon Lqr

by benchflow-ai in benchflow-ai/skillsbench

Solving finite-horizon LQR via dynamic programming for MPC. An agent skill from benchflow-ai/skillsbench.

Apache-2.0Auto-check passed

Install Finite Horizon Lqr

skills CLI
$ npx skills add benchflow-ai/skillsbench --skill finite-horizon-lqr -a claude-code

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

GitHub CLI
$ gh skill install benchflow-ai/skillsbench finite-horizon-lqr --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/r2r-mpc-control/environment/skills/finite-horizon-lqr .claude/skills/finite-horizon-lqr && 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
finite-horizon-lqr
GitHub stars
1.8k
Token cost
~270 tokens
SKILL.md length
60 words
Files
1
Skills in repo
189
Repo updated
First seen
Licence
Apache-2.0

At a glance

Solving finite-horizon LQR via dynamic programming for MPC. An agent skill from benchflow-ai/skillsbench.

  • Works in 4 steps: Measure current state x → Solve finite-horizon LQR from x → Apply first control u_0 → …
  • SKILL.md covers Problem Formulation, Backward Riccati Recursion, Forward Simulation and Python Implementation, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Finite Horizon Lqr is an agent skill from benchflow-ai/skillsbench. Solving finite-horizon LQR via dynamic programming for MPC.

Its SKILL.md is about 270 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.

Example prompts

  • “/finite-horizon-lqr”

Requirements

  • Python 3

Workflow steps

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

  1. Measure current state x
  2. Solve finite-horizon LQR from x
  3. Apply first control u_0
  4. Repeat next timestep

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

Finite Horizon Lqr loads about 270 tokens when it runs. Until then it costs about 20 tokens; SKILL.md has 60 words of instructions outside code blocks.

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

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). 60 words, ~270 tokens.

Download SKILL.mdSave it as .claude/skills/finite-horizon-lqr/SKILL.md (or your agent's skills folder).
name
finite-horizon-lqr
description
Solving finite-horizon LQR via dynamic programming for MPC.

Finite-Horizon LQR for MPC

Problem Formulation

Minimize cost over horizon N:

J = Σ(k=0 to N-1) [x'Qx + u'Ru] + x_N' P x_N

Backward Riccati Recursion

Initialize: P_N = Q (or LQR solution for stability)

For k = N-1 down to 0:

python
K_k = inv(R + B'P_{k+1}B) @ B'P_{k+1}A
P_k = Q + A'P_{k+1}(A - B @ K_k)

Forward Simulation

Starting from x_0:

python
u_k = -K_k @ x_k
x_{k+1} = A @ x_k + B @ u_k

Python Implementation

python
def finite_horizon_lqr(A, B, Q, R, N, x0):
    nx, nu = A.shape[0], B.shape[1]
    K = np.zeros((nu, nx, N))
    P = Q.copy()

    # Backward pass
    for k in range(N-1, -1, -1):
        K[:,:,k] = np.linalg.solve(R + B.T @ P @ B, B.T @ P @ A)
        P = Q + A.T @ P @ (A - B @ K[:,:,k])

    # Return first control
    return -K[:,:,0] @ x0

MPC Application

At each timestep:

  1. Measure current state x
  2. Solve finite-horizon LQR from x
  3. Apply first control u_0
  4. Repeat next timestep

© 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/r2r-mpc-control/environment/skills/finite-horizon-lqr of benchflow-ai/skillsbench.

Open the folder on GitHubat commit 9a1f4dd

Compare with similar skills

Finite Horizon Lqr 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.

Finite Horizon Lqr compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Finite Horizon Lqr this skillbenchflow-ai/skillsbench1.8k—~270Automated safety check: PassApache-2.0
Dynamic Workflow Modeaffaan-m/ECC277k1 repos~1.3kAutomated safety check: PassMIT
Horizon Trackruvnet/ruflo74k—~744Automated safety check: NotesMIT
Configuring Horizoncoollabsio/coolify63k4 repos~898Automated safety check: PassMIT
Molecular DynamicsK-Dense-AI/scientific-agent-skills48k1 repos~4.7kAutomated safety check: PassMIT
Accint Solvesickn33/agentic-awesome-skills47k1 repos~520Automated safety check: PassApache-2.0

Similar skills

  • Design task-local harnesses, eval gates, and reusable skill extraction for Claude dynamic workflow mode and other adaptive agent harnesses.

    277k GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • Horizon Track

    ruvnet/ruflo

    Track long-horizon objectives across multiple sessions with milestone checkpoints, progress persistence, and drift detection

    74k GitHub stars~744 tokensUpdated yesterday
    Product & Project ManagementAuto-check: notes
  • Configuring Horizon

    coollabsio/coolify

    A skill your agent uses whenever the user mentions Horizon by name in a Laravel context.

    63k GitHub starsUsed in 4 repos~898 tokens
    Backend & APIsAuto-check passed
  • Molecular Dynamics

    K-Dense-AI/scientific-agent-skills

    Runs and analyzes molecular dynamics simulations with OpenMM and MDAnalysis.

    48k GitHub starsUsed in 1 repo~4.7k tokens
    Research & ScienceAuto-check passed
  • Accint Solve

    sickn33/agentic-awesome-skills

    Route a goal through acc's scored-memory loop via accact(runtime="solve"); deliberate any returned brainframe and submit via continue.

    47k GitHub starsUsed in 1 repo~520 tokens
    Auto-check passed
  • Dynamic Workflow

    NousResearch/hermes-agent

    Plan-in-code fan-outs, adversarial verification, waves. An agent skill from NousResearch/hermes-agent.

    252k GitHub stars~2.8k tokensUpdated yesterday
    Auto-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 Finite Horizon Lqr

What does Finite Horizon Lqr do?

Solving finite-horizon LQR via dynamic programming for MPC. An agent skill from benchflow-ai/skillsbench. Finite Horizon Lqr is an agent skill from benchflow-ai/skillsbench. Solving finite-horizon LQR via dynamic programming for MPC.

How do I install Finite Horizon Lqr in Claude Code?

Run `npx skills add benchflow-ai/skillsbench --skill finite-horizon-lqr -a claude-code`. Or copy the skill folder (tasks/r2r-mpc-control/environment/skills/finite-horizon-lqr in benchflow-ai/skillsbench) into .claude/skills/finite-horizon-lqr in your project. Claude Code loads it when a task matches its description.

How do I install Finite Horizon Lqr in Codex?

Run `npx skills add benchflow-ai/skillsbench --skill finite-horizon-lqr -a codex`. Or copy the skill folder (tasks/r2r-mpc-control/environment/skills/finite-horizon-lqr in benchflow-ai/skillsbench) into .agents/skills/finite-horizon-lqr in your project. Codex loads it when a task matches its description.

Can I use Finite Horizon Lqr 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 finite-horizon-lqr -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/finite-horizon-lqr, .gemini/skills/finite-horizon-lqr, .github/skills/finite-horizon-lqr and .opencode/skills/finite-horizon-lqr in your project.

What does Finite Horizon Lqr need to run?

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

Does Finite Horizon Lqr 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 Finite Horizon Lqr 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 Finite Horizon Lqr use?

Finite Horizon Lqr 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 Finite Horizon Lqr use?

About 270 tokens (SKILL.md is roughly 1.1k 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 Finite Horizon Lqr?

Skills that share tags, products or a category with Finite Horizon Lqr: Dynamic Workflow Mode (affaan-m/ECC, 277k stars), Horizon Track (ruvnet/ruflo, 74k stars), Configuring Horizon (coollabsio/coolify, 63k stars) and Molecular Dynamics (K-Dense-AI/scientific-agent-skills, 48k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Finite Horizon Lqr?

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.