An opinionated ecosystem of rules, skills and steerings to elevate Delphi development to state-of-the-art with Artificial Intelligence.
Delphi/Lazarus components <www.inovefast.com.br>
Integrations with payment platforms and services (Asaas, MercadoPago, Cielo, PagSeguro, D4sign, Webstore, MelhorEnvio, Groq)
i9DBTools <www.inovefast.com.br/i9dbTools/> Manage MySQL, PostgreSQL, Firebird and SQLite in one place, with AI to generate and explain SQL in natural language, optimize queries and create Brazilian fake data in seconds.
- What is this project?
- Why use?
- Supported AI-Tools
- Main Guidelines
- Supported Frameworks
- Kit Structure
- Quick Start
- Code Examples
- Contributions
The Delphi AI Spec-Kit is not a code framework β it's a set of behavior guidelines for your favorite AI. It "teaches" the wizard to write Delphi code:
- β
Clean β no god classes, no business logic in
OnClick - β
Secure β zero memory leaks with
try..finallyand (ARC) interfaces - β Testable β TDD with DUnitX, Fakes via interface, without real bench in tests
- β Architected β SOLID, DDD, Repository/Service Pattern and clean architecture
Say goodbye to AI that mixes database access with the presentation layer, forgets
try..finallyor ignores Dependency Injection.
| Without Spec-Kit | With the Spec-Kit |
|---|---|
AI generates code with logic in OnClick |
AI isolates layers correctly |
TStringList.Create without try..finally |
Memory gold standard always applied |
| Tests coupled to the real bank | Fakes via interface, quick and isolated tests |
| Inconsistent naming | A-params, F-fields, T-types, verbs in methods |
with statement and global variables |
Code smells blocked proactively |
| Tool | Configuration File | How It Works |
|---|---|---|
| GitHub Copilot | .github/copilot-instructions.md |
Pre-prompt injected into Workspace/Chat |
| Cursor | .cursor/rules/*.md |
Rules loaded by context |
| Claude Code | .claude/ |
Rules by context and skills in the terminal |
| Google Gemini / Antigravity | .gemini/skills/*/SKILL.md |
Modular skills by domain |
| Kiro AI | .kiro/steering/*.md |
Stack and architectural constraints |
| Any AI | AGENTS.md |
Universal rules (project root) |
The AI ββenforces the pattern: every .Create without Owner requires try..finally on the immediately subsequent line. Also teaches the use of Interfaces (ARC) for native Garbage Collection β without Free manual.
//β
Gold Standard β ALWAYS generated by AI with Spec-Kit
var LList: TStringList;
begin
LList := TStringList.Create;
try
LList.Add('item');
finally
LList.Free;
end;
end;Red-Green-Refactor flow with Fakes isolated per interface. No coupling to the database in tests.
[Test]
procedure ProcessOrder_WithoutStock_RaisesException;
begin
Assert.WillRaise(
procedure begin FSut.Process(FEmptyOrder); end,
EInvalidOrderException
);
end;- S β One class, one responsibility.
TCustomerValidatordoes not save to the bank. - O β Extension via interfaces, without modifying existing code.
- L β Inheritance only with a clear contract. Preferred interfaces.
- I β Small and specific interfaces. Avoid giant interfaces.
- D β Dependency injection in the constructor, never hardcoded concrete instances.
//β
DIP in practice
constructor TOrderService.Create(
ARepo: IOrderRepository;
ANotifier: INotificationService);
begin
FRepo := ARepo;
FNotifier := ANotifier;
end;Consistent and mandatory nomenclatures:
| Category | Convention | Example |
|---|---|---|
| Parameters | Prefix A |
ACustomerName |
| Private fields | Prefix F |
FCustomerName |
| Local variables | Prefix L |
LCustomer |
| Classes | Prefix T |
TCustomerService |
| Interfaces | Prefix I |
ICustomerRepository |
| Exceptions | Prefix E |
ECustomerNotFound |
| Framework | Domain | Rules Included |
|---|---|---|
| Horse | Minimalist REST APIs | Controller/Service/Repository structure, middleware |
| Dext Framework | .NET-style APIs, ORM, DI, Async | Minimal APIs, Entity ORM, TAsyncTask.Run |
| DelphiMVC (DMVC) | REST APIs with Attributes | [MVCPath], Active Record, JWT, RQL |
| ACBR | Commercial Automation (NFe, CF-e, Boleto) | Tax isolation, without crossing with UI |
| Intraweb | Stateful WebApps in Delphi | UserSession, no global session variables |
| DevExpress | Advanced Enterprise UI | TcxGrid, TdxLayoutControl, skins and export |
| Firebird Database | Corporate Database | FireDAC Connection, PSQL, generators, transactions, migrations |
| PostgreSQL Database | Modern Database | FireDAC Connection, UPSERT, JSONB, Full-Text Search, PL/pgSQL |
| MySQL / MariaDB | Popular Database | FireDAC Connection, AUTO_INCREMENT, UPSERT, JSON, FULLTEXT |
| DUnitX | Unit Tests | Red-Green-Refactor, Fakes via interface |
| Design Patterns GoF | Design Patterns | Creational, Structural and Behavioral with interfaces and ARC |
| Threading | Multi-Threading | TThread, TTask, Synchronize/Queue, TCriticalSection, PPL |
| Code Refactoring | Code Smells and Techniques | Extract Method/Class, Guard Clauses, Strategy, Parameter Object |
delphi-spec-kit/
β
βββ AGENTS.md # π Universal rules (Copilot, Kiro, Antigravity, Gemini)
β
βββ .claude/
β βββ CLAUDE.md # π§ Master system prompt for Claude
β βββ settings.json # Permission settings
β βββ commands/
β β βββ review.md # Slash-command: /project:review
β βββ rules/ # Context-specific rules (auto-loaded by glob)
β β βββ delphi-conventions.md # Naming conventions and code style
β β βββ memory-exceptions.md # Memory management and exception patterns
β β βββ tdd-patterns.md # TDD and DUnitX
β β βββ solid-patterns.md # SOLID and DDD
β β βββ design-patterns.md # Design Patterns GoF (Creational, Structural, Behavioral)
β β βββ refactoring.md # Code refactoring (Extract Method, Guard Clauses, Strategy)
β β βββ horse-patterns.md # Horse REST Framework
β β βββ dmvc-patterns.md # DelphiMVC Framework
β β βββ dext-patterns.md # Dext Framework
β β βββ acbr-patterns.md # Commercial Automation (ACBr)
β β βββ intraweb-patterns.md # Intraweb WebApps
β β βββ firebird-patterns.md # Firebird Database (connection, PSQL, transactions)
β β βββ postgresql-patterns.md # PostgreSQL Database (UPSERT, JSONB, FTS)
β β βββ mysql-patterns.md # MySQL/MariaDB (AUTO_INCREMENT, JSON, UPSERT)
β β βββ threading-patterns.md # Threading (TThread, TTask, Synchronize/Queue)
β βββ skills/ # On-demand skills (SKILL.md per folder β Claude docs standard)
β βββ clean-code/ # Clean Code and Pascal Guide
β βββ delphi-memory-exceptions/# Memory management and try..finally
β βββ delphi-patterns/ # Repository, Service, Factory
β βββ design-patterns/ # Design Patterns GoF (23 patterns)
β βββ refactoring/ # Refactoring (10 techniques, before/after)
β βββ tdd-dunitx/ # TDD with DUnitX
β βββ horse-framework/ # Horse REST API
β βββ dmvc-framework/ # DelphiMVC Framework
β βββ dext-framework/ # Dext Framework
β βββ acbr-components/ # ACBr components
β βββ intraweb-framework/ # Intraweb WebApps
β βββ devexpress-components/ # DevExpress UI
β βββ dunitx-testing/ # Unit testing
β βββ firebird-database/ # Firebird Database (connection, PSQL, generators)
β βββ postgresql-database/ # PostgreSQL Database (UPSERT, JSONB, FTS, PL/pgSQL)
β βββ mysql-database/ # MySQL/MariaDB (AUTO_INCREMENT, JSON, FULLTEXT)
β βββ threading/ # Threading (TThread, TTask, PPL, thread-safety)
β βββ code-review/ # Code review
β
βββ .github/
β βββ copilot-instructions.md # π€ Pre-prompt for GitHub Copilot
β
βββ .cursor/
β βββ rules/ # Same rule files as .claude/rules/ (Cursor format)
β
βββ .gemini/
β βββ skills/ # Same skill folders as .claude/skills/ (Gemini format)
β
βββ .kiro/
β βββ steering/
β βββ product.md # Product vision
β βββ tech.md # Technology stack
β βββ structure.md # Layer architecture
β βββ frameworks.md # Framework guides
β
βββ .specify/ # AI-assisted spec templates
β βββ constitution.md # Project constitution and constraints
β βββ plan-template.md # Implementation plan template
β βββ spec-template.md # Feature specification template
β βββ tasks-template.md # Task breakdown template
β
βββ tools/ # Utility scripts
β βββ neural_translate_en.py # Neural translation helper
β βββ translate_comment_markers_en.py # Comment marker translation
β βββ translate_to_en_us.ps1 # PowerShell translation script
β
βββ examples/
βββ clean-unit-example.pas # Well-organized unit (Golden Path)
βββ memory-exception-example.pas # Correct memory and exception patterns
βββ repository-pattern.pas # Complete Repository Pattern
βββ service-pattern.pas # Complete Service Pattern
βββ design-patterns-example.pas # Design Patterns GoF in practice
βββ refactoring-example.pas # Refactoring before/after (6 techniques)
βββ tdd-dunitx-example.pas # TDD and DUnitX in practice
βββ horse-api-example.pas # REST API with Horse
βββ dmvc-controller-example.pas # DMVC Controller with Attributes
βββ dext-api-example.pas # Minimal API with Dext
βββ acbr-service-example.pas # NF-e issuance with ACBr
βββ intraweb-form-example.pas # Intraweb Form with UserSession
βββ firebird-repository-example.pas # Repository with FireDAC + Firebird
βββ postgresql-repository-example.pas # Repository with FireDAC + PostgreSQL
βββ mysql-repository-example.pas # Repository with FireDAC + MySQL
βββ threading-example.pas # Threading patterns (TTask, BackgroundWorker, Producer-Consumer)
βββ file-copy-app/ # π¦ Complete app example: file copy with service layer
βββ i18n-app/ # π¦ Complete app example: internationalization (i18n)
git clone https://github.com/delphicleancode/delphi-spec-kit.gitYourProject/
βββ MyApp.dpr
βββ AGENTS.md β copy from the root
βββ .claude/ β copy the folder
βββ .github/ β copy the folder
βββ .cursor/ β copy the folder
βββ .gemini/ β copy the folder
βββ .kiro/ β copy the folder
βββ .specify/ β copy the folder (optional β spec templates)
- Claude Code β Applies
.claude/CLAUDE.mdand uses direct rules/skills in the terminal - Cursor β Reads
.cursor/rules/*.mdautomatically by context - GitHub Copilot β Reads
.github/copilot-instructions.mdin workspace - Antigravity / Gemini β Skills in
.gemini/skills/are activated on demand - Kiro β Reads
.kiro/steering/*.mdas fixed product context
No additional configuration required. Open the project, use your preferred AI and notice the difference.
src/
βββ Domain/ β Entities, Value Objects, Repository Interfaces
βββ Application/ β Services, Use Cases, DTOs
βββ Infrastructure/ β FireDAC Repositories, external APIs
βββ Presentation/ β VCL/FMX Forms, ViewModels
tests/
βββ Unit/ β DUnitX projects with isolated Fakes
Dependency rule:
Presentation β Application β Domain β InfrastructureDomain never depends on other layers.
procedure ProcessOrder(AOrder: TOrder);
begin
if not Assigned(AOrder) then
raise EArgumentNilException.Create('AOrder cannot be nil');
if AOrder.Items.Count = 0 then
raise EBusinessRuleException.Create('Order must have at least one item');
if not AOrder.IsValid then
raise EValidationException.Create('Order validation failed');
//real logic here, no nesting
FRepository.Save(AOrder);
FNotifier.Send(AOrder.Customer.Email);
end;type
TFakeOrderRepository = class(TInterfacedObject, IOrderRepository)
private
FOrders: TObjectList<TOrder>;
public
constructor Create;
destructor Destroy; override;
procedure Save(AOrder: TOrder);
function FindById(AId: Integer): TOrder;
end;
[TestFixture]
TOrderServiceTest = class
private
FSut: TOrderService;
FRepo: IOrderRepository;
public
[Setup]
procedure SetUp;
[Test]
procedure PlaceOrder_ValidOrder_SavesToRepository;
[Test]
procedure PlaceOrder_EmptyItems_RaisesException;
end;This project enforces a multi-layer strategy to control what AI agents index and use as context. Before submitting a PR:
- Build output folders of any new subproject are covered by
.gitignore -
.cursorignoreincludes any new heavy or binary paths - Essential instruction files (
AGENTS.md, rules, skills, examples) are NOT excluded -
.vscode/settings.jsonexcludes are up to date for new artifact types - No secrets (
*.key,*.pfx,.env) are committed or referenced
See docs/ai-ignore-strategy.md for the full rationale and maintenance guide.
Pull Requests are welcome! If your favorite Delphi framework or library needs a guide for AI, add:
- Claude Rule β
.claude/rules/your-framework.md - Claude Skill β
.claude/skills/your-framework/SKILL.md - Cursor Rule β
.cursor/rules/your-framework.md - Gemini Skill β
.gemini/skills/your-framework/SKILL.md - Reference β mention in
AGENTS.md
# Fork and clone
git fork https://github.com/delphicleancode/delphi-spec-kit
git clone https://github.com/YOUR-FORK/delphi-spec-kit
# Create a descriptive branch
git checkout -b feat/add-remobjects-patterns
# Commit and Pull Request
git commit -m "feat: add RemObjects SDK patterns"
git push origin feat/add-remobjects-patternsBuy the author a coffee via Pix: pix@inovefast.com.br β
Made with β€οΈ for the Delphi community.
If this kit helped you, leave a β in the repository!