Contributions in German or English are welcome. Language synchronization is handled by the maintainer no later than post-merge.
This repository provides a compact, battle-tested baseline for consistent Delphi code. It focuses on:
- A clear, modern Delphi Style Guide (German and English)
- A curated .gitignore tailored for Delphi
- A Git Attributes template for EOL normalization and binary protection
- Agent skills that teach AI coding agents (Claude Code, Cursor, grok CLI, Codex) these standards
Both help teams write consistent code and avoid common friction.
Teams frequently commit files that should not be versioned (IDE artifacts, build outputs, local settings). This leads to:
- unnecessary diffs and merge conflicts
- unstable builds due to local artifacts
- unwanted side effects across the team
The curated, Delphi-specific .gitignore prevents exactly that. The Style Guide, in parallel, provides a shared understanding of structure, naming, and modern language features. Additionally, .gitattributes prevents false diffs due to line-ending mismatches (CRLF vs LF) and protects binary artifacts from accidental text filters/diff. See the contents section for details.
Beyond team settings, a consistent Style Guide also benefits solo developers over the long run. This guide follows proven, classic patterns seen in Delphi's RTL/VCL/FMX code, yet it is certainly opinionated. The most important thing is to agree on a style and apply it consistently across the codebase—consistency beats “perfect.”
- Curated GitIgnore template: Delphi GitIgnore.txt
- Git Attributes template: Delphi GitAttributes.txt
- Delphi Style Guide (DE): Delphi Style Guide DE.md
- Delphi Style Guide (EN): Delphi Style Guide EN.md
- Universal Build Script: DelphiBuildDPROJ.ps1 - PowerShell script for building Delphi projects via command line
- Release Tools: release-tools/ - Automated release creation
- Agent Skills: plugins/ - Skills for Claude Code, Cursor, grok CLI and Codex (see Agent Skills)
Note: The style guide is maintained in German and English. Please keep both documents in sync (maintainer will handle synchronization post-merge if needed).
- Agree on the style guide in your team
- Indentation: 2 spaces; line length: 120 chars (keep formatter/editor guideline in sync)
- Naming conventions (A-/L-/F‑prefixes, components, constants, enums with SCOPEDENUMS)
- Modern features: generics, anonymous methods, inline variables (10.3+), multiline strings (12+)
- Enable .gitignore
- Copy "Delphi GitIgnore.txt" to the repo root and rename it to ".gitignore"
- Add project-specific rules as needed
- Add Git Attributes
- Copy "Delphi GitAttributes.txt" to the repo root and rename it to ".gitattributes".
- It normalizes EOLs for Delphi sources (CRLF) and marks binary artifacts (.res, .ico, .dcu, .bpl, .dll, .exe) as binary.
- If your project stores .dfm/.fmx as text (default), keep the text rules. If stored as binary, switch to the binary rules in the template.
- For existing repos, after adding run:
git add --renormalize .and commit the changes.
The repository includes a universal PowerShell script for building Delphi projects from the command line. This is ideal for CI/CD pipelines, automated builds, or any scenario where you need to build Delphi projects without the IDE.
Features:
- Auto-detects the latest installed Delphi version from Windows Registry
- Supports all Delphi project files (.dproj)
- Configurable build configuration (Debug/Release) and platform (Win32/Win64/Linux64)
- Linux debug symbol and map file support via
-LinuxMap - Colored console output for better readability
- Verbose mode for detailed build information
- No dependencies on specific projects - works with any Delphi project
- Configurable defaults section for easy customization
- Robust error handling and clean exit codes for CI/CD integration
Usage:
# Basic usage (auto-detects Delphi version, builds Debug/Win32)
.\DelphiBuildDPROJ.ps1 -ProjectFile "MyProject.dproj"
# Build Release for Win64
.\DelphiBuildDPROJ.ps1 -ProjectFile "MyProject.dproj" -Config Release -Platform Win64
# Use specific Delphi version with verbose output
.\DelphiBuildDPROJ.ps1 -ProjectFile "MyProject.dproj" -DelphiVersion "22.0" -VerboseOutput
# Build for Linux64 with full debug symbols and map file
.\DelphiBuildDPROJ.ps1 -ProjectFile "MyProject.dproj" -Platform Linux64 -LinuxMapParameters:
-ProjectFile(required): Path to the .dproj file to build-Config: Build configuration (default: "Debug")-Platform: Target platform (default: "Win32")-DelphiVersion: Delphi version to use (default: auto-detect latest)-VerboseOutput: Enable verbose MSBuild output-LinuxMap: Enable Linux debug symbols and map file generation (setsDCC_MapFile=3,DCC_DebugInfo=3,DCC_LocalSymbols,DCC_LocalDebugSymbols,DCC_DebugInformation=2,DCC_DebugInfoInExe=false)
Requirements:
- Embarcadero Delphi installed
- MSBuild available (Visual Studio Build Tools or full Visual Studio)
For more details, see the script documentation in DelphiBuildDPROJ.ps1.
For developers working in WSL (Windows Subsystem for Linux), the repository includes a Bash wrapper DelphiBuildDPROJ.sh that bridges WSL to the Windows Delphi toolchain via powershell.exe. It accepts the same parameters as the PowerShell script and translates WSL paths to Windows paths automatically.
Usage (from WSL):
# Make the script executable (once)
chmod +x ./DelphiBuildDPROJ.sh
# Basic usage
./DelphiBuildDPROJ.sh -ProjectFile ./MyProject.dproj
# Build Release for Win64
./DelphiBuildDPROJ.sh -ProjectFile ./MyProject.dproj -Config Release -Platform Win64
# Build for Linux64 with full debug symbols and map file
./DelphiBuildDPROJ.sh -ProjectFile ./MyProject.dproj -Platform Linux64 -LinuxMapRequirements:
- WSL (Windows Subsystem for Linux)
powershell.exeaccessible inPATHfrom within WSL (default on standard WSL installations)- Embarcadero Delphi installed on the Windows host
The plugins/ folder contains agent skills: a SKILL.md per topic plus scripts and references that tell a coding agent exactly how to do a Delphi-specific job. They build on this repository's style guide and Git templates.
| Skill | What it does |
|---|---|
| delphi-project | Create and maintain Delphi projects: DPROJ validation and normalization, scaffolding following this style guide, encoding check (UTF-8 BOM + CRLF), DUnitX setup. Delphi 11–13. |
| delphi-android-r8 | R8 for Delphi FMX Android App Bundles: fixes Google Play's "low DEX optimization / obfuscation" warning with a tested MSBuild hook, before/after measurement and a mandatory start test. |
Claude Code (this repository is a plugin marketplace):
/plugin marketplace add omonien/DelphiStandards
/plugin install delphi-project@delphi-standards
/plugin install delphi-android-r8@delphi-standards
Cursor, grok CLI, Codex and other agents read instructions from the repository they work in. Clone this repository (or add it as a submodule, e.g. tools/DelphiStandards) and point to the skills from your project's AGENTS.md (or CLAUDE.md):
## Delphi skills
For Delphi project and DPROJ work follow tools/DelphiStandards/plugins/delphi-project/skills/delphi-project/SKILL.md.
For Android packaging, R8 or Google Play DEX warnings follow
tools/DelphiStandards/plugins/delphi-android-r8/skills/delphi-android-r8/SKILL.md.
Read the whole SKILL.md before acting; its scripts are in the scripts/ folder next to it.The scripts need Python 3.10+ (winget install Python.Python.3.12); delphi-android-r8 additionally needs a JDK 17+, R8 9.0.32 (downloaded by its fetch_r8.ps1) and, for testing, bundletool and adb.
Official releases are available in the release-assets/ directory. Each release includes:
- PDF versions of the style guides (German and English)
- Git templates (.gitignore and .gitattributes)
- Documentation
For creating new releases, see release-tools/README.md.
- Issues and PRs are welcome
- Single-language PRs (DE or EN) are fine; maintainer will sync the other language after merge
- Provide configuration templates for code formatters to implement this style guide (e.g., 2-space indentation, 120-char line length, synchronized vertical guideline)...
- Shared project presets (.dproj) or IDE settings for teams
MIT License – see notices in the files