acbr-components
Architectural, dependency injection and UI patterns for the ACBr Project (Commercial Automation Brazil) ecosystem in Delphi.
$ npx -y skills add delphicleancode/delphi-spec-kit --skill tdd-dunitx --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/tdd-dunitxname: Delphi Test-Driven Development (TDD) and DUnitX description: Guidelines on how the AI should act and code when the user requests TDD, unit tests, DUnitX or fakes/mocks using Interfaces in Delphi.
This skill guides behavioral expectations for test-driven development (TDD) using the modern Delphi ecosystem.
When operating under the scope of TDD, AI MUST ALWAYS prioritize the **Red-Green-Refactor** cycle. If the user requests TDD, DO NOT write the business implementation before writing the test that will fail.
1. **Red (Failed Test):** Start by declaring the skeleton of the target class/interface in the `interface` section just to compile. Then, immediately write a complete DUnitX Test Case calling out the non-existent behavior or asserting an expected result. The test will logically fail. 2. **Green (Minimal Code):** Write the minimum and raw actual implementation, enough to make the test `Assert` pass. 3. **Refactor (Cleaning):** Improve the code (Clean Code, duplication removal, optimizations) ensuring that the test does not break.
Embrace context conventions like **Action_Condition_ExpectedResult**:
[Test] procedure ComputeDiscount_LoyalCustomer_ReturnsTenPercent;
Replace manual Boolean validations (`Assert.IsTrue(A = B)`) with fluent and specific `Assert`:
To isolate the class under test (SUT - System Under Test) from the infrastructure (Database, APIs, View), apply **Strict Dependency Inversion (DIP)** by injecting `Interfaces` into the SUT via constructor.
As Delphi does not have a built-in Mocking Framework in RTL, write local "Fake/Mock" Classes implementing the Interface to simulate the dependency within the test's `implementation` session.
//Fake is created only in the test file TFakeEmailService = class(TInterfacedObject, IEmailService) public SentCount: Integer; procedure Send(const AMsg: string); end;
1. ❌ Direct coupling to the database (`TFDQuery`) in the tested class. Always abstract database access into a `IRepository` and create a `TFakeRepository` for DUnitX. 2. ❌ Test UI. Restrict the scope of DUnitX to the Domain and Application Services Layer. 3. ❌ Write the entire class along with the tests. The user must be followed step-by-step in TDD. If the AI is required to provide everything, send the Tests first in the output. 4. ❌ Swallowing Exceptions (`try..except on E: Exception do`) in methods being tested, this breaks `Assert.WillRaise()`.
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,…