From ai-toolkit
Creates PostgreSQL table with Kotlin Exposed ORM table, entity, repository, tests, and soft deletes. Use when adding new database tables or entities.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ai-toolkit:database-table-creatorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Creates complete database table implementation with SQL migration, Kotlin code, and comprehensive tests.
Creates complete database table implementation with SQL migration, Kotlin code, and comprehensive tests.
Generates:
SQL Requirements:
WHERE deleted_at IS NULLWHERE deleted_at IS NOT NULLKotlin Requirements:
UUIDTable (NOT Table)Entity<Instant>deletedAt.isNull()!! operators (forbidden by pre-commit hooks)Location: database-migration/sql/{number}-{description}.sql
-- ============================================================================
-- Description: [Describe what this migration does]
-- Table: {table_name}
-- ============================================================================
CREATE TABLE {table_name} (
-- Primary key (REQUIRED)
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- Business columns
name TEXT NOT NULL,
email TEXT,
status TEXT DEFAULT 'active',
user_id UUID,
count INTEGER DEFAULT 0,
is_active BOOLEAN DEFAULT true,
metadata JSONB,
-- Standard timestamps (REQUIRED)
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP,
deleted_at TIMESTAMP
);
-- Unique index (allows duplicate soft-deleted records)
CREATE UNIQUE INDEX idx_{table_name}_email_unique
ON {table_name}(email) WHERE deleted_at IS NULL;
-- Foreign key index (NO FK constraint, just index)
CREATE INDEX idx_{table_name}_user_id
ON {table_name}(user_id) WHERE deleted_at IS NULL;
-- Soft delete index (REQUIRED)
CREATE INDEX idx_{table_name}_deleted_at
ON {table_name}(deleted_at) WHERE deleted_at IS NOT NULL;
-- Update trigger (REQUIRED)
CREATE TRIGGER update_{table_name}_updated_at
BEFORE UPDATE ON {table_name}
FOR EACH ROW
EXECUTE FUNCTION update_updated_at();
Critical:
./gradlew :app:module-repository:flywayMigrate
Verify success before proceeding.
See
kotlin-templates.mdfor all Kotlin code templates (Table, Entity, Repository, Factory Bean, Tests).
Follow this order:
UUIDTable, use text() not varchar())Entity<Instant>)db.primary for writes, db.replica for reads, ALWAYS filter deletedAt.isNull())./gradlew testSee
examples.mdfor common mistakes and anti-patterns.
✅ SQL migration runs successfully ✅ Uses TEXT (not VARCHAR) ✅ NO foreign key constraints ✅ All indexes have WHERE clause ✅ Kotlin Table extends UUIDTable ✅ Entity implements Entity ✅ All queries filter deletedAt.isNull() ✅ No !! operators ✅ Soft delete only (no hard delete) ✅ Factory bean registered ✅ All 7+ tests pass
npx claudepluginhub c0x12c/ai-toolkit --plugin ai-toolkitProvides Kotlin Exposed ORM patterns for PostgreSQL: schema design, soft deletes, Flyway migrations, tables, entities, repositories. Use for creating tables or implementing data access.
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.