Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/blog/content/blog/agents-md-for-databases/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ Here is the full section, ready to paste into your AGENTS.md:
- When a task needs a database for testing or prototyping, run
`npx create-db@latest --json` and use the `connectionString` field as
`DATABASE_URL` for that task. The database is temporary and deletes
itself after 24 hours. If the work should be kept, show me the `claimUrl`.
itself after 24 hours unless claimed. Always show me the `claimUrl`
and `deletionDate`.
- Never run `prisma migrate reset`, drop a schema or table, or delete
data without my explicit confirmation. The only exception is a
throwaway database you provisioned for the current task; even there,
Expand Down
4 changes: 2 additions & 2 deletions apps/blog/content/blog/give-your-agent-a-database/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ The agent's loop is three steps:

1. Run `npx create-db@latest --json` and parse the output.
2. Set `DATABASE_URL` to `connectionString` and run migrations, seeds, and tests against it.
3. When the task ends, do nothing. The database deletes itself at `deletionDate`. If the work should be kept, surface `claimUrl` to the human.
3. When the task ends, show the human `claimUrl` and `deletionDate`, then do nothing else. The database deletes itself at `deletionDate` unless the human claims it.

You can pin a region with `--region` (`ap-southeast-1`, `ap-northeast-1`, `eu-central-1`, `eu-west-3`, `us-east-1`, or `us-west-1`) or pick one interactively with `-i`. The [create-db docs](https://www.prisma.io/docs/postgres/npx-create-db) list every flag.

Expand Down Expand Up @@ -132,7 +132,7 @@ When you need a database for testing or prototyping, run:

Parse the JSON output and use `connectionString` as `DATABASE_URL`.
The database is temporary and deletes itself after 24 hours.
If the work should be kept, show me the `claimUrl` so I can claim the database.
Always show me the `claimUrl` and `deletionDate` so I can claim the database before it is deleted.
```

If your agent speaks MCP, the [Prisma MCP server](https://www.prisma.io/docs/ai/tools/mcp-server) goes further: it can provision databases, run SQL, introspect schemas, and [search the Prisma docs](/search-prisma-docs-from-your-coding-agent) through one endpoint. `create-db` is the zero-config entry point; the MCP server is the full toolbox.
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/ai/prompts/astro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default prisma
5. You MUST wrap all database calls in try-catch blocks
6. You MUST import from `'../generated/prisma/client'` (not `'@prisma/client'`)
7. You MUST use `import.meta.env.DATABASE_URL` in Astro (not `process.env`)
8. You MUST use `npx prisma init --output ../src/generated/prisma` before editing the Prisma schema. If you need Prisma Postgres, run `npx create-db` and update `.env` with the returned `postgres://...` value
8. You MUST use `npx prisma init --output ../src/generated/prisma` before editing the Prisma schema. If you need Prisma Postgres, run `npx create-db`, update `.env` with the returned `postgres://...` value, and give the user the claim URL and deletion time it prints (the database is deleted after 24 hours unless claimed). If the user runs `npx create-db` instead, remind them to open the claim URL and check the deletion time in its output

## CORRECT INSTALLATION

Expand Down
6 changes: 4 additions & 2 deletions apps/docs/content/docs/ai/prompts/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default prisma
10. You MUST create a test script at `scripts/test-database.ts` to verify setup
11. You MUST NOT include `url` in the datasource block of `schema.prisma`
12. You MUST NOT include `engine` property in `prisma.config.ts`
13. You MUST use `npx prisma init --output ../app/generated/prisma` to scaffold Prisma, then `npx create-db` to create a real cloud database
13. You MUST use `npx prisma init --output ../app/generated/prisma` to scaffold Prisma, then `npx create-db` to create a real cloud database, and give the user the claim URL and deletion time it prints (the database is deleted after 24 hours unless claimed)
14. You MUST use standard TCP URLs (`postgres://...`) in .env
15. You MUST NOT use `accelerateUrl` or `withAccelerate`

Expand Down Expand Up @@ -193,7 +193,7 @@ This step:
- Generates `.env` with a local `DATABASE_URL`
- Requires `npx create-db` if you want a real Prisma Postgres database

**IMPORTANT**: After `npx create-db`, replace the generated `DATABASE_URL` in `.env` with the returned `postgres://...` connection string.
**IMPORTANT**: After `npx create-db`, replace the generated `DATABASE_URL` in `.env` with the returned `postgres://...` connection string. If you ran `npx create-db` yourself, give the user the claim URL and deletion time it printed. If the user ran it, remind them to open the claim URL and check the deletion time in its output. The database is deleted after 24 hours unless they claim it with a free Prisma account.

```text
DATABASE_URL="postgres://..."
Expand Down Expand Up @@ -456,6 +456,8 @@ User should follow these steps (AI should provide these instructions):

**Do NOT invent this URL. Use the one returned by `npx create-db`.**

If you ran `npx create-db` yourself, give the user the claim URL and deletion time it printed. If the user ran it, remind them to open the claim URL and check the deletion time in its output. The database is deleted after 24 hours unless they claim it with a free Prisma account.

4. **Update `prisma/schema.prisma`** - Add the User model (generator and datasource are already configured):

```prisma
Expand Down
6 changes: 4 additions & 2 deletions apps/docs/content/docs/ai/prompts/nuxt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export { prisma }
10. You MUST create a test script at `scripts/test-database.ts` to verify setup
11. You MUST NOT include `url` in the datasource block of `schema.prisma`
12. You MUST NOT include `engine` property in `prisma.config.ts`
13. You MUST use `npx prisma init --output ./generated` to scaffold Prisma, then `npx create-db` to create a real cloud database
13. You MUST use `npx prisma init --output ./generated` to scaffold Prisma, then `npx create-db` to create a real cloud database, and give the user the claim URL and deletion time it prints (the database is deleted after 24 hours unless claimed)
14. You MUST use standard TCP URLs (`postgres://...`) in .env
15. You MUST NOT use `accelerateUrl` or `withAccelerate`
16. You MUST install `pg` and `@types/pg` as dependencies
Expand Down Expand Up @@ -199,7 +199,7 @@ This step:
- Generates `.env` with a local `DATABASE_URL`
- Requires `npx create-db` if you want a real Prisma Postgres database

**IMPORTANT**: After `npx create-db`, replace the generated `DATABASE_URL` in `.env` with the returned `postgres://...` connection string.
**IMPORTANT**: After `npx create-db`, replace the generated `DATABASE_URL` in `.env` with the returned `postgres://...` connection string. If you ran `npx create-db` yourself, give the user the claim URL and deletion time it printed. If the user ran it, remind them to open the claim URL and check the deletion time in its output. The database is deleted after 24 hours unless they claim it with a free Prisma account.

```text
DATABASE_URL="postgres://..."
Expand Down Expand Up @@ -468,6 +468,8 @@ User should follow these steps (AI should provide these instructions):

**Do NOT invent this URL. Use the one returned by `npx create-db`.**

If you ran `npx create-db` yourself, give the user the claim URL and deletion time it printed. If the user ran it, remind them to open the claim URL and check the deletion time in its output. The database is deleted after 24 hours unless they claim it with a free Prisma account.

5. **Update `prisma/schema.prisma`** — Add the User and Post models (generator and datasource are already configured):

```prisma
Expand Down
13 changes: 7 additions & 6 deletions apps/docs/content/docs/postgres/npx-create-db.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Once you have the output, take the connection string and add it to your `.env` f
DATABASE_URL="postgres://<username>:<password>@db.prisma.io:5432/postgres?sslmode=require"
```

If you don't have a `.env` file yet, you can skip the copy step by creating the database with `npx create-db@latest --env .env` instead. This creates the file with `DATABASE_URL` and `CLAIM_URL` and prints only a confirmation, so the claim URL is in `CLAIM_URL` rather than in the terminal. On a file that already exists, `--env` appends both lines without removing an existing `DATABASE_URL`, so delete the old line yourself.
If you don't have a `.env` file yet, you can skip the copy step by creating the database with `npx create-db@latest --env .env` instead. This creates the file with `DATABASE_URL` and `CLAIM_URL`, then prints a confirmation and the claim URL with its deletion time. On a file that already exists, `--env` appends both lines without removing an existing `DATABASE_URL`, so delete the old line yourself.

You can now follow the [Prisma Postgres quickstart guide](/v7/prisma-orm/quickstart/prisma-postgres) to connect your Prisma project to this database.

Expand All @@ -140,7 +140,8 @@ npx create-db@latest --json
"deletionDate": "2026-10-13T08:44:59.650Z",
"region": "eu-west-3",
"name": "2026-10-12T08:44:55.985Z",
"projectId": "proj_..."
"projectId": "proj_...",
"nextStep": "The database is deleted at 2026-10-13T08:44:59.650Z unless the user claims it, which keeps it for free. Give the user this claim URL: https://create-db.prisma.io/claim?projectID=proj_...&utm_source=create-db&utm_medium=cli"
}
```

Expand All @@ -161,7 +162,7 @@ npx create-db@latest --json --ttl 1h
When an agent creates databases:

- Create one database per task, not one per test run. Database creation is rate-limited per IP address.
- When the work should be kept, show the human the `claimUrl`. Claiming needs a Prisma account, so a person has to do it.
- Show the human the claim URL and the deletion time every time. The database is deleted unless someone claims it, and claiming needs a Prisma account, so a person has to do it. `--json` returns them as `claimUrl` and `deletionDate`, with a `nextStep` that says the same; `--env` and `--quiet` print them in a claim line (`--quiet` on stderr).
- Treat the database as disposable until it is claimed: it is deleted when its time to live runs out.

To make this the agent's default, add a short block to your project's `AGENTS.md`:
Expand All @@ -171,7 +172,7 @@ To make this the agent's default, add a short block to your project's `AGENTS.md

- For a task that needs a scratch database, run `npx create-db@latest --json` and use `connectionString` as `DATABASE_URL` for that task only, never in the shared `.env`.
- Create one database per task. It is deleted after 24 hours unless claimed.
- If the work should be kept, show me the `claimUrl`. Claiming needs my Prisma account.
- Every time you create one, show me the `claimUrl` and when it is deleted. Claiming needs my Prisma account.
```

Claude Code doesn't always read `AGENTS.md`, for example when your project also has a `CLAUDE.md`. Add the line `@AGENTS.md` to a `CLAUDE.md` next to your `AGENTS.md` so Claude Code imports these rules.
Expand Down Expand Up @@ -218,10 +219,10 @@ Here are the CLI flags for the `npx create-db` command:
| `--region <region>` | `-r` | AWS region for the database. <br /> **Available regions:** `ap-southeast-1`, `ap-northeast-1`, `eu-central-1`, `eu-west-3`, `us-east-1`, `us-west-1`. Without it, `create-db` picks the region closest to you (fallback `us-east-1`). |
| `--interactive` | `-i` | Run in interactive mode to select a region. |
| `--json` | `-j` | Output machine-readable JSON. |
| `--env <file>` | `-e` | Write `DATABASE_URL` and `CLAIM_URL` to the specified `.env` file. If the file exists, the two lines are appended. |
| `--env <file>` | `-e` | Write `DATABASE_URL` and `CLAIM_URL` to the specified `.env` file and print the claim URL and deletion time. If the file exists, the two lines are appended. |
| `--ttl <duration>` | `-t` | Auto-delete after `30m`, or `1h` to `24h`. The default and maximum is `24h`. |
| `--copy` | `-c` | Copy the connection string to your clipboard. |
| `--quiet` | `-q` | Only output the connection string. |
| `--quiet` | `-q` | Only output the connection string on stdout. The claim URL and deletion time go to stderr. |
| `--open` | `-o` | Open the claim URL in your browser. |
| `--help` | `-h` | Display help for the command. |

Expand Down
Loading