prisma-postgres-setup

Provisions a Prisma Postgres database via the Management API and connects it to a local project.

Updated Aug 9, 2026
One-click install
npx skills add https://github.com/singhaditya73/Naviq --skill prisma-postgres-setup-singhaditya73
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-postgres-setup
Source: https://github.com/singhaditya73/Naviq/tree/main/packages/db/.agents/skills/prisma-postgres-setup
Command: npx skills add https://github.com/singhaditya73/Naviq --skill prisma-postgres-setup-singhaditya73

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires prisma, @prisma/client, @prisma/adapter-pg, pg, dotenv, and includes references (resource) components.

What problem does it solve? Setting up a new Prisma Postgres database involves multiple manual steps: creating a service token, choosing a region, provisioning a project through the Management API, wiring the connection string into a local project, and configuring Prisma 7's new client instantiation pattern. This Skill automates that entire workflow end-to-end. ## Core Features & Use Cases - API-driven provisioning: Authenticates with a service token, lists available regions, creates a project with a database, and extracts the direct connection string from the Management API. - Local project configuration: Installs required packages (prisma, @prisma/client, @prisma/adapter-pg, pg, dotenv), writes DATABASE_URL to .env, and sets up prisma.config.ts following Prisma 7 conventions. - Schema and verification workflow: Offers starter schema options, runs prisma migrate dev, and verifies the connection with a test script using the PrismaPg driver adapter. - Use Case: A developer starting a new Next.js app asks to "set up a database" — the Skill provisions a Prisma Postgres instance in their chosen region, configures the project, and confirms connectivity in minutes. ## Quick Start Set up a new Prisma Postgres database for this project and connect it locally using my workspace service token.

Frequently Asked Questions about prisma-postgres-setup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a Prisma Postgres database from the command line?

Use the Prisma Management API with a workspace service token: list available regions, POST to /v1/projects with createDatabase set to true, then extract the direct connection string from the response. Write it to .env as DATABASE_URL and configure prisma.config.ts.

How do I get a Prisma Postgres connection string?

Create a project via POST /v1/projects with createDatabase: true, then read data.database.connections[0].endpoints.direct.connectionString from the response. Use the direct endpoint, not the pooled or Accelerate endpoints.

How do I instantiate PrismaClient in Prisma 7?

Create a pg.Pool with your DATABASE_URL, wrap it in a PrismaPg adapter from @prisma/adapter-pg, and pass { adapter } to the PrismaClient constructor. Import the client from ./generated/prisma/client.js and ensure package.json has "type": "module".

Why does new PrismaClient() throw an error in Prisma 7?

Prisma 7 requires a driver adapter, so calling new PrismaClient() with no arguments throws. The datasourceUrl option no longer exists either. Pass { adapter } with a PrismaPg adapter wrapping a pg.Pool instead.

What should I do when Prisma Management API returns a 401 error?

A 401 authentication-failed error means the service token is invalid or expired. Create a new token in Prisma Console under Workspace Settings → Service Tokens, then retry the request with the new token in the Authorization header.

When should I not use this database setup workflow?

Do not use it for CI/CD preview databases (use prisma-postgres-cicd), multi-tenant provisioning inside an app (use prisma-postgres-integrator), or schema and migration work on an already-connected database, which is standard Prisma CLI territory.