/delphi-project:delphi-projectfrom delphi-project
Handles all Delphi project tasks: creating projects, editing .pas/.dpr/.dpk/.dfm/.fmx files, configuring DPROJ build output, managing search paths, encoding, naming conventions, DUnitX tests, and package/BPL creation.
Ships in delphi-project. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
You are working on a Delphi project. Apply the rules and procedures in this skill to all Delphi work. No exceptions. Read the relevant reference documents when you need details.
These rules are absolute. Never generate code or files that violate them.
UTF-8 BOM: Every .pas, .dpr, .dpk file must start with the UTF-8 BOM bytes EF BB BF.
Always write these files with encoding='utf-8-sig' or equivalent. A file without BOM will cause
the Delphi IDE to misread non-ASCII characters.
CRLF line endings: Every Delphi source file (.pas, .dpr, .dpk, .dfm, .fmx, .dproj)
must use CRLF (\r\n) line endings. LF-only files cause silent failures in the Delphi IDE.
Output paths: All DPROJ output paths must use $(Platform)\$(Config) for executables and
$(Platform)\$(Config)\dcu for DCU files. Never use hard-coded paths like bin\ or output\.
No absolute paths in DPROJ: Search paths in the shared DPROJ file must be relative. Machine-
specific absolute paths belong in .dproj.user only (which is in .gitignore).
When a user asks to create a new Delphi project, follow this procedure completely.
Before creating files, determine (ask if not clear):
console, vcl, fmx, package, dunitx, librarysimple (single src/ folder) or multi-layer (Core/Data/VCL/FMX subfolders)ProjectVersion 20.4) unless specifiedgit config user.nameUse for standalone apps or simple utilities:
ProjectName/
├── src/
├── tests/ (if DUnitX requested)
├── libs/ (git submodules: DUnitX, etc.)
├── build/
│ └── DelphiBuildDPROJ.ps1
├── docs/
│ └── Delphi Style Guide EN.md
├── res/
├── .gitignore
├── .gitattributes
├── CLAUDE.md
├── delphi.md
├── ProjectName.dpr
├── ProjectName.dproj
└── ProjectName.groupproj (if multiple projects)
Use for applications with architectural separation:
ProjectName/
├── src/
│ ├── Core/ (business logic, domain, interfaces)
│ ├── Data/ (data access, repositories)
│ ├── VCL/ (VCL forms, frames)
│ └── FMX/ (FMX forms, if cross-platform)
├── tests/
├── libs/
│ └── DUnitX/
├── build/
│ └── DelphiBuildDPROJ.ps1
├── docs/
│ └── Delphi Style Guide EN.md
├── res/
├── demo/ (for library projects)
├── .gitignore
├── .gitattributes
├── CLAUDE.md
├── delphi.md
├── ProjectName.dpr
├── ProjectName.dproj
└── ProjectName.groupproj
.gitignore — Copy the curated template Delphi GitIgnore.txt from the DelphiStandards repo root
(../../../../Delphi GitIgnore.txt relative to this skill when the repo is cloned, otherwise
https://raw.githubusercontent.com/omonien/DelphiStandards/master/Delphi%20GitIgnore.txt) and rename it to .gitignore.
.gitattributes — Same for Delphi GitAttributes.txt → .gitattributes (CRLF enforcement, binary markers;
https://raw.githubusercontent.com/omonien/DelphiStandards/master/Delphi%20GitAttributes.txt). Then run git add --renormalize ..
CLAUDE.md — Minimal file that references delphi.md:
# Project Instructions
Read @delphi.md for Delphi-specific coding standards.
## Project Overview
<!-- Describe what this project does -->
## Build
Run `.\build\DelphiBuildDPROJ.ps1 -ProjectFile ProjectName.dproj` to build.
## Test
Open `tests\TestProjectName.dproj` in Delphi IDE and run, or use the build script.
delphi.md — Full Delphi rules for this project. Use the template in
references/delphi-md-template.md, filling in project-specific values.
.dpr file — See project type templates in references/project-templates.md.
.dproj file — See DPROJ templates in references/project-templates.md. Always:
python -c "import uuid; print('{'+str(uuid.uuid4()).upper()+'}')" or
equivalentProjectVersion to match the target Delphi versionbuild/DelphiBuildDPROJ.ps1 — Fetch from https://raw.githubusercontent.com/omonien/DelphiStandards/master/DelphiBuildDPROJ.ps1
if internet is available; otherwise copy the version from the skill's assets if present.
When tests are requested:
git submodule add https://github.com/VSoftTechnologies/DUnitX.git libs/DUnitXtests/TestProjectName.dpr — console runnertests/TestProjectName.dproj with search path ../libs/DUnitX/Sourcetests/TestProjectNameTests.pas — sample test unit demonstrating [Test], [Setup], [TearDown]After creating all source files, run:
python scripts/encoding_check.py <project_dir>/src
Fix any issues found.
Use the templates in references/project-templates.md as starting points. Key requirements:
| Property | Rule |
|---|---|
ProjectGuid | Fresh GUID, {UPPERCASE-WITH-HYPHENS} format |
ProjectVersion | Match target Delphi: 11→19.5, 12→20.2, 13.0→20.3, 13.1→20.4, 13.2→20.5 |
FrameworkType | VCL, FMX, or None |
AppType | Application, Console, Package, Library |
TargetedPlatforms | Bitmask: Win32=1, Win64=2, Linux64=128, Android=16, Android64=32768 (full table in references/dproj-format.md) |
DCC_DcuOutput | .\$(Platform)\$(Config)\dcu |
DCC_ExeOutput | .\$(Platform)\$(Config) |
DCC_BplOutput | .\$(Platform)\$(Config) (for packages) |
DCC_DcpOutput | .\$(Platform)\$(Config)\dcu (for packages) |
Config | Default: Debug with Condition="'$(Config)'==''" |
Platform | Default: Win32 with Condition="'$(Platform)'==''" |
DCC_Namespace values by framework:
System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.ShellSystem;Xml;Data;Datasnap;Web;Soap;FMX;FMX.Surfaces;FMX.ImportSystem;Xml;Data;Datasnap;Web;SoapWhen adding or removing source files, read the DPROJ first, then make targeted edits.
Add a plain unit:
<DCCReference Include="UnitName.pas"/>
Add a unit with VCL form:
<DCCReference Include="UnitName.pas">
<Form>TFormName</Form>
<FormType>dfm</FormType>
</DCCReference>
Add a data module:
<DCCReference Include="DMName.pas">
<Form>TDMName</Form>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
Add to search path: Find DCC_UnitSearchPath in the base PropertyGroup (no condition or
'$(Base)'!='' condition), append with semicolon. Use relative paths only.
Update version info: Change VerInfo_MajorVer, VerInfo_MinorVer, VerInfo_Release,
VerInfo_Build AND update VerInfo_Keys to keep FileVersion and ProductVersion consistent.
Run normalization before every VCS commit and whenever the DPROJ has been saved by the IDE.
python scripts/dproj_normalize.py ProjectName.dproj --in-place
The normalizer:
TargetedPlatforms nor enabled in <Platforms>Idempotency check: Running the normalizer twice must produce no diff. If it does, file a bug.
python scripts/dproj_validate.py ProjectName.dproj
Fix all ERRORs before committing. Review WARNINGs.
Offer to install this hook when setting up a new project:
#!/bin/sh
# .git/hooks/pre-commit
for dproj in $(git diff --cached --name-only --diff-filter=ACM | grep '\.dproj$'); do
python scripts/dproj_normalize.py "$dproj" --in-place
git add "$dproj"
done
The authoritative rules are in the Delphi Style Guide at the repo root
(online: https://raw.githubusercontent.com/omonien/DelphiStandards/master/Delphi%20Style%20Guide%20EN.md). references/coding-standards.md is a digest for agents;
on any conflict the Style Guide wins. Summary of critical rules:
Every .pas file must start with the XML Doc header (after the UTF-8 BOM). Template in
assets/unit-header-template.txt.
/// <summary>
/// Brief one-line description of this unit.
/// </summary>
/// <remarks>
/// Additional details, design decisions, usage notes.
/// </remarks>
/// <author>{{AUTHOR}}</author>
/// <created>YYYY-MM-DD</created>
/// <modified>YYYY-MM-DD</modified>
/// <license>MIT</license>
unit My.Unit.Name;
| Element | Prefix | Example |
|---|---|---|
| Class | T | TCustomerRepository |
| Interface | I | ICustomerRepository |
| Exception | E | ECustomerNotFound |
| Method parameter | A | ACustomerName: string |
| Local variable | L | LCustomer: TCustomer |
| Class field | F | FCustomerList: TList<TCustomer> |
| Constant | c | cMaxRetries = 3 |
| String constant | sc | scErrorMessage = 'Error' |
| Enumeration type | T | TOrderStatus |
| Enum member | no prefix, {$SCOPEDENUMS ON} | TOrderStatus.New |
| Component | type prefix + name | ButtonLogin, EditUserName |
Unit names: dot-notation hierarchy, e.g. Customer.Repository.pas, Main.Form.pas.
begin/end on their own lines for if, for, while, trybegin on same line as declaration (or next line — be consistent within the file)const parameters for string/interface parameters that are not modifiedvar/out explicit for output parametersSpecial characters in string properties must use #decimal notation:
Caption = 'Stra'#223'e' // ß = #223
Caption = 'M'#252'nchen' // ü = #252
Never embed raw UTF-8 bytes in DFM/FMX files.
CLAUDE.md — Minimal, project-specific. Contains non-Delphi context (API keys references,
deployment notes, team conventions, architecture overview). Has Read @delphi.md at the top.delphi.md — All Delphi rules. Generated and maintained by this skill. Written as direct
instructions to an AI agent (imperative mood: "Always...", "Never...", "Use...").When the skill is updated or new rules apply, regenerate delphi.md from
references/delphi-md-template.md without touching CLAUDE.md.
Write in imperative mood, directly addressing the agent:
When starting work on a Delphi project, check for delphi-project.json in the project root.
If found, read it and apply its settings as overrides to the skill defaults.
# Check for config
ls delphi-project.json 2>/dev/null && echo "Config found" || echo "Using defaults"
If not found, use the DelphiStandards defaults (all rules from references/coding-standards.md).
Loading config in Python:
import json, os
config = {}
config_path = 'delphi-project.json'
if os.path.exists(config_path):
with open(config_path, encoding='utf-8') as f:
config = json.load(f)
# Access with fallbacks
local_prefix = config.get('naming', {}).get('localVarPrefix', 'L')
field_prefix = config.get('naming', {}).get('fieldPrefix', 'F')
param_prefix = config.get('naming', {}).get('paramPrefix', 'A')
indent_size = config.get('formatting', {}).get('indentSize', 2)
max_line = config.get('formatting', {}).get('maxLineLength', 120)
author = config.get('header', {}).get('author', '{{AUTHOR}}')
license_id = config.get('header', {}).get('license', 'MIT')
source_dir = config.get('paths', {}).get('sourceDir', 'src')
test_dir = config.get('paths', {}).get('testDir', 'tests')
The default config template is at assets/delphi-project.json. Copy it to the project root and
customize. The full schema:
{
"naming": {
"classPrefix": "T", "interfacePrefix": "I",
"exceptionPrefix": "E", "localVarPrefix": "L",
"fieldPrefix": "F", "paramPrefix": "A",
"globalPrefix": "G", "constantPrefix": "c",
"stringConstantPrefix": "sc", "resourceStringPrefix": "rs"
},
"formatting": {
"indentSize": 2,
"maxLineLength": 120,
"beginOnSameLine": true
},
"paths": {
"outputPath": "$(Platform)/$(Config)",
"dcuPath": "$(Platform)/$(Config)/dcu",
"sourceDir": "src", "testDir": "tests",
"libsDir": "libs", "buildDir": "build"
},
"header": {
"author": "Team Name",
"license": "MIT",
"format": "xmldoc"
},
"testing": {
"framework": "DUnitX",
"asSubmodule": true,
"submodulePath": "libs/DUnitX",
"submoduleUrl": "https://github.com/VSoftTechnologies/DUnitX.git"
},
"delphi": {
"defaultVersion": "13",
"defaultProjectVersion": "20.4",
"defaultPlatform": "Win32",
"targetedPlatforms": 3
}
}
Configurable: naming prefixes, indentation, line length, output paths, source/test directories, unit header author/license, test framework, DUnitX submodule settings, default Delphi version.
NOT configurable (Delphi requirements):
.pas/.dpr/.dpk — the IDE requires it$(Platform)\$(Config) path structure — required for multi-platform compilation to workWhen you encounter a delphi-project.json that sets outputPath to something other than a
$(Platform)/$(Config) pattern, warn the user — this will break multi-platform builds.
When generating delphi.md for a project that has delphi-project.json, substitute the
config values into the template from references/delphi-md-template.md. The generated file
reflects the actual project settings, not generic defaults.
All scripts are in the scripts/ directory relative to the skill root.
| Script | Purpose | Usage |
|---|---|---|
dproj_normalize.py | Normalize DPROJ for VCS | python dproj_normalize.py <file> [--in-place] [--backup] |
dproj_validate.py | Validate DPROJ structure | python dproj_validate.py <file> [--strict] |
encoding_check.py | Check/fix file encoding | python encoding_check.py <dir> [--fix] |
Always copy scripts to the target project's scripts/ or build/ folder so they can be invoked
from project-relative paths and used in git hooks.
| Document | Contents |
|---|---|
references/dproj-format.md | Complete DPROJ XML format, all properties, valid values |
references/dproj-normalization.md | Normalization rules, canonical ordering, dedup logic |
references/project-templates.md | DPROJ XML templates for all project types |
references/coding-standards.md | Agent digest of the Delphi Style Guide (the Style Guide wins on conflict) |
Delphi Style Guide EN.md / DE.md (repo root) | Authoritative style guide |
references/delphi-md-template.md | Template for generating project delphi.md files |
Delphi GitIgnore.txt (repo root) | Curated .gitignore template |
Delphi GitAttributes.txt (repo root) | .gitattributes template with CRLF enforcement |
assets/unit-header-template.txt | Unit header XML Doc template |
.gitignore, .gitattributes from assetsCLAUDE.md, delphi.md.dproj from VCL template (fresh GUID, correct version).dpr with Application.Initialize/CreateForm/RunMain.Form.pas + Main.Form.dfmencoding_check.py --fix on all generated sourcesdproj_validate.py on generated DPROJgit init + initial commitpython scripts/dproj_normalize.py ProjectName.dproj --in-place --backup
python scripts/dproj_validate.py ProjectName.dproj
.pas file with UTF-8 BOM, CRLF, unit header<DCCReference> to DPROJ ItemGroupuses entry to .dpr if neededpython scripts/encoding_check.py src/ --fix
assets/delphi-project.json (opens in a new tab)assets/unit-header-template.txt (opens in a new tab)references/coding-standards.md (opens in a new tab)references/delphi-md-template.md (opens in a new tab)references/dproj-format.md (opens in a new tab)references/dproj-normalization.md (opens in a new tab)references/project-templates.md (opens in a new tab)scripts/dproj_normalize.py (opens in a new tab)scripts/dproj_validate.py (opens in a new tab)scripts/encoding_check.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub omonien/delphistandards --plugin delphi-projectOther plugins' skills for the same job