horse-app-structure

horse-app-structure is a skill for Claude Code, Codex from HashLoad/horse. It costs 26 tokens per session (672 once invoked), scanned A, original, MIT.

A setup guide for Horse, a Delphi web framework, covering the application startup file, middleware, routes, server startup, and splitting routes into modules.

In plain words
What is it for?
Use it when creating a Horse application, registering middleware and routes, starting the server, or organizing controller modules.
Why use it?
It provides a standard structure for starting a Horse HTTP server and helps keep larger applications organized as they grow.

Skill for Claude CodeCodex

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

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,371 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.

agentmods
npx agentmods add skills/hashload/horse/horse-app-structure
Any agent
npx skills add HashLoad/horse --skill horse-app-structure
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-app-structure

README.md
[![agentmods](https://agentmods.dev/badge/skills/hashload/horse/horse-app-structure.svg)](https://agentmods.dev/skills/hashload/horse/horse-app-structure)
Your own site
<a href="https://agentmods.dev/skills/hashload/horse/horse-app-structure"><img src="https://agentmods.dev/badge/skills/hashload/horse/horse-app-structure.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 672 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.1 $0.00026 $0.00672
Opus 5 $0.00013 $0.00336
Sonnet 5 $0.00005 $0.00134
Haiku 4.5 $0.00003 $0.00067

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

Security

Grade A, and why

horse-app-structure 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 6d 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-app-structure/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.

Horse App Structure

Application Bootstrap (.dpr)

A standard Horse application is typically configured as a Delphi Console Application ({$APPTYPE CONSOLE}).

program MyHorseApp;

{$APPTYPE CONSOLE}

uses
  System.SysUtils,
  Horse,
  Horse.Jhonson,
  Horse.CORS;

begin
  // 1. Opt-in for the High-Performance Radix Tree Router (highly recommended)
  THorse.UseRadixRouter;

  // 2. Register Global Middlewares
  THorse
    .Use(CORS)
    .Use(Jhonson);

  // 3. Register Routes / Controllers
  THorse.Get('/ping',
    procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
    begin
      Res.Send('pong');
    end);

  // 4. Start Server with Listen Callback (prevents sequential execution blocking)
  THorse.Listen(9000,
    procedure
    begin
      Writeln('Server is running on port ' + THorse.Port.ToString);
    end);
end.

Modular Architecture

For production grade projects, keep the .dpr file clean by delegating route definitions to specialized Controller classes:

  1. Keep Controllers stateless: Do not store request-specific variables as fields in a controller class unless they are thread-safe.
  2. Uses Sequence: Ensure modules containing business services or repository layers are decoupled from the HTTP transport layer (Horse units).

Thread-Safe Data Access & Database Connections

Horse is inherently multithreaded (each request runs on a separate worker thread). Accessing a database inside a route handler requires strict thread safety to avoid memory corruption, race conditions, or application crashes (Access Violations):

  1. NEVER share connection components globally: Do not put a global TFDConnection or query component in your Controller or DataModule and share it across handlers.
  2. Local instantiation (Thread-local): Always create the connection and query components inside the route handler, and release them in a try...finally block (Delphi XE7+ compatible):
procedure GetCustomerHandler(Req: THorseRequest; Res: THorseResponse; Next: TProc);
var
  LConnection: TFDConnection;
  LQuery: TFDQuery;
 begin
  LConnection := TFDConnection.Create(nil);
  LQuery := TFDQuery.Create(nil);
  try
    // Configure connection locally (preferably utilizing FireDAC Connection Pooling)
    LConnection.ConnectionDefName := 'MyPooledConnectionDef';
    LConnection.Connected := True;
    
    LQuery.Connection := LConnection;
    LQuery.SQL.Text := 'SELECT * FROM CUSTOMERS WHERE ID = :ID';
    LQuery.ParamByName('ID').AsInteger := Req.Params.Field('id').AsInteger;
    LQuery.Open;
    
    Res.Send(LQuery.ToJSONArray);
  finally
    LQuery.Free;
    LConnection.Free;
  end;
end;

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. 6d ago First seen · 88 lines · 26 tokens per session scan A cb9bc9da04a1

Subscribe to this mod's changes

horse-app-structure is a skill published in the GitHub repository HashLoad/horse (1,371 stars, last pushed yesterday), licensed MIT. It adds 26 tokens to every session and 672 once invoked, about $0.0001 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.