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

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

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

A Delphi reference for freeing objects safely and handling exceptions. Delphi generally does not automatically reclaim class instances, so code must release objects on normal and error paths.

In plain words
What is it for?
Use it when writing or reviewing Delphi code that creates objects, frees owned fields, returns objects from functions, or catches exceptions.
Why use it?
It helps prevent memory leaks and ensures errors are handled without hiding the original problem. It also explains ownership and safe cleanup 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-Memory/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-Memory

README.md
[![agentmods](https://agentmods.dev/badge/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-memory.svg)](https://agentmods.dev/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-memory)
Your own site
<a href="https://agentmods.dev/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-memory"><img src="https://agentmods.dev/badge/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-memory.svg" alt="Measured on agentmods" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 843 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.
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.00072 $0.00843
Opus 5 $0.00036 $0.00421
Sonnet 5 $0.00014 $0.00169
Haiku 4.5 $0.00007 $0.00084

Measured 2d ago against content hash 1eb10263ee69, 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-Memory 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-Memory/SKILL.md · 86 lines

How it starts

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

Delphi memory & exceptions — reference

Class instances are freed manually, on every target — desktop and mobile alike, no GC. Every ownerless Create must be freed on every path, the exception path included. The checklist at the end is the single source of truth: the light-review-step1 and light-review-step3 agents read this file and apply it, so keep the list here and nowhere else.

try immediately after Create

Anything between Create and try can raise and leak the instance.

LList := TStringList.Create;
try
  LList.Add('item');
finally
  LList.Free;
end;

Several locals: nest try..finally in reverse creation order, or nil them all up front and FreeAndNil each in one finally.

Functions that return an object — guard the newborn

If a later step raises before the caller receives the result, it leaks:

function BuildList: TStringList;
begin
  Result := TStringList.Create;
  try
    Fill(Result);        // may raise
  except
    Result.Free;         // free before propagating
    raise;
  end;
end;

Never pass an inline .Create as a parameter unless the callee definitely takes ownership.

FreeAndNil vs Free · Owner-managed

  • FreeAndNil(F) for a field that may be re-tested with Assigned or freed twice; plain Free for a local that dies at end of scope.
  • A component created with an OwnerTButton.Create(Self) — is freed by that Owner. Do not free it yourself.
  • Owned fields allocated in a constructor are freed in the destructor, inherited last.

Exceptions: specific, never swallowed

Catch the narrowest type you can act on. A bare except ... end hides EAccessViolation, EOutOfMemory and real bugs.

try
  Commit;
except
  on E: EFDDBEngineException do
  begin
    Log(E.Message);
    raise EDatabaseError.Create('Service temporarily unavailable');  // translate to a domain error
  end;
end;
  • Re-raise with a bare raise;raise E; resets the stack trace.
  • Prefer a small domain tree (EBusinessRule / EInfrastructure and their subclasses) over scattered raise Exception.Create('...'), so upper layers can catch by category.

Read the full file on GitHub · 86 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 1eb10263ee69
  2. 7d ago First seen · 84 lines · 72 tokens per session scan A 8eb640252721

Subscribe to this mod's changes

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

matlab

Build, review, migrate, and safely plan MATLAB or GNU Octave numerical workflows, including arrays, tabular/time data, tests, projects, graphics, MAT files, and explicit Python interoperability.

K-Dense-AI/scientific-agent-skills · 42 tokens

ast-grep

Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for…

JanDeDobbeleer/oh-my-posh · 80 tokens

platform-detection

Identify a .NET project's test platform, framework, command mode, and SDK-style vs classic project system. Use only for "which test platform/framework?", "VSTest or MTP?", or "what runner does this project use?", including bridge settings, UseVSTest opt-outs, and incompatible or conflicting VSTest/MTP configuration.…

dotnet/skills · 146 tokens

unity-version-split

Split a C# file into Unity 6.5+ and pre-Unity 6.5 variants. Use when a file needs different implementations for different Unity versions due to API changes (e.g., EntityId vs int, GetEntityId vs GetInstanceID).

IvanMurzak/Unity-MCP · 59 tokens

omh-rust

This is a Hermes-native rust workflow skill.

rlaope/oh-my-hermes · 69 tokens

migrate-better-result-3

Migrate a TypeScript codebase from better-result 2.x to 3.0. Use when upgrading better-result across the TaggedError syntax, removed Result serialization helpers, recovery inference, matching, or retry APIs.

dmmulroy/better-result · 52 tokens