Agent skill

Horse Middlewares

by HashLoad in HashLoad/horse

Guide to using standard Horse middlewares (CORS, Jhonson, compression, basic-auth, logger) and pipeline registration order.

MITAuto-check passed

Install Horse Middlewares

skills CLI
$ npx skills add HashLoad/horse --skill horse-middlewares -a claude-code

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

GitHub CLI
$ gh skill install HashLoad/horse horse-middlewares --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/HashLoad/horse.git skills-src && mkdir -p .claude/skills && cp -r skills-src/doc/skills/horse-middlewares .claude/skills/horse-middlewares && 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
horse-middlewares
GitHub stars
1.4k
Token cost
~775 tokens
SKILL.md length
294 words
Files
1
Skills in repo
23
Repo updated
First seen
Licence
MIT

At a glance

Guide to using standard Horse middlewares (CORS, Jhonson, compression, basic-auth, logger) and pipeline registration order.

  • Works in 3 steps: Global (via THorse.Use): Runs on every… → Group-level (via THorseGroup.Use): Runs… → Route-level (Local): Runs only on that…
  • SKILL.md covers Core Middleware Pipeline, Middleware Scope & Execution…, The Johnson Middleware… and Global Error Handler (OnError)
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Horse Middlewares is an agent skill from HashLoad/horse. Guide to using standard Horse middlewares (CORS, Jhonson, compression, basic-auth, logger) and pipeline registration order.

Its SKILL.md is about 780 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: Fast, opinionated, minimalist web framework for Delphi. The licence is MIT.

Example prompts

  • “/horse-middlewares”

Workflow steps

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

  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).

What it can do on your machine

Read from SKILL.md and the folder at commit d4351a5. 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 pascal).

    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

Horse Middlewares loads about 775 tokens when it runs. Until then it costs about 35 tokens; SKILL.md has 294 words of instructions outside code blocks.

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

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 HashLoad/horse at commit d4351a5, republished under its MIT licence (© HashLoad). 294 words, ~775 tokens.

