acbr-components
Architectural, dependency injection and UI patterns for the ACBr Project (Commercial Automation Brazil) ecosystem in Delphi.
Architectural patterns, Entity ORM, Minimal APIs and dependency injection for projects created with Dext Framework (cesarliws/dext).
$ npx -y skills add delphicleancode/delphi-spec-kit --skill dext-framework --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/dext-frameworkContext preview
The summary Claude sees to decide when to auto-load this skill.
Architectural patterns, Entity ORM, Minimal APIs and dependency injection for projects created with Dext Framework (cesarliws/dext).
name: Dext Framework Patterns description: Architectural patterns, Entity ORM, Minimal APIs and dependency injection for projects created with Dext Framework (cesarliws/dext).
The **Dext Framework** is a complete ecosystem for Delphi, directly inspired by **ASP.NET Core** and **Spring Boot**. It is intended for high-performance corporate development. Unlike Horse or DMVC, Dext embraces Dependency Injection, Minimal APIs with automatic model binding and has its own Entity ORM (`Dext.Entity`).
This manual provides the conventions that must be followed by the AI when coding with Dext.
**Important Note:** Dext Framework is **not** short for DevExpress/DevExtreme visual components, but rather the backend project (https://github.com/cesarliws/dext).
1. **Minimal Routing (Minimal APIs):** Do not use traditional MVC Controllers unless necessary. Use functional routing syntax (`MapGet`, `MapPost`). 2. **Auto Model Binding:** Get JSON body not via strings and partial conversions, but by delegating strong typing to anonymous route parameters (`function(Dto: MyDto): IResult`). 3. **Integrated DI Container:** All interface dependencies must be resolved via `App.Services` (Injection). Do not use manual factories. 4. **Smart ORM (Dext.Entity):** Never concatenate SQL.
---
Bootstrap of a Dext API occurs by registering services in the same route pipeline.
program MyAPI;
uses Dext.Web, Services.Interfaces, Services.Implementations;
begin
var App := WebApplication;
var Builder := App.Builder;
//1. Registration of Dependency Injection Services
App.Services.AddSingleton<IEmailService, TEmailService>;
App.Services.AddScoped<IOrderRepository, TOrderRepository>;
//2. Route Mapping
Builder.MapGet<IResult>('/health',
function: IResult
begin
Result := Results.Ok('{"status": "ok"}');
end);
//3. Start
App.Run(8080);
end.---
The preferred way to build REST APIs with Dext is using typed anonymous delegates, with DI dependencies passed in the final arguments.
type
TCreateUserDto = record
Name: string;
Age: Integer;
end;
//'Dto' is populated via JSON from the request body automatically.
//'Database' is injected via DI.
Builder.MapPost<TCreateUserDto, IDatabaseService, IResult>('/users',
function(Dto: TCreateUserDto; Database: IDatabaseService): IResult
begin
if Dto.Name.IsEmpty then
Exit(Results.BadRequest('Name is required'));
Database.SaveUser(Dto.Name, Dto.Age);
Result := Results.Created('/users/new', 'User Created');
end);//Typed path-based routing (Route parameter Binding)
Builder.MapGet<Integer, IResult>('/orders/{id}',
function(Id: Integer): IResult
begin
var Order := FindOrder(Id);
if Order = nil then
Result := Results.NotFound
else
Result := Results.Ok(Order);
end);---
Database mapping with Dext is focused on strongly typed query building and "Code First" Classes.
Avoid using complex RTTI or native ADOTables if you are on Dext. Deliver results in typed Collections (`IList<T>`).
uses Dext.Entity; //P is the Smart Property representation for the context class var Products := DbContext.Products .Where((P.Price > 100) and (P.Stock > 0)) //'and' bitwise/Smart property syntax .OrderBy(P.Name) .Take(10) .ToList;
With Dext ORM, Updates can run in the database without pulling data into memory (as done in modern Entity Framework Core):
DbContext.Orders .Where(O.Status = 'Pending') .Update .Execute;
---
Always return `IResult`-based implementations on endpoints using the `Results` factory.
---
Dext includes more modern promises/tasks primitives than the pure `TTask` originals of Delphi.
uses Dext.Core.Tasks; //Use Task Flow from the central library
TAsyncTask.Run<TUserProfile>(
function: TUserProfile
begin
Result := ExternalService.Call();
end)
.OnComplete( //Callback chamado no contexto Sincrono/Main thread.
procedure(Profile: TUserProfile)
begin
ShowVclMessage(Profile.Name);
end)
.OnException(
procedure(Ex: Exception)
begin
LogError(Ex.Message);
end)
.Start;---
An opinionated ecosystem of rules, skills and steerings to elevate Delphi development to state-of-the-art with Artificial Intelligence.
Repo: delphicleancode/delphi-spec-kit
Architectural, dependency injection and UI patterns for the ACBr Project (Commercial Automation Brazil) ecosystem in Delphi.
Pragmatic clean code standards for Delphi — concise, direct, no over-engineering
Delphi code review checklist — quality, security, performance, SOLID, memory
Good memory management practices, memory leak prevention and exception handling in Delphi
SOLID implementation patterns for Delphi projects — Repository, Service, Factory, Strategy with constructor injection and interfaces
Implementation of the 23 GoF (Gang of Four) patterns in Object Pascal / Delphi with interfaces, TInterfacedObject and SOLID principles. Covers Creational,…