{"id":"b33c089e-426c-4f29-91d1-f212badda8e9","shortId":"k4MtZq","kind":"skill","title":"aurelius-mapping","tagline":"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, autom","description":"# Aurelius Mapping\n\nMap Delphi classes to a relational database using TMS Aurelius attributes. All attributes are declared in unit `Aurelius.Mapping.Attributes`.\n\nRead `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.\n\n## Approach\n\n**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.\n\n**Legacy or fixed schema:** Use explicit attributes (`[Table]`, `[Column]`, `[Id]`, etc.) to match the existing column and table names exactly.\n\n**Mixed:** Automapping is not all-or-nothing — add explicit attributes only where the defaults need to be overridden.\n\nWhen the user hasn't specified, ask or infer from context (existing table definitions → explicit; greenfield → automapping).\n\n## Critical Rules\n\nThese are the most common mistakes. Apply them without exception.\n\n### Object lifetime — associations\n\n- **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.\n- Use plain `T` field type for eager associations; use `Proxy<T>` field type for lazy associations.\n- Expose lazy associations through a property that returns `FArtist.Value`.\n\n### Object lifetime — collections\n\n- **Do** create and free the `TList<T>` container in the parent's constructor and destructor.\n- **Never** create or free the child entity objects inside the list — Aurelius manages them.\n- Do **not** use `TObjectList<T>` with `OwnsObjects = True`.\n- For lazy collections, use `Proxy<TList<T>>` as the field type. Use `SetInitialValue`/`DestroyValue` instead of accessing `.Value` in constructor/destructor.\n\n### Registering entities\n\nAlways add `RegisterEntity` calls in the `initialization` section of the unit:\n\n```delphi\ninitialization\n  RegisterEntity(TCustomer);\n  RegisterEntity(TCountry);\n```\n\nThis 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.\n\n## Reference\n\nFor all attribute signatures, options, and full code examples, read [references/mapping.md](references/mapping.md).\n\nThe 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.","tags":["aurelius","mapping","skills","tmssoftware","agent-skills","claude-code-skill","claude-code-skills","claude-skills"],"capabilities":["skill","source-tmssoftware","skill-aurelius-mapping","topic-agent-skills","topic-claude-code-skill","topic-claude-code-skills","topic-claude-skills"],"categories":["skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/tmssoftware/skills/aurelius-mapping","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add tmssoftware/skills","source_repo":"https://github.com/tmssoftware/skills","install_from":"skills.sh"}},"qualityScore":"0.456","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 12 github stars · SKILL.md body (2,734 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T19:07:27.691Z","embedding":null,"createdAt":"2026-04-29T07:00:08.599Z","updatedAt":"2026-05-18T19:07:27.691Z","lastSeenAt":"2026-05-18T19:07:27.691Z","tsv":"'abstract':370 'access':296 'add':25,150,303 'all-or-noth':146 'alway':302 'appli':186 'applic':334 'approach':92 'ask':20,167 'associ':45,192,202,216,226,233,236,380,388 'attribut':15,35,60,62,72,118,128,152,350 'aurelius':2,13,26,48,59,211,271 'aurelius-map':1 'aurelius.mapping.attributes':67 'autom':47 'automap':100,143,177,366 'basic':363 'bidirect':389 'blob':374 'call':305 'case':121 'child':265 'class':6,24,30,39,52,327,339 'code':77,346,355 'collect':245,283,395 'column':105,130,137 'common':184 'composit':410 'constructor':208,257 'constructor/destructor':299 'contain':252 'context':171 'convent':114 'cover':82,362 'creat':22,194,247,261 'critic':178 'databas':10,56 'decis':83 'declar':64 'default':98,156 'definit':174 'delphi':5,51,313,322 'destroyvalu':293 'destructor':210,259 'direct':343 'eager':225,381,392 'emphas':91 'entiti':23,217,266,301,338,364,371 'especi':330 'etc':132 'exact':141 'exampl':78,356 'except':189 'exist':29,96,136,172 'explain':36 'explicit':127,151,175 'expos':234 'extra':117 'fartist.value':242 'field':112,222,229,289,373,375 'filter':398 'fix':31,124 'foreign':399 'free':196,249,263 'full':354 'greenfield':176 'guidanc':80 'hasn':164 'id':131 'identifi':110,411 'import':331 'infer':102,169 'inherit':46,409 'initi':308,314 'insid':268 'instead':294 'join':407 'joined-t':406 'key':400 'lazi':232,235,282,383,394 'legaci':122 'lifetim':191,214,244 'linker':323 'list':270 'manag':272 'mani':199,377,387 'many-to-on':198,376 'map':3,4,27,34,41,49,50,365 'match':134 'may':340 'mistak':185 'mix':142 'name':104,106,113,140,401 'need':157 'never':193,260 'new':93 'noth':149 'nullabl':107,372 'object':190,203,218,243,267 'one':201,379,385 'one-to-mani':384 'option':74,352 'order':396 'orm':14 'overrid':369 'overridden':160 'own':212 'ownsobject':279 'parent':206,255 'plain':220 'prevent':320 'properti':239 'proxi':228,285 'read':68,357 'refer':88,347,361 'referenc':344 'references/mapping.md':69,358,359 'regist':300 'registerent':304,315,317 'relat':9,55 'remov':325 'requir':115 'return':241 'review':33 'rule':85,179,367 'schema':94,125 'section':309 'server':333 'servic':336 'setinitialvalu':292 'signatur':351 'simpl':120 'singl':403 'single-t':402 'skill' 'skill-aurelius-mapping' 'source-tmssoftware' 'specifi':166 'syntax':73 'tabl':75,97,103,129,139,173,404,408 'tcountri':318 'tcustom':316 'tlist':251,286 'tms':12,58 'tobjectlist':277 'topic-agent-skills' 'topic-claude-code-skill' 'topic-claude-code-skills' 'topic-claude-skills' 'true':280 'type':223,230,290 'unidirect':391 'unit':66,312 'use':11,16,57,126,219,227,276,284,291 'user':19,163 'valu':297 'without':188 'work':43 'xdata':335","prices":[{"id":"7b76f9fe-65e3-47f1-b144-1f55857c8b00","listingId":"b33c089e-426c-4f29-91d1-f212badda8e9","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"tmssoftware","category":"skills","install_from":"skills.sh"},"createdAt":"2026-04-29T07:00:08.599Z"}],"sources":[{"listingId":"b33c089e-426c-4f29-91d1-f212badda8e9","source":"github","sourceId":"tmssoftware/skills/aurelius-mapping","sourceUrl":"https://github.com/tmssoftware/skills/tree/main/skills/aurelius-mapping","isPrimary":false,"firstSeenAt":"2026-04-29T07:00:08.599Z","lastSeenAt":"2026-05-18T19:07:27.691Z"}],"details":{"listingId":"b33c089e-426c-4f29-91d1-f212badda8e9","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"tmssoftware","slug":"aurelius-mapping","github":{"repo":"tmssoftware/skills","stars":12,"topics":["agent-skills","claude-code-skill","claude-code-skills","claude-skills"],"license":null,"html_url":"https://github.com/tmssoftware/skills","pushed_at":"2026-04-15T21:13:22Z","description":"Official collection of agent skills from TMS Software","skill_md_sha":"17943c38dce664d60fd304e8cca0cd1bc9dee8a0","skill_md_path":"skills/aurelius-mapping/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/tmssoftware/skills/tree/main/skills/aurelius-mapping"},"layout":"multi","source":"github","category":"skills","frontmatter":{"name":"aurelius-mapping","description":"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\"."},"skills_sh_url":"https://skills.sh/tmssoftware/skills/aurelius-mapping"},"updatedAt":"2026-05-18T19:07:27.691Z"}}