horse-middlewares

horse-middlewares is a skill for Claude Code, Codex from HashLoad/horse. It costs 31 tokens per session (701 once invoked), scanned A, original, MIT.

A guide to configuring Horse web-server middleware, software that processes HTTP requests and responses around route handlers. It covers middleware such as cross-origin access, JSON handling, compression, authentication, and logging, including their registration order and scope.

In plain words
What is it for?
Use it when setting up or reviewing a Horse application's global, group-level, or route-level middleware pipeline.
Why use it?
It helps avoid incorrect request-processing order and clarifies whether middleware applies to every route, a route group, or one route.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when setting up or reviewing a Horse application's global, group-level, or route-level middleware pipeline.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hashload/horse/horse-middlewares
About the project

Horse is a lightweight web framework for Delphi and Lazarus programs, providing tools for building HTTP servers and APIs. It is for developers who need routing, request handling, middleware, streaming, WebSockets, and related server features in those languages. Its catalogue skills support working with the framework.

HashLoad/horse · 1,373 stars · on GitHub

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.

Any agent
npx skills add HashLoad/horse --skill horse-middlewares
Clone the repo
git clone --depth 1 https://github.com/HashLoad/horse

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 horse-middlewares

README.md
[![agentmods](https://agentmods.dev/badge/skills/hashload/horse/horse-middlewares/github.svg)](https://agentmods.dev/skills/hashload/horse/horse-middlewares)
Your own site
<a href="https://agentmods.dev/skills/hashload/horse/horse-middlewares"><img src="https://agentmods.dev/badge/skills/hashload/horse/horse-middlewares/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for horse-middlewares

Your own site · 80×15
<a href="https://agentmods.dev/skills/hashload/horse/horse-middlewares"><img src="https://agentmods.dev/badge/skills/hashload/horse/horse-middlewares.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 701 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00031 $0.00701
Opus 5 $0.00015 $0.00351
Sonnet 5 $0.00006 $0.00140
Haiku 4.5 $0.00003 $0.00070

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

Security

Grade A, and why

horse-middlewares 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 10d 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.

doc/skills/horse-middlewares/SKILL.md · 67 lines

How it starts

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

Horse Middlewares

Core Middleware Pipeline

Middlewares intercept and process HTTP requests/responses before reaching the endpoint handlers.

Required Registration Order

The registration order of middlewares in THorse is highly critical. Middlewares must be registered before defining any routes:

begin
  // 1. Logging and Error Handling (FIRST)
  THorse.Use(HandleException);
  
  // 2. Security and Headers
  THorse.Use(CORS);
  
  // 3. Payload Compression and Formatting
  THorse.Use(OctetStream);
  THorse.Use(Jhonson); // Parse JSON body and format JSON response
  
  // 4. Register Routes (AFTER all global middlewares)
  TProductController.RegisterRoutes;
  
  THorse.Listen(9000);
end;

Middleware Scope & Execution Flow

Middlewares can be declared at three levels:

  1. Global (via THorse.Use): Runs on every request.
  2. Group-level (via THorseGroup.Use): Runs on all routes inside a specific group prefix.
  3. Route-level (Local): Runs only on that specific route (defined as an array [Middleware1, Middleware2] in the verb method).

Execution Flow:

The execution order follows the nested onion pattern:

Global Middlewares → Group Middlewares → Route-level Middlewares → Final Route Handler

Always design middlewares to call Next() to pass control, or skip it to short-circuit the request (e.g., unauthorized requests).


The Johnson Middleware (Critical)

The Jhonson middleware automatically handles JSON parsing (TJSONObject / TJSONArray) for requests and responses.

  • Ownership Transfer: When you call Res.Send<TJSONObject>(LJson) or Res.Send<TJSONArray>(LArray), the Johnson middleware takes ownership of that object and will automatically destroy it after sending.
  • Safety Rule: NEVER call .Free or FreeAndNil on a JSON object after sending it through Res.Send<T>. Doing so will cause a Double-Free memory corruption (Access Violation) when the middleware attempts to clean it up.

Read the full file on GitHub · 67 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. 10d ago First seen · 67 lines · 31 tokens per session scan A 4b56b16de42e

Subscribe to this mod's changes

horse-middlewares is a skill published in the GitHub repository HashLoad/horse (1,373 stars, last pushed today), licensed MIT. It adds 31 tokens to every session and 701 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.