Skip to content

NarixHine/uni-chem / .agents/skills/prisma-postgres-setup

prisma-postgres-setup

Verified

Set up a new Prisma Postgres database and connect it to a local project using the Management API. Use when asked to "set up a database", "create a Prisma Postgres project", "get a connection string", "connect my app to Prisma Postgres", or "provision a database".

FileKindSize
SKILL.mdskill md11.0 KB
references/api-basics.mdmarkdown3.0 KB
references/auth.mdmarkdown1.5 KB
references/endpoints.mdmarkdown5.7 KB
references/prisma7-client.mdmarkdown3.0 KB

references/endpoints.md

View on GitHub
# endpoints

Management API endpoint details for database setup workflows.

## List regions

```
GET /v1/regions/postgres
```

No request body. Returns available Prisma Postgres regions.

**Response:**

```json
{
    "data": [
        {
            "id": "us-east-1",
            "type": "region",
            "name": "US East (N. Virginia)",
            "status": "available"
        },
        {
            "id": "eu-west-1",
            "type": "region",
            "name": "EU West (Ireland)",
            "status": "available"
        }
    ]
}
```

Only use regions where `status` is `available`.

## Create project (with database)

```
POST /v1/projects
```

**Request body:**

```json
{
    "name": "my-project",
    "region": "us-east-1",
    "createDatabase": true
}
```

| Field            | Type    | Required | Default        | Description                                |
| ---------------- | ------- | -------- | -------------- | ------------------------------------------ |
| `name`           | string  | No       | Auto-generated | Project display name                       |
| `region`         | string  | No       | `us-east-1`    | Region for the database                    |
| `createDatabase` | boolean | No       | `true`         | Create a default database with the project |

**Response** (with `createDatabase: true`):

```json
{
    "data": {
        "id": "proj_clx7abc123",
        "type": "project",
        "url": "https://api.prisma.io/v1/projects/proj_clx7abc123",
        "name": "my-project",
        "createdAt": "2025-06-15T10:30:00.000Z",
        "defaultRegion": "us-east-1",
        "workspace": {
            "id": "wksp_xyz789",
            "url": "https://api.prisma.io/v1/workspaces/wksp_xyz789",
            "name": "My Workspace"
        },
        "database": {
            "id": "db_def456",
            "type": "database",
            "url": "https://api.prisma.io/v1/databases/db_def456",
            "name": "my-project",
            "status": "ready",
            "createdAt": "2025-06-15T10:30:00.000Z",
            "isDefault": true,
            "defaultConnectionId": "con_ghi789",
            "connections": [
                {
                    "id": "con_ghi789",
                    "type": "connection",
                    "url": "https://api.prisma.io/v1/connections/con_ghi789",
                    "name": "Default",
                    "createdAt": "2025-06-15T10:30:00.000Z",
                    "kind": "postgres",
                    "endpoints": {
                        "direct": {
                            "host": "db.prisma.io",
                            "port": 5432,
                            "connectionString": "postgres://user:pass@db.prisma.io:5432/postgres?sslmode=require"
                        }
                    }
                }
            ],
            "region": {
                "id": "us-east-1",
                "name": "US East (N. Virginia)"
            }
        }
    }
}
```

Key field to extract:

- `data.database.connections[0].endpoints.direct.connectionString` → use as `DATABASE_URL`

The response also includes `pooled` and `accelerate` endpoints — ignore these for new projects. The direct connection string is all you need.

If `data.database.status` is `provisioning`, poll `GET /v1/databases/{id}` until `status` is `ready`.

## Get database

```
GET /v1/databases/{databaseId}
```

Use to check database status after creation or to retrieve database details.

**Response:**

```json
{
    "data": {
        "id": "db_def456",
        "type": "database",
        "url": "https://api.prisma.io/v1/databases/db_def456",
        "name": "my-project",
        "status": "ready",
        "createdAt": "2025-06-15T10:30:00.000Z",
        "isDefault": true,
        "defaultConnectionId": "con_ghi789",
        "connections": [],
        "project": {
            "id": "proj_clx7abc123",
            "url": "https://api.prisma.io/v1/projects/proj_clx7abc123",
            "name": "my-project"
        },
        "region": {
            "id": "us-east-1",
            "name": "US East (N. Virginia)"
        }
    }
}
```

## Create connection

```
POST /v1/databases/{databaseId}/connections
```

Creates a new named connection string for a database. Use for per-developer or per-environment connections.

**Request body:**

```json
{
    "name": "dev"
}
```

| Field  | Type   | Required | Description                     |
| ------ | ------ | -------- | ------------------------------- |
| `name` | string | Yes      | Display name for the connection |

**Response:**

```json
{
    "data": {
        "id": "con_newcon123",
        "type": "connection",
        "url": "https://api.prisma.io/v1/connections/con_newcon123",
        "name": "dev",
        "createdAt": "2025-06-15T10:31:00.000Z",
        "kind": "postgres",
        "endpoints": {
            "direct": {
                "host": "db.prisma.io",
                "port": 5432,
                "connectionString": "postgres://user:pass@db.prisma.io:5432/postgres?sslmode=require"
            }
        },
        "database": {
            "id": "db_def456",
            "url": "https://api.prisma.io/v1/databases/db_def456",
            "name": "my-project"
        }
    }
}
```

Extract: `data.endpoints.direct.connectionString` → use as `DATABASE_URL`.

## Delete database

```
DELETE /v1/databases/{databaseId}
```

Permanently deletes a database and all its connections. Returns `204 No Content` on success.

## List projects

```
GET /v1/projects
```

Returns all projects in the workspace. Supports cursor-based pagination (`?cursor=...&limit=...`).

## Delete project

```
DELETE /v1/projects/{projectId}
```

Permanently deletes a project and all its databases. Returns `204 No Content` on success.
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall