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

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

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

A reference guide to refactoring Delphi code, where refactoring means changing the code’s structure without changing what it does. It covers techniques such as splitting methods or classes, simplifying conditions, renaming, and adding test seams.

In plain words
What is it for?
Use it when reorganizing Delphi code, removing duplication, simplifying complex classes or conditions, introducing test seams, or choosing a suitable refactoring technique.
Why use it?
It provides a safe sequence for making structural changes: establish passing tests, make one small change, compile, and test again. This helps detect accidental behavior changes during cleanup.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

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-Refactoring/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-Refactoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-refactoring.svg)](https://agentmods.dev/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-refactoring)
Your own site
<a href="https://agentmods.dev/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-refactoring"><img src="https://agentmods.dev/badge/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-refactoring.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,030 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00000 $0.01030
Opus 5 $0.00000 $0.00515
Sonnet 5 $0.00000 $0.00206
Haiku 4.5 $0.00000 $0.00103

Measured 4d ago against content hash 0fa867e7d64c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

light-ref-Refactoring 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 4d 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-Refactoring/SKILL.md · 75 lines

How it starts

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

Delphi refactoring — reference

Refactoring changes structure, not behaviour. The only proof of that is a test that is green before and stays green after. If the code under change has no test, write one first (/light-review-RedGreen) — otherwise you are rewriting, not refactoring.

Safe process

  1. Green baseline — the relevant DUnitX tests pass now.
  2. One small step at a time — never batch unrelated moves.
  3. Compile only via the light-compiler agent (global CLAUDE.md rule), then re-run the test EXE.
  4. Reuse before you write: a LightCore.* / LightVcl.* / LightFmx.* unit may already do it.

Catalog

Extract Method — long method / duplicated block

Pull a named block into its own method. Target ≤ ~20 lines, one level of abstraction. Name it after what it does, not how.

Extract Class — a class doing several jobs

When a class holds two unrelated clusters of fields+methods, split the second cluster into its own class and hold it by composition. This is the usual fix for a god class (see /light-code-ArchitectureClass).

Replace Nested Conditionals with Guard Clauses

Invert edge cases into early Exit/raise at the top so the happy path runs unindented.

procedure Process(AOrder: TOrder);
begin
  if not Assigned(AOrder) then raise EArgumentNil.Create('AOrder');
  if AOrder.Items.Count = 0 then raise EBusinessRule.Create('empty order');
  // happy path, no nesting
end;

Replace Magic Number/String with Named Constant

const MINIMUM_AGE = 18; — the name documents intent and kills duplication.

Replace Conditional with Polymorphism

A case/if ladder that switches on a type or state and recurs in several places → move each branch into a virtual method on a small class family (Strategy/State). See /light-ref-DesignPatterns.

Introduce Parameter Object

Three-plus parameters that always travel together → gather them into a record (value type, no lifetime to manage) and pass that.

Remove with

Replace every with X do ... with an explicit X. prefix (or a short local alias). with hides which scope a name binds to and defeats the IDE.

Read the full file on GitHub · 75 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. 4d ago Changed · +2 lines 0fa867e7d64c
  2. 8d ago First seen · 73 lines · 0 tokens per session scan A ba5e352d3d01

Subscribe to this mod's changes

light-ref-Refactoring is a skill published in the GitHub repository GabrielOnDelphi/Claude-Tools-for-Delphi (17 stars, last pushed yesterday), licensed MPL-2.0. It costs nothing until one of its globs matches a file; then it loads 1,030 tokens. 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

debug-optimize-lcp

Guides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slow page loads, Core Web Vitals optimization, or wants to understand why their page's main content takes too long to appear. Also use when the user mentions…

ChromeDevTools/chrome-devtools-mcp · 99 tokens

systematic-debugging

Use when debugging a failing test, build error, or runtime issue that isn't immediately obvious. Guides a 4-phase root cause analysis instead of random fix attempts.

open-metadata/OpenMetadata · 37 tokens

diagnose

Trace from a reproduced symptom to the source code that causes it. Pin the specific file and approximate line, rate confidence in the cause and clarity of the fix independently, and always propose a concrete fix.

emdash-cms/emdash · 43 tokens

repro-admin

Reproduce an EmDash admin UI bug. Attach a container, start the demo dev server, drive the admin with agent-browser using the dev-bypass session, and capture the reproduction as screenshots plus a replayable transcript.

emdash-cms/emdash · 48 tokens

log-error-digest

Analyze log files to troubleshoot errors, identify peak error periods, and produce error clustering, frequency statistics, and time distribution reports. Supports JSON, syslog, and Nginx formats with automatic detection. Use when a user uploads a .log file and asks to analyze errors, find patterns, debug issues, or…

zebbern/claude-code-guide · 71 tokens

byted-util-volcengine-detect-retry

An orchestration workflow for Volcengine Cloud Detect, a service that checks websites or network endpoints from test locations.

bytedance/agentkit-samples · 101 tokens