Skip to content
Back to skills

Prisma7

ASecurity

Patrones de Prisma 7 para schema, migraciones y queries. Usa cuando trabajes con modelos de datos, consultas a la DB, o migraciones.

  • 2 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 9, 2026
databasestypescriptsqldatabase

Works with

  • cli

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add ramiroquesada/PROSEGUIT --skill prisma7 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Prisma7?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Prisma7
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ramiroquesada-prisma7/badge)](https://www.skillsdirectory.com/skills/ramiroquesada-prisma7)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: prisma7
description: Patrones de Prisma 7 para schema, migraciones y queries. Usa cuando trabajes con modelos de datos, consultas a la DB, o migraciones.
---

# Prisma 7 - Patrones PROSEGUIT

Cuando trabajes con la base de datos de PROSEGUIT, usa Prisma 7:

## Schema patterns
```prisma
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model Equipo {
  id            Int            @id @default(autoincrement())
  serie         Int            @unique
  modelo        String?        @db.VarChar(100)
  tipoEquipo    TipoEquipo     @relation(fields: [tipoEquipoId], references: [id])
  tipoEquipoId  Int
  oficina       Oficina        @relation(fields: [oficinaId], references: [id])
  oficinaId     Int
  estado        EstadoEquipo   @default(ACTIVO)
  historial     Historial[]
  createdAt     DateTime       @default(now())
  updatedAt     DateTime       @updatedAt

  @@map("equipo")
}

enum EstadoEquipo {
  ACTIVO
  EN_REPARACION
  DADO_DE_BAJA
  EN_DEPOSITO
  PRESTADO
  EN_SERVICIO_EXTERNO

  @@map("estado_equipo")
}
```

## Query patterns
```typescript
// Buscar con relaciones incluidas
const equipo = await prisma.equipo.findUnique({
  where: { id },
  include: {
    tipoEquipo: true,
    oficina: { include: { seccion: { include: { ciudad: true } } } },
    historial: { orderBy: { fecha: 'desc' }, take: 20 }
  }
});

// Listado con filtros y paginacion
const equipos = await prisma.equipo.findMany({
  where: {
    ...(tipo && { tipoEquipoId: tipo }),
    ...(estado && { estado }),
    ...(search && {
      OR: [
        { modelo: { contains: search, mode: 'insensitive' } },
        { observacion: { contains: search, mode: 'insensitive' } }
      ]
    })
  },
  skip: (page - 1) * limit,
  take: limit,
  orderBy: { serie: 'desc' }
});

// Transaccion para acciones atomicas
await prisma.$transaction(async (tx) => {
  await tx.equipo.update({ where: { id }, data: { estado: 'EN_REPARACION', oficinaId: soporteId } });
  await tx.historial.create({ data: { equipoId: id, accion: 'ENVIO_SOPORTE', motivo, usuarioId } });
});
```

## Reglas
- Siempre usar transacciones cuando una accion modifica mas de una tabla
- Usar `include` para relaciones, no queries separadas
- Mapear modelos a nombres de tabla en espaniol con `@@map`
- Usar enums para valores fijos (estados, roles, tipos de accion)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in databases →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.