$npx -y skills add neondatabase/agent-skills --skill claimable-postgresProvision instant temporary Postgres databases via Claimable Postgres by Neon (neon.new) with no login, signup, or credit card. Supports REST API, CLI, and SDK. Use when users ask for a quick Postgres environment, a throwaway DATABASE_URL for prototyping/tests, or "just give me a
| 1 | # Claimable Postgres |
| 2 | |
| 3 | Instant Postgres databases for local development, demos, prototyping, and test environments. No account required. Databases expire after 72 hours unless claimed to a Neon account. |
| 4 | |
| 5 | ## Quick Start |
| 6 | |
| 7 | ```bash |
| 8 | curl -s -X POST "https://neon.new/api/v1/database" \ |
| 9 | -H "Content-Type: application/json" \ |
| 10 | -d '{"ref": "agent-skills"}' |
| 11 | ``` |
| 12 | |
| 13 | Parse `connection_string` and `claim_url` from the JSON response. Write `connection_string` to the project's `.env` as `DATABASE_URL`. |
| 14 | |
| 15 | For other methods (CLI, SDK, Vite plugin), see [Which Method?](#which-method) below. |
| 16 | |
| 17 | ## Which Method? |
| 18 | |
| 19 | - **REST API**: Returns structured JSON. No runtime dependency beyond `curl`. Preferred when the agent needs predictable output and error handling. |
| 20 | - **CLI** (`npx neon-new@latest --yes`): Provisions and writes `.env` in one command. Convenient when Node.js is available and the user wants a simple setup. |
| 21 | - **SDK** (`neon-new/sdk`): Scripts or programmatic provisioning in Node.js. |
| 22 | - **Vite plugin** (`vite-plugin-neon-new`): Auto-provisions on `vite dev` if `DATABASE_URL` is missing. Use when the user has a Vite project. |
| 23 | - **Browser**: User cannot run CLI or API. Direct to https://neon.new. |
| 24 | |
| 25 | ## REST API |
| 26 | |
| 27 | **Base URL:** `https://neon.new/api/v1` |
| 28 | |
| 29 | ### Create a database |
| 30 | |
| 31 | ```bash |
| 32 | curl -s -X POST "https://neon.new/api/v1/database" \ |
| 33 | -H "Content-Type: application/json" \ |
| 34 | -d '{"ref": "agent-skills"}' |
| 35 | ``` |
| 36 | |
| 37 | | Parameter | Required | Description | |
| 38 | | ---------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------- | |
| 39 | | `ref` | Yes | Tracking tag that identifies who provisioned the database. Use `"agent-skills"` when provisioning through this skill. | |
| 40 | | `enable_logical_replication` | No | Enable logical replication (default: false, cannot be disabled once enabled) | |
| 41 | |
| 42 | The `connection_string` returned by the API is a pooled connection URL. For a direct (non-pooled) connection (e.g. Prisma migrations), remove `-pooler` from the hostname. The CLI writes both pooled and direct URLs automatically. |
| 43 | |
| 44 | **Response:** |
| 45 | |
| 46 | ```json |
| 47 | { |
| 48 | "id": "019beb39-37fb-709d-87ac-7ad6198b89f7", |
| 49 | "status": "UNCLAIMED", |
| 50 | "neon_project_id": "gentle-scene-06438508", |
| 51 | "connection_string": "postgresql://...", |
| 52 | "claim_url": "https://neon.new/claim/019beb39-...", |
| 53 | "expires_at": "2026-01-26T14:19:14.580Z", |
| 54 | "created_at": "2026-01-23T14:19:14.580Z", |
| 55 | "updated_at": "2026-01-23T14:19:14.580Z" |
| 56 | } |
| 57 | ``` |
| 58 | |
| 59 | ### Check status |
| 60 | |
| 61 | ```bash |
| 62 | curl -s "https://neon.new/api/v1/database/{id}" |
| 63 | ``` |
| 64 | |
| 65 | Returns the same response shape. Status transitions: `UNCLAIMED` -> `CLAIMING` -> `CLAIMED`. After the database is claimed, `connection_string` returns `null`. |
| 66 | |
| 67 | ### Error responses |
| 68 | |
| 69 | | Condition | HTTP | Message | |
| 70 | | ---------------------- | ---- | -------------------------------- | |
| 71 | | Missing or empty `ref` | 400 | `Missing referrer` | |
| 72 | | Invalid database ID | 400 | `Database not found` | |
| 73 | | Invalid JSON body | 500 | `Failed to create the database.` | |
| 74 | |
| 75 | ## CLI |
| 76 | |
| 77 | ```bash |
| 78 | npx neon-new@latest --yes |
| 79 | ``` |
| 80 | |
| 81 | Provisions a database and writes the connection string to `.env` in one step. Always use `@latest` and `--yes` (skips interactive prompts that would stall the agent). |
| 82 | |
| 83 | ### Pre-run Check |
| 84 | |
| 85 | Check if `DATABASE_URL` (or the chosen key) already exists in the target `.env`. The CLI exits without provisioning if it finds the key. |
| 86 | |
| 87 | If the key exists, offer the user three options: |
| 88 | |
| 89 | 1. Remove or comment out the existing line, then rerun. |
| 90 | 2. Use `--env` to write to a different file (e.g. `--env .env.local`). |
| 91 | 3. Use `--key` to write under a different variable name. |
| 92 | |
| 93 | Get confirmation before proceeding. |
| 94 | |
| 95 | ### Options |
| 96 | |
| 97 | | Option | Alias | Description | Default | |
| 98 | | ----------------------- | ----- | --------------------------------------------------------------------- | -------------- | |
| 99 | | `--yes` | `-y` | Skip prompts, use defaults | `false` | |
| 100 | | `--env` | `-e` | .env file path | `./.env` | |
| 101 | | `--key |