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/api-basics.md

View on GitHub
# api-basics

Core conventions for the Prisma Management API. All three `prisma-postgres-*` skills share these patterns.

## Base URL

```
https://api.prisma.io/v1
```

API documentation: https://api.prisma.io/v1/doc

## Response Envelope

### Single resource

```json
{
    "data": {
        "id": "proj_clx7abc123def456",
        "type": "project",
        "name": "My Project",
        "createdAt": "2025-06-15T10:30:00.000Z"
    }
}
```

### Collection

```json
{
    "data": [
        { "id": "proj_aaa", "type": "project", "name": "Alpha" },
        { "id": "proj_bbb", "type": "project", "name": "Beta" }
    ],
    "pagination": {
        "hasMore": true,
        "nextCursor": "clx7cursor123"
    }
}
```

## Resource ID Prefixes

Every resource ID carries a type prefix:

| Prefix  | Resource   |
| ------- | ---------- |
| `proj_` | Project    |
| `db_`   | Database   |
| `con_`  | Connection |
| `wksp_` | Workspace  |

Always include the prefix when sending IDs in API requests.

## Pagination

Collection endpoints use cursor-based pagination:

```
GET /v1/projects?limit=10
GET /v1/projects?cursor=clx7abc123&limit=10
```

| Parameter | Type   | Default | Description                     |
| --------- | ------ | ------- | ------------------------------- |
| `cursor`  | string | —       | Opaque cursor from `nextCursor` |
| `limit`   | number | 100     | Maximum items per page          |

Continue fetching while `pagination.hasMore` is `true`, using `pagination.nextCursor` as the `cursor` parameter.

## Error Responses

All errors follow this shape:

```json
{
    "error": {
        "code": "resource-not-found",
        "message": "database with id db_abc not found"
    }
}
```

### Error codes by HTTP status

| HTTP Status | Error Code              | Meaning                                      |
| ----------- | ----------------------- | -------------------------------------------- |
| 400         | `client-error`          | Malformed request                            |
| 401         | `authentication-failed` | Missing or invalid token                     |
| 403         | `permission-denied`     | Token lacks required access                  |
| 404         | `resource-not-found`    | Resource does not exist or is not accessible |
| 422         | `validation-error`      | Request body failed validation               |
| 429         | `rate-limit-exceeded`   | Too many requests                            |
| 500         | `internal-server-error` | Server error — retry after a delay           |

### Self-correction patterns

- **401**: Token is invalid or expired. Create a new service token in Console → Workspace Settings → Service Tokens.
- **404**: Verify the resource ID includes the correct prefix (`proj_`, `db_`, `con_`). Use `GET /v1/projects` or `GET /v1/databases` to list available resources.
- **422**: Check the request body against the endpoint schema. Common issues: missing required fields, invalid region ID, empty `name`.
- **429**: Wait 2–5 seconds and retry. If repeated, increase the backoff interval.
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