.agents/skills/add-entity/SKILL.md
Create entity for $ARGUMENTS.
Read the pattern: Open packages/server/api/src/app/tables/table/table.entity.ts as reference.
Create entity file at packages/server/api/src/app/{module}/{name}.entity.ts:
EntitySchema (NOT decorators)...BaseColumnSchemaPart (id, created, updated)ApIdSchema for foreign key columns ({ ...ApIdSchema, nullable: false })projectId column + relation to project (CASCADE delete)foreignKeyConstraintName on all join columns{ type: String, array: true, nullable: false }Register entity: Import and add to getEntities() array in packages/server/api/src/app/database/database-connection.ts. This is REQUIRED — TypeORM does NOT auto-discover.
Create migration:
{Timestamp}{PascalCaseDescription} (e.g., AddMyFeature1774500000000)packages/server/api/src/app/database/postgres-connection.tsgetMigrations() array (chronological order)CREATE INDEX (not CONCURRENTLY). Set transaction = false for CONCURRENTLY.Create repository: const myRepo = repoFactory(MyEntity) — call as myRepo() or myRepo(entityManager) for transactions.
Verify: npm run lint-dev