Skip to content
Agentmart
Submit a tool

database-data-layer

Use when designing or implementing database schemas, data models, migrations, seeding, and query layers.

Skill by UgochukwuChidera

IndexedGPL-3.0
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/ugochukwuchidera-database-data-layer

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use when designing or implementing database schemas, data models, migrations, seeding, and query layers. Covers Prisma ORM, raw SQL patterns, migration strategies, seed data design, connection pooling, query optimization, and data layer testing. Use with Meta-Architect Stage 2 (domain modeling) outputs.

Use cases: design, backend, testing, data

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/database-data-layer

What's inside

Skill name
database-data-layer
Description
Use when designing or implementing database schemas, data models, migrations, seeding, and query layers. Covers Prisma ORM, raw SQL patterns, migration strategies, seed data design, connection pooling, query optimization, and data layer testing. Use with Meta-Architect Stage 2 (domain modeling) outputs.
License
GPL-3.0
Instructions
257 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Database / Data Layer

## Stack-First Principle

Choose your data layer based on the stack, then stick to the pattern:

| Stack | Primary ORM | Migration Tool | Notes |
|-------|-------------|----------------|-------|
| **Node/TypeScript** | Prisma | Prisma Migrate | Default for full-stack JS |
| **Node/TypeScript** | Drizzle | Drizzle Kit | Lighter than Prisma, SQL-like |
| **Python** | SQLAlchemy | Alembic | Mature, flexible |
| **Python** | Django ORM | Django migrations | Only if using Django |
| **Go** | GORM | golang-migrate | Most common Go ORM |
| **Go** | sqlx + sqlc | goose | More SQL control |
| **Rust** | Diesel | Diesel CLI | Type-safe, compile-time checked |
| **Rust** | SQLx | sqlx migrate | Async, compile-time checked |

## Prisma Patterns (Default for Meta-Architect)

### Schema Design Rules

```
model User {
  id        String   @id @default(cuid())
  email     String   @unique
  name      String?
  role      Role     @default(USER)
  posts     Post[]
  profile   Profile?
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

enum Role {
  USER
  ADMIN
}
```

- **@id** — always use `cuid()` or `uuid()`, never auto-increment ints for distributed systems
- **@unique** — add for every natural key (email, slug, externalId)
- **Relations** — always explicit (both sides), never implicit
- **@default** — set sensible defaults, not null
- **@updatedAt** — on every entity that gets mutated
- **Optional vs Required** — `String?` is optional, `String` is required. Be intentional.

### Relation Patterns

```prisma
// One-to-one
model User { profile Profile? }
model Profile { user User @relation(fields: [userId], references: [id]); userId String @unique }

// One-to-many
model User { posts Post[] }
model Post { author User @relation(fields: [authorId], references: [id]); authorId String }

// Many-to-many
model Post { tags Tag[] @relation("PostTags") }
model Tag { posts Post[] @relation("PostTags") }
```

### Migration Workflow

```bash
# Initial setup
npx prisma migrate dev --name init

# Development (auto-deletes data — never in prod)
npx prisma migrate dev --name add_user_role

# Production-safe
npx prisma migrate deploy           # apply pending migrations
npx prisma migrate reset --force    # only for dev/test reset

# Check status
npx prisma migrate status
npx prisma migrate diff --from-empty --to-schema-datamodel schema.prisma
```

**Golden rules:**
- Never edit migration files manually. Create a new migration.
- `prisma migrate dev` is for development only — it resets data.
- `prisma migrate deploy` is for production — it never resets.
- Always review the generated SQL before deploying.

### Seed Data Patterns

```typescript
// prisma/seed.ts
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();

async function main() {
  // Upsert to make seeds idempotent
  const user = await prisma.user.upsert({
    where: { email: 'admin@example.com' },
    update: {},
    create: {
      email: 'admin@example.com',
      name: 'Admin',
      role: 'ADMIN',
    },
  });
  console.log('Seeded:', user);
}

main().catch(console.error).finally(() => prisma.$disconnect());
```

```json
// package.json
{ "prisma": { "seed": "tsx prisma/seed.ts" } }
```

```
npx prisma db seed
```

From UgochukwuChidera/Opencode-Agents, GPL-3.0.

More from UgochukwuChidera/Opencode-Agents

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Jun 22, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
GPL-3.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from UgochukwuChidera

Cite this page

database-data-layer skill. Agent Mart. https://agentmart.dev/skills/ugochukwuchidera-database-data-layer (last updated 2026-10-24)