Agent skill

Horse Database Pooling

by HashLoad in HashLoad/horse

Guide for setting up thread-safe database connection pooling (FireDAC / UniDAC) in multithreaded Horse applications.

MITAuto-check passedDatabases

Install Horse Database Pooling

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

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

GitHub CLI
$ gh skill install HashLoad/horse horse-database-pooling --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-database-pooling .claude/skills/horse-database-pooling && 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-database-pooling
GitHub stars
1.4k
Token cost
~1.4k tokens
SKILL.md length
223 words
Files
1
Skills in repo
23
Repo updated
First seen
Licence
MIT

At a glance

Guide for setting up thread-safe database connection pooling (FireDAC / UniDAC) in multithreaded Horse applications.

  • Works in 4 steps: The Multithreaded Database Rule → Setting Up FireDAC Connection Pooling → Setting Up UniDAC Connection Pooling → …
  • Tasks that involve Database administration
  • SKILL.md covers 1. The Multithreaded Database…, 2. Setting Up FireDAC…, 3. Setting Up UniDAC… and 4. Best Practices for Database…
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Horse Database Pooling is an agent skill from HashLoad/horse. Guide for setting up thread-safe database connection pooling (FireDAC / UniDAC) in multithreaded Horse applications.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering Database administration. The repository describes itself as: Fast, opinionated, minimalist web framework for Delphi. The licence is MIT.

When your agent uses it

  • Tasks that involve Database administration

Example prompts

  • “/horse-database-pooling”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. The Multithreaded Database Rule
  2. Setting Up FireDAC Connection Pooling
  3. Setting Up UniDAC Connection Pooling
  4. Best Practices for Database Handlers

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 Database Pooling loads about 1.4k tokens when it runs. Until then it costs about 35 tokens; SKILL.md has 223 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
~1.4k

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). 223 words, ~1,386 tokens.

