Claude-Tools-for-Delphi: Skill for Claude Code

.claude/skills/light-ref-Threading/SKILL.md

light-ref-Threading is a skill for Claude Code from GabrielOnDelphi/Claude-Tools-for-Delphi. It costs 120 tokens per session (2,633 once invoked), scanned A, original, MPL-2.0.

A reference for writing and reviewing Delphi programs that run work in the background while a desktop app remains responsive. Delphi is a programming language, and the main thread is the part that controls the user interface.

In plain words
What is it for?
Use it when working with Delphi threads or parallel tasks in VCL or FMX applications, including Android and iOS apps.
Why use it?
It helps prevent background code from directly changing screens, causing crashes or corrupted state, and covers safe coordination and cancellation patterns.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is GabrielOnDelphi/Claude-Tools-for-Delphi's own configuration. It tells Claude Code how to work on Claude-Tools-for-Delphi itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything Claude-Tools-for-Delphi configures →

Reuse

Borrowing it

Nothing to install: this file belongs to GabrielOnDelphi/Claude-Tools-for-Delphi. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/GabrielOnDelphi/Claude-Tools-for-Delphi/main/.claude/skills/light-ref-Threading/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/GabrielOnDelphi/Claude-Tools-for-Delphi

Made for: Claude Code.

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 light-ref-Threading

README.md
[![agentmods](https://agentmods.dev/badge/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-threading.svg)](https://agentmods.dev/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-threading)
Your own site
<a href="https://agentmods.dev/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-threading"><img src="https://agentmods.dev/badge/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-threading.svg" alt="Measured on agentmods" height="20"></a>
Per session 120 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,633 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.00120 $0.02633
Opus 5 $0.00060 $0.01316
Sonnet 5 $0.00024 $0.00527
Haiku 4.5 $0.00012 $0.00263

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

Security

Grade A, and why

light-ref-Threading 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 2d 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.

.claude/skills/light-ref-Threading/SKILL.md · 178 lines

How it starts

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

Delphi threading — reference

Load before writing or reviewing any code that runs off the main thread. Threading is RTL/PPL territory — LightSaber has no multithreading helpers, so do not go looking for one.

Units: TThread — System.Classes · TTask/TParallel/IFuture<T> — System.Threading · TCriticalSection/TEvent/TInterlocked/TLightweightMREW — System.SyncObjs · TThreadList<T>/TThreadedQueue<T> — System.Generics.Collections · TMonitor — System (no uses entry needed).

The one rule that is never optional

A worker thread must never touch a visual control or the UI directly. This holds on VCL and on FMX (Android/iOS included). Marshal every UI update back to the main thread with TThread.Synchronize (blocking) or TThread.Queue (non-blocking).

// WRONG - crash or corruption
TThread.CreateAnonymousThread(procedure begin lblStatus.Text := 'Working'; end).Start;

// RIGHT
TThread.CreateAnonymousThread(
  procedure
  begin
    TThread.Queue(nil, procedure begin lblStatus.Text := 'Working'; end);
  end).Start;

Lifetime — VCL & FMX: a queued/synchronized closure runs later on the main thread; if the form or control it touches was freed meanwhile, you get a dangling access. This is not mobile-only — a VCL form closed while a worker still runs hits it too. It just fires far more often on mobile, where the OS backgrounds the app and tears down views on its own. Assigned does not save you: a freed object is still non-nil, so Assigned(Form) returns True and you crash anyway. Fixes, in order:

  1. Stop the worker before its target is freed. In the form's OnClose/destructor just Free the thread: TThread.Destroy itself calls Terminate, waits for Execute to finish, then purges the thread's pending queued closures via RemoveQueuedEvents(Self) (System.Classes.pas, ShutdownThread). Calling WaitFor/Free from the main thread cannot deadlock on a worker sitting in Synchronize — main-thread WaitFor pumps the synchronize queue while it waits (TThread.WaitFor, both Windows and POSIX branches). Requires FreeOnTerminate = False (see pitfall below).
  2. Queue against the thread instance, not nil, when the target's lifetime is uncertain. Inside a TThread subclass simply call the instance Queue(...) — it forwards to Queue(Self, ...). Destroying that thread then purges its pending closures; TThread.Queue(nil, ...) has no such safety net. nil is fine only when the closure touches nothing that can die before it runs.

Read the full file on GitHub · 178 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. 2d ago Changed · +2 lines 6d803324ef3d
  2. 6d ago First seen · 176 lines · 120 tokens per session scan A d5f0cadd8ae8

Subscribe to this mod's changes

light-ref-Threading is a skill published in the GitHub repository GabrielOnDelphi/Claude-Tools-for-Delphi (17 stars, last pushed today), licensed MPL-2.0. It adds 120 tokens to every session and 2,633 once invoked, about $0.0006 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

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens