Dext Framework Patterns
Skill53 starsChanged 8 months agoMITView on GitHub
Architectural patterns, Entity ORM, Minimal APIs and dependency injection for projects created with Dext Framework (cesarliws/dext).
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/acbr-patterns.mdCursor rule
- .cursor/rules/delphi-conventions.mdCursor rule
- .cursor/rules/design-patterns.mdCursor rule
- .cursor/rules/dext-patterns.mdCursor rule
- .cursor/rules/dmvc-patterns.mdCursor rule
- .cursor/rules/firebird-patterns.mdCursor rule
- .cursor/rules/horse-patterns.mdCursor rule
- .cursor/rules/intraweb-patterns.mdCursor rule
- .cursor/rules/memory-exceptions.mdCursor rule
- .cursor/rules/mysql-patterns.mdCursor rule
- .cursor/rules/postgresql-patterns.mdCursor rule
- .cursor/rules/refactoring.mdCursor rule
- .cursor/rules/solid-patterns.mdCursor rule
- .cursor/rules/tdd-patterns.mdCursor rule
- .cursor/rules/threading-patterns.mdCursor rule
- acbr-componentsSkill
- Delphi Clean CodeSkill
- Delphi Code ReviewSkill
- Delphi Memory and ExceptionsSkill
- Delphi SOLID PatternsSkill
- Design Patterns GoF — DelphiSkill
- DevExpress/DEXT ComponentsSkill
- DelphiMVCFrameworkSkill
- DUnitX Testing PatternsSkill
- Firebird DatabaseSkill
- Horse FrameworkSkill
- Intraweb FrameworkSkill
- MySQL DatabaseSkill
- PostgreSQL DatabaseSkill
- Delphi Code RefactoringSkill
- Delphi Test-Driven Development (TDD) and DUnitXSkill
- Threading & Multi-ThreadingSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Minimal Routing (Minimal APIs): Do not use traditional MVC Controllers unless necessary.
- Very specific: line 18
Integrated DI Container: All interface dependencies must be resolved via App.Services (Injection).
- Distinctive: line 19
Smart ORM (Dext.Entity): Never concatenate SQL.
- Very specific: line 104
Avoid using complex RTTI or native ADOTables if you are on Dext.
- Very specific: line 132
Always return IResult-based implementations on endpoints using the Results factory.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Dext Framework Patterns (Delphi)
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).
Core Principles
- Minimal Routing (Minimal APIs): Do not use traditional MVC Controllers unless necessary. Use functional routing syntax (
MapGet,MapPost). - 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). - Integrated DI Container: All interface dependencies must be resolved via
App.Services(Injection). Do not use manual factories. - Smart ORM (Dext.Entity): Never concatenate SQL.
1. WebApp Lifecycle and DI
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.2. Minimal APIs & Model Binding
The preferred way to build REST APIs with Dext is using typed anonymous delegates, with DI dependencies passed in the final arguments.
Create user (Post + DTO Body + Auth)
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);Path Params & Query
//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);3. Dext.Entity (ORM & Smart Properties)
Database mapping with Dext is focused on strongly typed query building and "Code First" Classes.
LINQ-Like Queries
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;Understanding "Mass Update" via Dext.Entity
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;4. Returns (IResult)
Always return IResult-based implementations on endpoints using the Results factory.
Results.Ok( MeuRecord )-> Status 200 + Automatically Serializes into JSON.Results.Created('/rota', 'Msg')-> Status 201 + Header "Location".Results.NotFound-> Status 404.Results.BadRequest('Msg')-> Status 400 bad request error.
5. Dext.Net Async Tasks and Resilience (TAsyncTask)
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;Review Checklist (Dext Framework)
- Fluent routes? Does the application use
Builder.MapGet/MapPostwith implicit binding instead of manual request manipulation and pure Body parse for complex json objects? - Has the DI container been powered? Are instances being passed to constructors/routers through
App.Services? - No Filter Strings in Data Modules? Did you use expressive Smart Properties (
.Where(E.Price > 100)) instead of query concat? - Are returns based on records and POLD objects? (Plain Old Delphi Objects, allowing UTF-8 Zero Allocation JSON from Dext).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

