Aurelius mapping
Official collection of agent skills from TMS Software
npx -y skills add tmssoftware/skills --skill aurelius-mappingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Map Delphi classes to a relational database using TMS Aurelius ORM attributes. Use when the user asks to create entity classes, add Aurelius mapping to existing classes, fix or review mapping attributes, explain how a class is mapped, or work with associations, inheritance, automapping, nullable fields, blobs, or composite identifiers. Triggers on requests like "create Aurelius entities for...", "map this class to Aurelius", "add ORM mapping", "fix the mapping on this class", "how do I map a one-to-many in Aurelius".
SKILL.md
3.2 KB, 571 tokens by cl100k_base, as published. Nobody here has run it
Aurelius Mapping
Map Delphi classes to a relational database using TMS Aurelius attributes. All attributes are declared in unit Aurelius.Mapping.Attributes.
Read references/mapping.md for all attribute syntax, options tables, and code examples. The guidance below covers decisions and rules that the reference does not emphasize.
Approach
New schema (no existing tables): Default to [Automapping]. It infers table names, column names, nullability, and the identifier from field naming conventions, requiring no extra attributes for simple cases.
Legacy or fixed schema: Use explicit attributes ([Table], [Column], [Id], etc.) to match the existing column and table names exactly.
Mixed: Automapping is not all-or-nothing — add explicit attributes only where the defaults need to be overridden.
When the user hasn't specified, ask or infer from context (existing table definitions → explicit; greenfield → automapping).
Critical Rules
These are the most common mistakes. Apply them without exception.
Object lifetime — associations
- Never create or free a many-to-one associated object in the parent's constructor or destructor. Aurelius owns the lifetime of associated entity objects.
- Use plain
Tfield type for eager associations; useProxy<T>field type for lazy associations. - Expose lazy associations through a property that returns
FArtist.Value.
Object lifetime — collections
- Do create and free the
TList<T>container in the parent's constructor and destructor. - Never create or free the child entity objects inside the list — Aurelius manages them.
- Do not use
TObjectList<T>withOwnsObjects = True. - For lazy collections, use
Proxy<TList<T>>as the field type. UseSetInitialValue/DestroyValueinstead of accessing.Valuein constructor/destructor.
Registering entities
Always add RegisterEntity calls in the initialization section of the unit:
initialization
RegisterEntity(TCustomer);
RegisterEntity(TCountry);
This prevents the Delphi linker from removing the class. It is especially important in server applications (XData services) where entity classes may not be directly referenced in code.
Reference
For all attribute signatures, options, and full code examples, read references/mapping.md.
The reference covers: basic entity mapping, automapping rules and overrides, abstract entities, nullable fields, blob fields, many-to-one associations (eager and lazy), one-to-many associations (bidirectional and unidirectional, eager and lazy), collection ordering and filtering, foreign key naming, single-table and joined-tables inheritance, composite identifiers.
Gives 0 of the 12 instructions most databases sql skills give in 571 tokens
Counted across 589 of the 662 authors here whose files we hold, read 2026-08-06
- use parameterized queriesin 36 of 589, across 32 files
- use timestamptz for timestampsin 30 of 589, across 12 files
- create indexes concurrentlyin 29 of 589, across 23 files
- index foreign keysin 28 of 589, across 17 files
- use numeric type for moneyin 25 of 589, across 8 files
- select only required columnsin 24 of 589, across 19 files
- use cursor pagination instead of OFFSETin 23 of 589, across 15 files
- add indexes manually on foreign key columnsin 22 of 589, across 11 files
- read individual rule files for detailed explanationsin 18 of 589, across 4 files
- configure connection poolingin 18 of 589, across 16 files
- put equality columns before range columns in indexesin 17 of 589, across 9 files
- normalize to third normal formin 17 of 589, across 8 files
Said here and by no other author read
- read the attribute reference file
- use automapping for new schemas
- use explicit attributes for legacy schemas
- override automapping defaults only where required
- create and free collection containers in parent constructors
- use SetInitialValue and DestroyValue for lazy collections
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.