pid-controller

pid-controller is a skill for Claude Code, Codex from benchflow-ai/skillsbench. It costs 39 tokens per session (640 once invoked), scanned A, original, Apache-2.0.

A guide for implementing a PID controller, a feedback system that adjusts an output using the current error, accumulated past error, and recent changes in error.

In plain words
What is it for?
Use it for adaptive cruise control, vehicle speed regulation, throttle or brake commands, and other feedback loops that need proportional, integral, and derivative control.
Why use it?
It turns the difference between a target and a measured value into a correction, while supporting output limits and controller reset. This helps regulate systems without writing the control logic from scratch.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/benchflow-ai/skillsbench/pid-controller
Any agent
npx skills add benchflow-ai/skillsbench --skill pid-controller
Clone the repo
git clone --depth 1 https://github.com/benchflow-ai/skillsbench

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for pid-controller

README.md
[![agentmods](https://agentmods.dev/badge/skills/benchflow-ai/skillsbench/pid-controller.svg)](https://agentmods.dev/skills/benchflow-ai/skillsbench/pid-controller)
Your own site
<a href="https://agentmods.dev/skills/benchflow-ai/skillsbench/pid-controller"><img src="https://agentmods.dev/badge/skills/benchflow-ai/skillsbench/pid-controller.svg" alt="Measured on agentmods" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 640 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00039 $0.00640
Opus 5 $0.00019 $0.00320
Sonnet 5 $0.00008 $0.00128
Haiku 4.5 $0.00004 $0.00064

Measured 4d ago against content hash d274422849bf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pid-controller scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

tasks/adaptive-cruise-control/environment/skills/pid-controller/SKILL.md · 88 lines

How it starts

The opening of the file, as written. The whole thing — 88 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PID Controller Implementation

Overview

A PID (Proportional-Integral-Derivative) controller is a feedback control mechanism used in industrial control systems. It continuously calculates an error value and applies a correction based on proportional, integral, and derivative terms.

Control Law

output = Kp * error + Ki * integral(error) + Kd * derivative(error)

Where:

  • error = setpoint - measured_value
  • Kp = proportional gain (reacts to current error)
  • Ki = integral gain (reacts to accumulated error)
  • Kd = derivative gain (reacts to rate of change)

Discrete-Time Implementation

class PIDController:
    def __init__(self, kp, ki, kd, output_min=None, output_max=None):
        self.kp = kp
        self.ki = ki
        self.kd = kd
        self.output_min = output_min
        self.output_max = output_max
        self.integral = 0.0
        self.prev_error = 0.0

    def reset(self):
        """Clear controller state."""
        self.integral = 0.0
        self.prev_error = 0.0

    def compute(self, error, dt):
        """Compute control output given error and timestep."""
        # Proportional term
        p_term = self.kp * error

        # Integral term
        self.integral += error * dt
        i_term = self.ki * self.integral

        # Derivative term
        derivative = (error - self.prev_error) / dt if dt > 0 else 0.0
        d_term = self.kd * derivative
        self.prev_error = error

        # Total output
        output = p_term + i_term + d_term

        # Output clamping (optional)
        if self.output_min is not None:
            output = max(output, self.output_min)
        if self.output_max is not None:
            output = min(output, self.output_max)

        return output

Anti-Windup

Integral windup occurs when output saturates but integral keeps accumulating. Solutions:

  1. Clamping: Limit integral term magnitude
  2. Conditional Integration: Only integrate when not saturated
  3. Back-calculation: Reduce integral when output is clamped

Read the full file on GitHub · 88 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 88 lines · 39 tokens per session scan A d274422849bf

Subscribe to this mod's changes

pid-controller is a skill published in the GitHub repository benchflow-ai/skillsbench (1,745 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 39 tokens to every session and 640 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

hotpath_init

Configure hotpath profiling in a Rust project. Adds the hotpath dependency with feature-gated setup, instruments main with hotpath::main, functions with measure/measureall, and wraps channels, mutexes, rwlocks, streams, futures, reqwest clients, axum routers and byte-level I/O with hotpath macros. Use when the user…

pawurb/hotpath-rs · 88 tokens

writing-bench-task-judge

Use when writing or modifying checkgoals() / getanswer() / App check methods in benchenv/task/, or when reviewing a draft task's judge correctness. Triggers include adding a new task, editing a judge method, or diagnosing a judge false-positive/negative.

Purewhiter/mobilegym · 68 tokens

portfolio

Cross-chain DeFi portfolio discovery, rebalancing suggestions, and NEAR Intent construction. Activates when the user pastes a wallet address or asks about yield/positions/rebalancing. Bootstraps a per-user "portfolio" project, aggregates positions across all the user's addresses inside one project, and offers a…

suyoumo/ClawProBench · 69 tokens

llm-council

Query multiple LLM models in parallel from CodeAct and cross-reference their responses.

suyoumo/ClawProBench · 21 tokens

environment-discovery

Systematic exploration of unknown environments before starting work.

vstorm-co/pydantic-deepagents · 13 tokens

benchflow-traj-upload

Find a local Claude Code or Codex session, open the BenchFlow trajectory viewer, and submit it after the user reviews it. Use this skill whenever someone pastes a BenchFlow eval prize line, wants to submit / share / contribute / upload a trajectory, set up traj upload, view a session, or pick a session to send. Also…

benchflow-ai/benchflow · 98 tokens