بنقرة واحدة
delphi-patterns
// Coding conventions and patterns for the SimpleORM Delphi project. Automatically loaded when writing or modifying Delphi code.
// Coding conventions and patterns for the SimpleORM Delphi project. Automatically loaded when writing or modifying Delphi code.
| name | delphi-patterns |
| description | Coding conventions and patterns for the SimpleORM Delphi project. Automatically loaded when writing or modifying Delphi code. |
| user-invocable | false |
Rules are in
.claude/rules/— this skill provides patterns and templates, not rules.
TSimpleXxx = class(TInterfacedObject, iSimpleXxx)
private
FField: Type;
public
constructor Create(aParam: Type);
destructor Destroy; override;
class function New(aParam: Type): iSimpleXxx;
end;
| Element | Convention | Example |
|---|---|---|
| Unit | SimpleXxx.pas | SimpleDAO.pas |
| Class | TSimpleXxx | TSimpleDAO |
| Interface | iSimpleXxx (lowercase i) | iSimpleQuery |
| Exception | ESimpleXxx | ESimpleValidator |
| Field | F prefix | FQuery, FParams |
| Parameter | a prefix | aValue, aSQL |
| Local var | L prefix (new code) | LResult |
{$IFNDEF CONSOLE} // UI code (forms, bindings)
{$IFDEF FMX} // FireMonkey specific
{$IFDEF VCL} // VCL specific
{$IF RTLVERSION > 31.0} // Newer Delphi features
interface
uses
// 1. SimpleORM units
SimpleInterface, SimpleTypes,
// 2. System units
System.SysUtils, System.Classes, System.Generics.Collections,
// 3. Data units
Data.DB,
// 4. Conditional UI units
{$IFNDEF CONSOLE}
{$IFDEF FMX} FMX.Forms, {$ELSE} Vcl.Forms, {$ENDIF}
{$ENDIF}
// 5. Driver-specific units last
FireDAC.Comp.Client;
try
FQuery.ExecSQL;
except
on E: Exception do
begin
if FTransaction.Active then
FTransaction.Rollback;
raise;
end;
end;
destructor TSimpleXxx.Destroy;
begin
FreeAndNil(FOwnedObject1);
FreeAndNil(FOwnedObject2);
// Interface fields: do NOT free (auto-managed)
inherited;
end;
Use helpers from SimpleRTTIHelper.pas:
EhChavePrimaria, EhChaveEstrangeira, EhCampo, Tem<T>IsNotNull, IsIgnore, IsAutoInc, IsHasOne, HasFormatValidates all SimpleORM Delphi source files for Delphi 10.2 Tokyo+ compatibility. Checks inline vars, unit scoping, generics E2506, uses completeness, memory safety, .dpr structure, and conditional compilation. Run anytime to "lint" the project.
Delphi project file structure reference — .dpr vs .pas, .dproj, .res, .dfm. Templates for console and VCL projects.
CHANGELOG.md format reference and examples for the SimpleORM project.
SimpleORM entity-to-database mapping via RTTI attributes. Complete reference for all attributes, property types, and relationship setup.
Horse/ExpxHorse integration patterns for SimpleORM — server auto-routing, client REST driver, serialization examples.
The exact iSimpleQuery interface contract that all query drivers must implement. Reference for creating or reviewing drivers.