prisma-postgres-setup

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

Updated Aug 1, 2026
One-click install
npx skills add https://github.com/jpmartirez/kilatis --skill prisma-postgres-setup-jpmartirez
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-postgres-setup
Source: https://github.com/jpmartirez/kilatis/tree/main/frontend/.windsurf/skills/prisma-postgres-setup
Command: npx skills add https://github.com/jpmartirez/kilatis --skill prisma-postgres-setup-jpmartirez

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 your project, and configuring Prisma 7's new client adapter pattern. This Skill automates that entire workflow so you get a working, verified database connection without reading API docs. ## Core Features & Use Cases - API-driven provisioning: Authenticates with a service token, lists available regions, creates a project with a database, and polls until the database status is ready. - Local project configuration: Installs required packages (prisma, @prisma/client, @prisma/adapter-pg, pg, dotenv), writes the direct connection string to .env, and configures prisma.config.ts for Prisma 7. - Schema and migration setup: Offers a starter schema or generates one from a natural-language description, then runs prisma migrate dev to create migration history. - End-to-end verification: Runs a test-connection script using the PrismaPg adapter to confirm the database works before finishing. - Use Case: You just scaffolded a new Next.js app and need a hosted Postgres database. Ask the agent to set up Prisma Postgres, pick a region from the interactive menu, and receive a verified DATABASE_URL plus a migrated schema in minutes. ## Quick Start Ask the agent to set up a new Prisma Postgres database for this project and connect it locally using your 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?

Create a service token in Prisma Console under Workspace Settings, then call the Management API to create a project with createDatabase set to true. Extract the direct connection string from the response and store it as DATABASE_URL in your .env file.

How do I get a Prisma Postgres connection string?

Create a project via POST /v1/projects with createDatabase enabled, 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?

Prisma 7 requires a driver adapter: create a pg.Pool with your DATABASE_URL, wrap it in PrismaPg from @prisma/adapter-pg, and pass { adapter } to the PrismaClient constructor. Calling new PrismaClient() with no arguments throws an error.

Why does my Prisma Postgres API request return a 401 error?

A 401 authentication-failed response means your service token is invalid or expired. Create a new token in Prisma Console under Workspace Settings, Service Tokens, and set it as the PRISMA_SERVICE_TOKEN environment variable.

When should I use prisma migrate dev instead of prisma db push?

Use prisma migrate dev for normal setup because it creates migration history in prisma/migrations, which is required for CI/CD and production deployments via prisma migrate deploy. Only use db push for prototyping when you explicitly do not need migration history.

Can I use this workflow for CI/CD preview databases or multi-tenant apps?

No, this workflow covers one-time local project setup only. For CI/CD preview databases use a dedicated CI/CD provisioning approach, and for multi-tenant provisioning inside an application use an integrator flow with OAuth instead of service tokens.