# database-table-creator

This skill guides an end-to-end table addition, from a SQL migration to Kotlin repository tests. Use it when a project needs a new table or entity.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · ★ 109
- Author: c0x12c
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/c0x12c/ai-toolkit/tree/HEAD/toolkit/skills/database-table-creator/SKILL.md
- Updated: 2026-06-18
- HTML: https://affpapa.org/en/nevibecode/skills/database-table-creator

## What it does

The workflow covers a SQL migration, an Exposed table object, a Kotlin entity, a repository interface and implementation, factory bean registration, and tests. It has you run the migration with `./gradlew :app:module-repository:flywayMigrate`, then test with `./gradlew test`.

Schema rules call for `TEXT` rather than `VARCHAR`, forbid foreign key constraints, and require queries to exclude soft-deleted records. Tables need timestamp fields, partial indexes, and an `updated_at` trigger; Kotlin table objects extend `UUIDTable`, while entities implement `Entity<Instant>`. Repository writes go through `db.primary` and reads through `db.replica`.

Deletion is soft-only: records are marked through `deletedAt`, so a hard-delete implementation would conflict with the skill's rules. Kotlin templates and examples are referenced in `kotlin-templates.md` and `examples.md`.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add c0x12c/ai-toolkit --skill database-table-creator -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/database-table-creator/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/database-table-creator/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add c0x12c/ai-toolkit --skill database-table-creator -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/database-table-creator/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add c0x12c/ai-toolkit --skill database-table-creator -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/database-table-creator/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install c0x12c/ai-toolkit database-table-creator
```

2. **Manually: put the files in place**
- File: `.github/skills/database-table-creator/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add c0x12c/ai-toolkit --skill database-table-creator -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/c0x12c/ai-toolkit --path toolkit/skills/database-table-creator
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/database-table-creator/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add c0x12c/ai-toolkit --skill database-table-creator -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/c0x12c/ai-toolkit/tree/HEAD/toolkit/skills/database-table-creator/SKILL.md

## When to use it
- create a SQL migration for a new table
- map an Exposed table to a Kotlin entity
- add a repository that supports soft deletion
- register a factory bean
- test repository behavior

## Example prompts
- Add an `orders` table and build its migration, Kotlin code, and tests.
- Create a `Customer` entity with a repository that follows the project's soft-delete rules.
- Set up the Exposed table, factory bean, and repository tests for a new table.

## Similar
- [xlsx](https://affpapa.org/en/nevibecode/skills/xlsx.md) — skill · 187223 installs
- [google-agents-cli-observability](https://affpapa.org/en/nevibecode/skills/google-agents-cli-observability.md) — skill · 511300 installs
- [caveman-evidence-review](https://affpapa.org/en/nevibecode/skills/caveman-evidence-review.md) — skill · 104500 installs
- [migration](https://affpapa.org/en/nevibecode/skills/migration.md) — skill · 103900 installs
- [performance-optimization](https://affpapa.org/en/nevibecode/skills/performance-optimization.md) — skill · 65200 installs
- [supabase](https://affpapa.org/en/nevibecode/skills/supabase.md) — skill · 8 installs

From the same set: [c0x12c/ai-toolkit](https://affpapa.org/en/nevibecode/by/c0x12c/ai-toolkit.md) — 24 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
