From ai-toolkit
Provides Kotlin Exposed ORM patterns for PostgreSQL: schema design, soft deletes, Flyway migrations, tables, entities, repositories. Use for creating tables or implementing data access.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ai-toolkit:database-patternsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
| Rule | Do | Don't |
| Rule | Do | Don't |
|---|---|---|
| Data types | TEXT | VARCHAR |
| Primary keys | UUID | SERIAL, BIGINT |
| Soft delete | deleted_at TIMESTAMP | DELETE FROM |
| Foreign keys | App-level validation | REFERENCES, ON DELETE CASCADE |
| Standard columns | id, created_at, updated_at, deleted_at | Skip any of these |
SQL migration with table, trigger, and partial indexes for soft delete.
See code-templates.md for the complete SQL template.
Extend UUIDTable, use text() not varchar(), add standard timestamp columns.
See code-templates.md for the complete template.
Implement Entity<Instant>, include all business fields + createdAt, updatedAt, deletedAt.
See code-templates.md for the complete template.
Interface + Default* implementation. Reads on db.replica, writes on db.primary. Soft delete via deletedAt update. convert() method maps ResultRow to entity.
See code-templates.md for the full interface + implementation code.
Full checklist:
module-repository/table/module-repository/entity/module-repository/constant/ (if needed)id uses .value -- everything else is direct. row[Table.id].value gives UUID, but row[Table.projectId] already returns UUID. Adding .value to non-id columns causes compile errors.gen_random_uuid() vs uuid_generate_v4() -- pick one per project. Mixing them works but confuses code review. Check existing migrations for which one the project uses.createdAt, updatedAt, deletedAt if extending SoftDeleteTable. They're inherited. Declaring them again causes duplicate column errors.WHERE deleted_at IS NULL on indexes wastes space. Every index on a soft-delete table should be partial. Full indexes include dead records nobody queries.text() in Exposed. JSONB in Postgres, text() in Kotlin, serialize/deserialize in the entity layer.npx claudepluginhub c0x12c/ai-toolkit --plugin ai-toolkitCreates PostgreSQL table with Kotlin Exposed ORM table, entity, repository, tests, and soft deletes. Use when adding new database tables or entities.
Provides JetBrains Exposed ORM patterns including DSL queries, DAO pattern, transactions, HikariCP connection pooling, Flyway migrations, and repository pattern.
Provides Kotlin patterns for JetBrains Exposed ORM: DSL/DAO queries, coroutine transactions, HikariCP pooling, Flyway migrations, repository pattern.