Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
prisma avatar

Prisma Client Api Relations

  • 14 installs
  • 8 repo stars
  • Updated February 9, 2026
  • prisma/cursor-plugin

prisma-client-api-relations covers Prisma relation queries and nested writes.

About

The prisma-client-api-relations skill documents relation reads and writes in Prisma Client. include and select load nested posts, comments, and profiles with filters, ordering, and take limits. Nested create, connect, connectOrCreate, update, updateMany, upsert, disconnect, delete, deleteMany, and set replace relation graphs atomically where supported. Relation filters some, every, none, is, and isNot power findMany parent queries. _count selects tally related rows with optional where on counted relations. Examples walk from simple author connect shorthand via authorId through deep comment author includes to bulk unpublished post deleteMany. include and select load nested relation graphs. Nested writes create, connect, and update related rows. disconnect, delete, and set manage relation membership. Relation filters some, every, and none in where. _count tallies related records with optional filters. Relation loads and nested mutations matching schema graph.

  • include and select load nested relation graphs.
  • Nested writes create, connect, and update related rows.
  • disconnect, delete, and set manage relation membership.
  • Relation filters some, every, and none in where.
  • _count tallies related records with optional filters.

Prisma Client Api Relations by the numbers

  • 14 all-time installs (skills.sh)
  • Ranked #604 of 911 Databases skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
At a glance

prisma-client-api-relations capabilities & compatibility

Capabilities
nested write operation matrix · filtered include examples · relation filter reference
Use cases
database · api development
From the docs

What prisma-client-api-relations says it does

Load related records
SKILL.md
connectOrCreate
SKILL.md
npx skills add https://github.com/prisma/cursor-plugin --skill prisma-client-api-relations

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs14
repo stars8
Last updatedFebruary 9, 2026
Repositoryprisma/cursor-plugin

How do I query and update related Prisma records?

Query and mutate related records with include, nested writes, connect, and relation filters.

Who is it for?

Developers implementing relational CRUD beyond flat models.

Skip if: Skip for single-table apps without relations.

When should I use this skill?

User works with include, connect, or relation filters.

What you get

Relation loads and nested mutations matching schema graph.

Files

SKILL.mdMarkdownGitHub ↗

Relation Queries

Query and modify related records.

Include Relations

Load related records:

const user = await prisma.user.findUnique({
  where: { id: 1 },
  include: {
    posts: true,
    profile: true
  }
})

Filtered include

const user = await prisma.user.findUnique({
  where: { id: 1 },
  include: {
    posts: {
      where: { published: true },
      orderBy: { createdAt: 'desc' },
      take: 5,
      select: { id: true, title: true }
    }
  }
})

Nested include

const user = await prisma.user.findUnique({
  where: { id: 1 },
  include: {
    posts: {
      include: {
        comments: {
          include: { author: true }
        }
      }
    }
  }
})

Select Relations

const user = await prisma.user.findUnique({
  where: { id: 1 },
  select: {
    name: true,
    posts: {
      select: { title: true }
    }
  }
})

Nested Writes

Create with relations

const user = await prisma.user.create({
  data: {
    email: 'alice@prisma.io',
    posts: {
      create: [
        { title: 'Post 1' },
        { title: 'Post 2' }
      ]
    },
    profile: {
      create: { bio: 'Hello!' }
    }
  }
})

Create or connect

const post = await prisma.post.create({
  data: {
    title: 'New Post',
    author: {
      connectOrCreate: {
        where: { email: 'alice@prisma.io' },
        create: { email: 'alice@prisma.io', name: 'Alice' }
      }
    }
  }
})

Connect existing

const post = await prisma.post.create({
  data: {
    title: 'New Post',
    author: {
      connect: { id: 1 }
    }
  }
})

// Shorthand for foreign key
const post = await prisma.post.create({
  data: {
    title: 'New Post',
    authorId: 1
  }
})

Update Relations

Update related records

const user = await prisma.user.update({
  where: { id: 1 },
  data: {
    posts: {
      update: {
        where: { id: 1 },
        data: { title: 'Updated Title' }
      }
    }
  }
})

Update many related

const user = await prisma.user.update({
  where: { id: 1 },
  data: {
    posts: {
      updateMany: {
        where: { published: false },
        data: { published: true }
      }
    }
  }
})

Upsert related

const user = await prisma.user.update({
  where: { id: 1 },
  data: {
    profile: {
      upsert: {
        create: { bio: 'New bio' },
        update: { bio: 'Updated bio' }
      }
    }
  }
})

Disconnect

// 1-to-1 optional
const user = await prisma.user.update({
  where: { id: 1 },
  data: {
    profile: { disconnect: true }
  }
})

// Many-to-many
const post = await prisma.post.update({
  where: { id: 1 },
  data: {
    tags: {
      disconnect: [{ id: 1 }, { id: 2 }]
    }
  }
})

Delete related

const user = await prisma.user.update({
  where: { id: 1 },
  data: {
    posts: {
      delete: { id: 1 }
    }
  }
})

// Delete many
const user = await prisma.user.update({
  where: { id: 1 },
  data: {
    posts: {
      deleteMany: { published: false }
    }
  }
})

Set (replace all)

// Replace all related records
const post = await prisma.post.update({
  where: { id: 1 },
  data: {
    tags: {
      set: [{ id: 1 }, { id: 2 }]
    }
  }
})

Relation Filters

some

At least one matches:

const users = await prisma.user.findMany({
  where: {
    posts: { some: { published: true } }
  }
})

every

All match:

const users = await prisma.user.findMany({
  where: {
    posts: { every: { published: true } }
  }
})

none

None match:

const users = await prisma.user.findMany({
  where: {
    posts: { none: { published: true } }
  }
})

is / isNot (1-to-1)

const users = await prisma.user.findMany({
  where: {
    profile: { is: { country: 'USA' } }
  }
})

Count Relations

const users = await prisma.user.findMany({
  select: {
    name: true,
    _count: {
      select: { posts: true, followers: true }
    }
  }
})
// { name: 'Alice', _count: { posts: 5, followers: 100 } }

Filter counted relations

const users = await prisma.user.findMany({
  select: {
    name: true,
    _count: {
      select: {
        posts: { where: { published: true } }
      }
    }
  }
})

Related skills

FAQ

What does prisma-client-api-relations do?

prisma-client-api-relations covers Prisma relation queries and nested writes.

When should I use prisma-client-api-relations?

User works with include, connect, or relation filters.

Is this skill safe to install?

Review the Security Audits panel on this page before installing in production.

Databasesdatabases

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.