Download SKILL.mdSave it as .claude/skills/horse-database-pooling/SKILL.md (or your agent's skills folder).
name
horse-database-pooling
description
Guide for setting up thread-safe database connection pooling (FireDAC / UniDAC) in multithreaded Horse applications.

Horse Database Pooling

1. The Multithreaded Database Rule

Horse handles each incoming HTTP request in a separate thread. Therefore, sharing a single database connection components (like a global TFDConnection or query component placed on a global DataModule/Controller) across requests will cause race conditions, data corruption, and Access Violations.

  • Rule: Every route handler thread must instantiate its own database connection (or request one from a thread-safe connection pool) and free it immediately after use.

2. Setting Up FireDAC Connection Pooling

FireDAC provides built-in, highly optimized connection pooling. To configure and use it:

Phase A: Defining the Connection Definition (Global Setup)

Configure the connection definition globally in your application bootstrap (program block or startup class) using TFDManager:

pascal
uses
  FireDAC.Stan.Intf, FireDAC.Phys.PG, FireDAC.Comp.Client;

procedure SetupConnectionPool;
var
  LParams: TStrings;
begin
  LParams := TStringList.Create;
  try
    LParams.Values['DriverID'] := 'PG'; // PostgreSQL example
    LParams.Values['Server'] := 'localhost';
    LParams.Values['Database'] := 'my_db';
    LParams.Values['User_Name'] := 'postgres';
    LParams.Values['Password'] := 'secret';
    LParams.Values['Pooled'] := 'True'; // CRITICAL: Enables pooling
    LParams.Values['POOL_MaximumItems'] := '50'; // Set maximum connections in pool
    
    // Register the definition with FDManager
    FDManager.AddConnectionDef('MyPooledPGDef', 'PG', LParams);
  finally
    LParams.Free;
  end;
end;
Phase B: Acquiring and Releasing Connections in Handlers

In your route handlers, instantiate the TFDConnection locally, referencing the pooled definition name. Always protect resources with try...finally:

pascal
procedure GetUsersHandler(Req: THorseRequest; Res: THorseResponse; Next: TProc);
var
  LConnection: TFDConnection;
  LQuery: TFDQuery;
begin
  LConnection := TFDConnection.Create(nil);
  LQuery := TFDQuery.Create(nil);
  try
    // Reference the pooled definition - this will instantly pull a connection from the pool
    LConnection.ConnectionDefName := 'MyPooledPGDef';
    LConnection.Connected := True;
    
    LQuery.Connection := LConnection;
    LQuery.SQL.Text := 'SELECT id, name FROM users';
    LQuery.Open;
    
    // Johnson middleware takes ownership of the JSON object/array
    Res.Send(LQuery.ToJSONArray);
  finally
    LQuery.Free;
    LConnection.Free; // Automatically releases connection back to the pool
  end;
end;

3. Setting Up UniDAC Connection Pooling

If using Devart UniDAC, enable pooling via the connection string parameter or using TUniConnection.SpecificOptions:

pascal
procedure GetUsersUniDACHandler(Req: THorseRequest; Res: THorseResponse; Next: TProc);
var
  LConnection: TUniConnection;
  LQuery: TUniQuery;
begin
  LConnection := TUniConnection.Create(nil);
  LQuery := TUniQuery.Create(nil);
  try
    LConnection.ProviderName := 'PostgreSQL';
    LConnection.Server := 'localhost';
    LConnection.Database := 'my_db';
    LConnection.Username := 'postgres';
    LConnection.Password := 'secret';
    
    // Enable Pooling in UniDAC
    LConnection.Pooling := True;
    LConnection.PoolingOptions.MaxPoolSize := 50;
    
    LConnection.Connect;
    
    LQuery.Connection := LConnection;
    LQuery.SQL.Text := 'SELECT id, name FROM users';
    LQuery.Open;
    
    Res.Send(LQuery.ToJSONArray);
  finally
    LQuery.Free;
    LConnection.Free;
  end;
end;

---

## 3.5. Automated Connection Management via Request Services (IoC)
With Horse's native Request Scope IoC container, you can register a lazy factory for database connections. This ensures the connection is only opened if/when a route resolves it, and guarantees it is freed automatically when the request ends.

```pascal
// Setup connection factory inside a global middleware
THorse.Use(procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
  begin
    Req.Services.AddFactory(TFDConnection,
      function: TObject
      begin
        Result := TFDConnection.Create(nil);
        TFDConnection(Result).ConnectionDefName := 'MyPooledPGDef';
        TFDConnection(Result).Connected := True;
      end);
    Next();
  end);

// Usage in Route Handler (No manual connection free required!)
THorse.Get('/users', procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
  var
    LConnection: TFDConnection;
    LQuery: TFDQuery;
  begin
    LConnection := TFDConnection(Req.Services.Resolve(TFDConnection));
    LQuery := TFDQuery.Create(nil);
    try
      LQuery.Connection := LConnection;
      LQuery.SQL.Text := 'SELECT id, name FROM users';
      LQuery.Open;
      Res.Send(LQuery.ToJSONArray);
    finally
      LQuery.Free;
    end; // LConnection is freed automatically by Horse when the request finishes!
  end);

4. Best Practices for Database Handlers

  1. Keep Queries Short: Hold database connections open for the absolute shortest time possible. Perform non-database calculations before opening or after closing the connection.
  2. Always use try...finally: Ensure connection/query components are freed even if an exception occurs during SQL execution.
  3. Read-Only Operations: Set ReadOnly := True on your queries where possible to improve pooling performance.

© 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-database-pooling of HashLoad/horse.

Open the folder on GitHubat commit d4351a5

Compare with similar skills

Horse Database Pooling 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 Database Pooling compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Horse Database Pooling this skillHashLoad/horse1.4k—~1.4kAutomated safety check: PassMIT
Hybrid Cloud Outboxesgetsentry/sentry45k—~4.8kAutomated safety check: PassCustom licence
Replicate Video AdJingyi-Wu-Richael/replicate-video-ad1061 repos~1.6kAutomated safety check: PassNone
Sea Orm 2FlyinPancake/yoink112—~2.9kAutomated safety check: PassApache-2.0
Pixel Perfect ReplicationYu-369/VibeCurb980—~8.7kAutomated safety check: PassMIT
Redis Clusteringredis/agent-skills1651 repos~1kAutomated safety check: PassMIT

Similar skills

  • Hybrid Cloud Outboxes

    getsentry/sentry

    Official

    Guide for creating and maintaining outbox-based eventually consistent operations in Sentry.

    45k GitHub stars~4.8k tokensUpdated today
    DatabasesAuto-check passed
  • Replicate Video Ad

    Jingyi-Wu-Richael/replicate-video-ad

    Analyze a reference video frame by frame and turn its visual grammar, story beats, dialogue, product reveal, proof sequence, and conversion structure into a production-ready ecommerce story-ad…

    106 GitHub starsUsed in 1 repo~1.6k tokens
    DatabasesAuto-check passed
  • Sea Orm 2

    FlyinPancake/yoink

    Expert guidance for SeaORM 2.0, Rust's async ORM with strongly-typed columns, nested ActiveModels, Entity Loader API, and entity-first workflow.

    112 GitHub stars~2.9k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Image-to-code replication pipeline. An agent skill from Yu-369/VibeCurb.

    980 GitHub stars~8.7k tokensUpdated 2 mo ago
    DatabasesAuto-check passed
  • Redis Clustering

    redis/agent-skills

    Official

    Redis Cluster and replication guidance covering hash tags for multi-key operations, avoiding CROSSSLOT errors, and reading from replicas to scale read-heavy workloads.

    165 GitHub starsUsed in 1 repo~1k tokens
    DatabasesAuto-check passed
  • DB Admin

    EliasOulkadi/shokunin

    PostgreSQL database administration — backup/restore (pgdump, PITR, WAL archiving), health monitoring (connections, bloat, cache hit ratio, dead tuples), connection pooling (PgBouncer), replication…

    114 GitHub stars~2k tokensUpdated 2 days ago
    DatabasesAuto-check: notes

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 today
    Auto-check passed
  • Guide for managing request-scoped contextual services and IoC (dependency injection) in Delphi and Lazarus.

    1.4k GitHub stars~985 tokensUpdated today
    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 today
    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 today
    Auto-check passed
  • Guide for writing automated integration tests for Horse endpoints using DUnit/DUnitX and THTTPClient.

    1.4k GitHub stars~964 tokensUpdated today
    Auto-check passed
  • Guide for ensuring Lazarus and Free Pascal (FPC) compatibility, addressing anonymous methods differences, JSON units, and compiler directives.

    1.4k GitHub stars~806 tokensUpdated today
    Auto-check passed

Categories

Questions about Horse Database Pooling

What does Horse Database Pooling do?

Guide for setting up thread-safe database connection pooling (FireDAC / UniDAC) in multithreaded Horse applications. Horse Database Pooling is an agent skill from HashLoad/horse. Guide for setting up thread-safe database connection pooling (FireDAC / UniDAC) in multithreaded Horse applications.

When should I use Horse Database Pooling?

Horse Database Pooling fits situations like: tasks that involve Database administration.

How do I install Horse Database Pooling in Claude Code?

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

How do I install Horse Database Pooling in Codex?

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

Can I use Horse Database Pooling 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-database-pooling -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-database-pooling, .gemini/skills/horse-database-pooling, .github/skills/horse-database-pooling and .opencode/skills/horse-database-pooling in your project.

What does Horse Database Pooling need to run?

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

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

Horse Database Pooling 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 Database Pooling use?

About 1.4k tokens (SKILL.md is roughly 5.5k 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 Database Pooling?

Skills that share tags, products or a category with Horse Database Pooling: Hybrid Cloud Outboxes (getsentry/sentry, 45k stars), Replicate Video Ad (Jingyi-Wu-Richael/replicate-video-ad, 106 stars), Sea Orm 2 (FlyinPancake/yoink, 112 stars) and Pixel Perfect Replication (Yu-369/VibeCurb, 980 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Horse Database Pooling?

HashLoad (a GitHub organization) maintains it in HashLoad/horse, which has 1,377 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.