Delphi Coding Practices
Application skill for Delphi/Object Pascal style learning (from the archived awesome-guidelines style capsules). Follow Embarcadero baseline; apply DelphiStandards namespace rules when project adopts them.
Core Principle
Delphi quality is PascalCase clarity + unit hierarchy + deterministic cleanup, properties and docs on public surfaces, FreeAndNil in finally blocks.
When to Use / NOT
- Delphi VCL/FMX apps, FireDAC services, Object Pascal libraries.
- Setting up IDE formatter, Pascal analyzer, DUnit/DUnitX tests in CI.
NOT when:
- Free Pascal/Lazarus-only dialect differences, document project baseline.
- Generated form
.dfmdesigner output, validate hand-edited.pasonly.
Workflow
- Layout, indent, begin/end, whitespace (
delphi-style-formatting-layout.md). - Naming, T/I/E/F/A/L, PascalCase (
delphi-style-naming-types.md). - Units, hierarchy, uses, structure (
delphi-style-units-structure.md). - Resources, try/finally, except, docs (
delphi-style-resources-errors.md). - Verify, compile, formatter, tests on changed units.
Red Flags
- snake_case or underscores (non-API)
- Tab indentation
- Public fields on classes
.Freewithout FreeAndNil pattern- Empty except blocks
- Flat Unit1-style names in large apps
- Missing XML docs on exported API
- Implementation-only units in interface uses
- Heavy
withstatements
Verification
- Project build (Win32/Win64 target)
- IDE formatter /
.editorconfigindent=2 - DUnit/DUnitX or project test runner
- XML documentation compile (if enabled)
- Capsule checklist on new units
References
awesome-guidelines/references/delphi-style-learning-note.mdawesome-guidelines/references/delphi-style-formatting-layout.mdawesome-guidelines/references/delphi-style-naming-types.mdawesome-guidelines/references/delphi-style-units-structure.mdawesome-guidelines/references/delphi-style-resources-errors.md