Download SKILL.mdSave it as .claude/skills/horse-middlewares/SKILL.md (or your agent's skills folder).
name
horse-middlewares
description
Guide to using standard Horse middlewares (CORS, Jhonson, compression, basic-auth, logger) and pipeline registration order.

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:

pascal
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.

Global Error Handler (OnError)

Horse features a native global error handling callback (THorse.OnError). It intercepts all unhandled exceptions occurring inside any middleware or route handler.

Key Points:
  • Registration: Use THorse.OnError(MyGlobalErrorHandler) during application startup.
  • Control Exceptions: Control exceptions (EHorseCallbackInterrupted and EHorseException) are bypassed and do not trigger the global OnError callback.
  • Safety (Fail-Safe): If the registered OnError callback itself crashes, the framework handles the crash safely and returns a structured 500 Internal Server Error response with the exception detail, protecting the socket from leaking or crashing.
  • Signature: The callback is a classic procedure type THorseOnError = procedure(const ARequest: THorseRequest; const AResponse: THorseResponse; const AException: Exception).

© HashLoad, MIT. 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 doc/skills/horse-middlewares of HashLoad/horse.

Open the folder on GitHubat commit d4351a5

Compare with similar skills

Horse Middlewares 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.

Horse Middlewares compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Horse Middlewares this skillHashLoad/horse1.4k—~775Automated safety check: PassMIT
Compressionthedaviddias/Front-End-Checklist74k—~421Automated safety check: PassMIT
Telemetry Standardssupabase/supabase111k—~2kAutomated safety check: PassApache-2.0
Cpp Coding Standardsaffaan-m/ECC276k4 repos~5.6kAutomated safety check: PassMIT
Java Coding Standardsaffaan-m/ECC276k1 repos~2.9kAutomated safety check: PassMIT
Image Compressionthedaviddias/Front-End-Checklist74k—~405Automated safety check: PassMIT

Similar skills

  • Compression

    thedaviddias/Front-End-Checklist

    A skill your agent uses when auditing slow page loads, heavy assets, or rendering delays related to Enable text-based compression.

    74k GitHub stars~421 tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Telemetry Standards

    supabase/supabase

    Official

    PostHog event tracking standards for Supabase Studio. An agent skill from supabase/supabase.

    111k GitHub stars~2k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • C++ coding standards based on the C++ Core Guidelines (isocpp.github.io).

    276k GitHub starsUsed in 4 repos~5.6k tokens
    DevelopmentAuto-check passed
  • Java coding standards for Spring Boot and Quarkus services: naming, immutability, Optional usage, streams, exceptions, generics, CDI, reactive patterns, and project layout.

    276k GitHub starsUsed in 1 repo~2.9k tokens
    DevelopmentAuto-check passed
  • Image Compression

    thedaviddias/Front-End-Checklist

    A skill your agent uses when reviewing image assets, markup, and CDN or build transforms related to Compress images without quality loss.

    74k GitHub stars~405 tokensUpdated 4 days ago
    Media & CreativeAuto-check passed
  • Coding Standards

    affaan-m/ECC

    适用于TypeScript、JavaScript、React和Node.js开发的通用编码标准、最佳实践和模式. An agent skill from affaan-m/ECC.

    276k GitHub starsUsed in 3 repos~2.6k tokens
    DevelopmentAuto-check passed

More from HashLoad/horse

All 23 skills in this repo
  • Horse App Structure

    HashLoad/horse

    Guide for setting up Horse applications, bootstrap program (.dpr), basic console initialization, and registering modules.

    1.4k GitHub stars~716 tokensUpdated 3 days ago
    Auto-check passed
  • Guide for setting up thread-safe database connection pooling (FireDAC / UniDAC) in multithreaded Horse applications.

    1.4k GitHub stars~1.4k tokensUpdated 3 days ago
    Auto-check passed
  • Guide for managing request-scoped contextual services and IoC (dependency injection) in Delphi and Lazarus.

    1.4k GitHub stars~985 tokensUpdated 3 days ago
    Auto-check passed
  • Horse Files Streams

    HashLoad/horse

    Guide to handling file uploads (multipart), downloads, and stream lifetime management in the Horse framework.

    1.4k GitHub stars~601 tokensUpdated 3 days ago
    Auto-check passed
  • Horse Grpc

    HashLoad/horse

    Guidelines and workflows for developing and maintaining gRPC services, HTTP/2 h2c transport, and Protobuf serialization within the Horse framework.

    1.4k GitHub stars~776 tokensUpdated 3 days ago
    Auto-check passed
  • Guide for writing automated integration tests for Horse endpoints using DUnit/DUnitX and THTTPClient.

    1.4k GitHub stars~964 tokensUpdated 3 days ago
    Auto-check passed

Questions about Horse Middlewares

What does Horse Middlewares do?

Guide to using standard Horse middlewares (CORS, Jhonson, compression, basic-auth, logger) and pipeline registration order. Horse Middlewares is an agent skill from HashLoad/horse. Guide to using standard Horse middlewares (CORS, Jhonson, compression, basic-auth, logger) and pipeline registration order.

How do I install Horse Middlewares in Claude Code?

Run `npx skills add HashLoad/horse --skill horse-middlewares -a claude-code`. Or copy the skill folder (doc/skills/horse-middlewares in HashLoad/horse) into .claude/skills/horse-middlewares in your project. Claude Code loads it when a task matches its description.

How do I install Horse Middlewares in Codex?

Run `npx skills add HashLoad/horse --skill horse-middlewares -a codex`. Or copy the skill folder (doc/skills/horse-middlewares in HashLoad/horse) into .agents/skills/horse-middlewares in your project. Codex loads it when a task matches its description.

Can I use Horse Middlewares 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 HashLoad/horse --skill horse-middlewares -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/horse-middlewares, .gemini/skills/horse-middlewares, .github/skills/horse-middlewares and .opencode/skills/horse-middlewares in your project.

What does Horse Middlewares need to run?

SKILL.md names no scripts, command-line tools or credentials: Horse Middlewares is instructions for the agent only.

Does Horse Middlewares 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 Horse Middlewares 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 Horse Middlewares use?

Horse Middlewares is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Horse Middlewares use?

About 775 tokens (SKILL.md is roughly 3.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 Horse Middlewares?

Skills that share tags, products or a category with Horse Middlewares: Compression (thedaviddias/Front-End-Checklist, 74k stars), Telemetry Standards (supabase/supabase, 111k stars), Cpp Coding Standards (affaan-m/ECC, 276k stars) and Java Coding Standards (affaan-m/ECC, 276k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Horse Middlewares?

HashLoad (a GitHub organization) maintains it in HashLoad/horse, which has 1,378 GitHub stars. The repository holds 23 skills in this directory. The repository was last updated on October 7, 2026.

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