idorgham/gateflow/database

Claude Code and agent skill by idorgham/gateflow

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Prisma schema, migrations, and query patterns for GateFlow. Use when creating/modifying models, writing queries, creating migrations, or debugging data issues.

Install

npx vskill@latest install idorgham/gateflow/database

SKILL.md

The same SKILL.md was published earlier as idorgham/gateflow/database.

GateFlow Database

Stack

  • DB: PostgreSQL 15+
  • ORM: Prisma 5.x
  • Schema: packages/db/prisma/schema.prisma
  • Migrations: packages/db/prisma/migrations/

Required Patterns

Multi-tenant (always)
typescript
where: {
organizationId: auth.orgId,
deletedAt: null,
}
Soft delete (always)
typescript
// Query: filter deleted
where: {
deletedAt: null;
}
// Delete: set deletedAt
await prisma.gate.update({
where: { id },
data: { deletedAt: new Date() },
});
New model checklist
  • organizationId + @@index([organizationId]) for tenant models
  • deletedAt DateTime? + @@index([deletedAt]) for mutable models
  • createdAt, updatedAt timestamps
  • @default(cuid()) for ids

Migration Workflow

bash
cd packages/db
npx prisma generate # After schema edit
npx prisma migrate dev --name add_field
npx prisma db push # Dev only, no migration
npx prisma studio

MCP: Prisma-Local

When Prisma-Local MCP is enabled, use its tools for:

  • migrate-dev — Create and apply migration (LLM provides migration name)
  • migrate-status — Check migration state
  • Prisma-Studio — Open Prisma Studio via prisma studio

Core Models

ModelPurpose
OrganizationMulti-tenant root
ProjectSub-grouping
UserAuth, RBAC
GateAccess points
QRCodeAccess codes (HMAC signed)
ScanLogImmutable audit trail (scanUuid dedup)
UnitResidential units (Phase 2)

Query Examples

Find many with org scope
typescript
const gates = await prisma.gate.findMany({
where: { organizationId: orgId, deletedAt: null },
include: { project: true },
orderBy: { createdAt: 'desc' },
});
Transaction
typescript
await prisma.$transaction(async (tx) => {
await tx.qRCode.update({
where: { id },
data: { scanCount: { increment: 1 } },
});
await tx.scanLog.create({ data: { ... } });
});
Aggregation
typescript
const stats = await prisma.scanLog.groupBy({
by: ['status'],
where: { organizationId: orgId, createdAt: { gte: start, lte: end } },
_count: true,
});

Performance

  • Use select for large result sets
  • createMany for bulk inserts
  • Add @@index on frequently queried fields
  • Connection pool in DATABASE_URL

Input Validation

Use Zod for API input; Prisma for DB constraints.

Reference: packages/db/prisma/schema.prisma, packages/db/prisma/seed.ts

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Grok Build (Cursor)
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/idorgham/gateflow/database/badge)](https://verified-skill.com/skills/idorgham/gateflow/database)

Something wrong with this skill or its page? Tell us.