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.
curl -O https://raw.githubusercontent.com/GabrielOnDelphi/Claude-Tools-for-Delphi/main/.claude/skills/light-ref-Refactoring/SKILL.mdgit clone --depth 1 https://github.com/GabrielOnDelphi/Claude-Tools-for-DelphiWrote 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.
[](https://agentmods.dev/skills/gabrielondelphi/claude-tools-for-delphi/light-ref-refactoring)<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>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once 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 |
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.
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
- Green baseline — the relevant DUnitX tests pass now.
- One small step at a time — never batch unrelated moves.
- Compile only via the
light-compileragent (global CLAUDE.md rule), then re-run the test EXE. - 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.
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.
- 4d ago Changed · +2 lines 0fa867e7d64c
- 8d ago First seen · 73 lines · 0 tokens per session scan A ba5e352d3d01
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.
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…
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.
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.
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.
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…
byted-util-volcengine-detect-retry
An orchestration workflow for Volcengine Cloud Detect, a service that checks websites or network endpoints from test locations.