Agent Skills: prisma-postgres

Prisma Postgres API for database. Use when user mentions "Prisma Postgres",

UncategorizedID: vm0-ai/vm0-skills/prisma-postgres

Install this agent skill to your local

pnpm dlx add-skill https://github.com/vm0-ai/vm0-skills/tree/HEAD/prisma-postgres

Skill Files

Browse the full folder contents for prisma-postgres.

Download Skill

Loading file tree…

prisma-postgres/SKILL.md

Skill Metadata

Name
prisma-postgres
Description
Prisma Postgres API for database. Use when user mentions "Prisma Postgres",

Troubleshooting

If requests fail, run zero doctor check-connector --env-name PRISMA_POSTGRES_TOKEN or zero doctor check-connector --url https://api.prisma.io/v1/projects --method GET

Core APIs

List Projects

curl -s "https://api.prisma.io/v1/projects" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" | jq '.[] | {id, name, createdAt}'

Docs: https://www.prisma.io/docs/postgres/introduction/management-api

Get Project Details

Replace <project-id> with the actual project ID:

curl -s "https://api.prisma.io/v1/projects/<project-id>" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" | jq '{id, name, createdAt}'

Create Project

Write to /tmp/prisma_request.json:

{
  "name": "my-project",
  "region": "us-east-1",
  "createDatabase": true
}
curl -s -X POST "https://api.prisma.io/v1/projects" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" --header "Content-Type: application/json" -d @/tmp/prisma_request.json | jq '{id, name, databases}'

Available regions can be listed with the regions endpoint below.

Update Project

Replace <project-id> with the actual project ID.

Write to /tmp/prisma_request.json:

{
  "name": "updated-project-name"
}
curl -s -X PATCH "https://api.prisma.io/v1/projects/<project-id>" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" --header "Content-Type: application/json" -d @/tmp/prisma_request.json | jq '{id, name}'

Delete Project

Replace <project-id> with the actual project ID:

curl -s -X DELETE "https://api.prisma.io/v1/projects/<project-id>" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" -w "\nHTTP Status: %{http_code}\n"

Returns HTTP 204 on success.

List Databases

List all databases, optionally filtered by project:

curl -s "https://api.prisma.io/v1/databases?projectId=<project-id>" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" | jq '.[] | {id, name, region, createdAt}'

Get Database Details

Replace <database-id> with the actual database ID:

curl -s "https://api.prisma.io/v1/databases/<database-id>" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" | jq '{id, name, region, connections}'

Create Database

Replace <project-id> with the actual project ID.

Write to /tmp/prisma_request.json:

{
  "name": "my-database",
  "region": "us-east-1"
}
curl -s -X POST "https://api.prisma.io/v1/projects/<project-id>/databases" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" --header "Content-Type: application/json" -d @/tmp/prisma_request.json | jq '{id, name, region, connections}'

Update Database

Replace <database-id> with the actual database ID.

Write to /tmp/prisma_request.json:

{
  "name": "renamed-database"
}
curl -s -X PATCH "https://api.prisma.io/v1/databases/<database-id>" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" --header "Content-Type: application/json" -d @/tmp/prisma_request.json | jq '{id, name}'

Delete Database

Replace <database-id> with the actual database ID (cannot delete default databases):

curl -s -X DELETE "https://api.prisma.io/v1/databases/<database-id>" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" -w "\nHTTP Status: %{http_code}\n"

Returns HTTP 204 on success.

List Connections

List all connections for a specific database. Replace <database-id>:

curl -s "https://api.prisma.io/v1/databases/<database-id>/connections" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" | jq '.[] | {id, name, endpoints}'

Create Connection

Create a new connection string for a database. Replace <database-id>:

curl -s -X POST "https://api.prisma.io/v1/databases/<database-id>/connections" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" --header "Content-Type: application/json" -d '{"name": "my-connection"}' | jq '{id, name, endpoints}'

The response includes connection strings for direct, pooled, and accelerate endpoints.

Delete Connection

Replace <connection-id> with the actual connection ID:

curl -s -X DELETE "https://api.prisma.io/v1/connections/<connection-id>" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" -w "\nHTTP Status: %{http_code}\n"

Returns HTTP 204 on success.

List Database Backups

Replace <database-id> with the actual database ID:

curl -s "https://api.prisma.io/v1/databases/<database-id>/backups?limit=10" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" | jq '.[] | {id, createdAt}'

Restore Database from Backup

Replace <target-database-id> with the database to restore into.

Write to /tmp/prisma_request.json:

{
  "source": {
    "type": "backup",
    "databaseId": "<source-database-id>",
    "backupId": "<backup-id>"
  }
}
curl -s -X POST "https://api.prisma.io/v1/databases/<target-database-id>/restore" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" --header "Content-Type: application/json" -d @/tmp/prisma_request.json | jq '{id, name, status}'

Cannot restore to default databases.

Get Database Usage Metrics

Replace <database-id> with the actual database ID:

curl -s "https://api.prisma.io/v1/databases/<database-id>/usage?startDate=2025-01-01T00:00:00Z&endDate=2025-01-31T23:59:59Z" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" | jq .

Returns operations (ops) and storage (GiB) metrics for the specified period.

List Available Regions

curl -s "https://api.prisma.io/v1/regions/postgres" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" | jq '.[] | {id, displayName, status}'

List Workspaces

curl -s "https://api.prisma.io/v1/workspaces" --header "Authorization: Bearer $PRISMA_POSTGRES_TOKEN" | jq '.[] | {id, name}'

Guidelines

  1. Default database: Projects created with createDatabase: true include a default database that cannot be deleted
  2. Regions: Choose the region closest to your application; databases cannot be moved after creation
  3. Connection types: Each database connection provides direct, pooled, and accelerate endpoints for different use cases
  4. Backups: Remote database backups are not supported; use the restore endpoint to restore from existing backups
  5. Pagination: List endpoints support cursor and limit query parameters for pagination (default limit: 100)
  6. Rate limits: API rate limits apply; if you receive HTTP 429, implement exponential backoff