PG库申领

Universal

claimable-postgres

by neondatabase

一键创建可认领的临时 Postgres 数据库,适合本地开发、Demo、原型和测试环境,通过 REST API、CLI、SDK 或 Vite plugin 快速拿到连接串并写入 .env,72 小时内可转到 Neon 账户。

45平台与服务未扫描2026年3月5日

安装

claude skill add --url github.com/neondatabase/agent-skills/tree/main/skills/claimable-postgres

文档

Claimable Postgres

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.

Quick Start

bash
curl -s -X POST "https://pg.new/api/v1/database" \
  -H "Content-Type: application/json" \
  -d '{"ref": "agent-skills"}'

Parse connection_string and claim_url from the JSON response. Write connection_string to the project's .env as DATABASE_URL.

For other methods (CLI, SDK, Vite plugin), see Which Method? below.

Which Method?

  • REST API: Returns structured JSON. No runtime dependency beyond curl. Preferred when the agent needs predictable output and error handling.
  • CLI (npx get-db@latest --yes): Provisions and writes .env in one command. Convenient when Node.js is available and the user wants a simple setup.
  • SDK (get-db/sdk): Scripts or programmatic provisioning in Node.js.
  • Vite plugin (vite-plugin-db): Auto-provisions on vite dev if DATABASE_URL is missing. Use when the user has a Vite project.
  • Browser: User cannot run CLI or API. Direct to https://pg.new.

REST API

Base URL: https://pg.new/api/v1

Create a database

bash
curl -s -X POST "https://pg.new/api/v1/database" \
  -H "Content-Type: application/json" \
  -d '{"ref": "agent-skills"}'
ParameterRequiredDescription
refYesTracking tag that identifies who provisioned the database. Use "agent-skills" when provisioning through this skill.
enable_logical_replicationNoEnable logical replication (default: false, cannot be disabled once enabled)

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.

Response:

json
{
  "id": "019beb39-37fb-709d-87ac-7ad6198b89f7",
  "status": "UNCLAIMED",
  "neon_project_id": "gentle-scene-06438508",
  "connection_string": "postgresql://...",
  "claim_url": "https://pg.new/claim/019beb39-...",
  "expires_at": "2026-01-26T14:19:14.580Z",
  "created_at": "2026-01-23T14:19:14.580Z",
  "updated_at": "2026-01-23T14:19:14.580Z"
}

Check status

bash
curl -s "https://pg.new/api/v1/database/{id}"

Returns the same response shape. Status transitions: UNCLAIMED -> CLAIMING -> CLAIMED. After the database is claimed, connection_string returns null.

Error responses

ConditionHTTPMessage
Missing or empty ref400Missing referrer
Invalid database ID400Database not found
Invalid JSON body500Failed to create the database.

CLI

bash
npx get-db@latest --yes

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).

Pre-run Check

Check if DATABASE_URL (or the chosen key) already exists in the target .env. The CLI exits without provisioning if it finds the key.

If the key exists, offer the user three options:

  1. Remove or comment out the existing line, then rerun.
  2. Use --env to write to a different file (e.g. --env .env.local).
  3. Use --key to write under a different variable name.

Get confirmation before proceeding.

Options

OptionAliasDescriptionDefault
--yes-ySkip prompts, use defaultsfalse
--env-e.env file path./.env
--key-kConnection string env var keyDATABASE_URL
--prefix-pPrefix for generated public env varsPUBLIC_
--seed-sPath to seed SQL filenone
--logical-replication-LEnable logical replicationfalse
--ref-rReferrer id (use agent-skills when provisioning through this skill)none

Alternative package managers: yarn dlx get-db@latest, pnpm dlx get-db@latest, bunx get-db@latest, deno run -A get-db@latest.

Output

The CLI writes to the target .env:

code
DATABASE_URL=postgresql://...              # pooled (use for application queries)
DATABASE_URL_DIRECT=postgresql://...       # direct (use for migrations, e.g. Prisma)
PUBLIC_POSTGRES_CLAIM_URL=https://pg.new/claim/...

SDK

Use for scripts and programmatic provisioning flows.

typescript
import { instantPostgres } from 'get-db';

const { databaseUrl, databaseUrlDirect, claimUrl, claimExpiresAt } = await instantPostgres({
  referrer: 'agent-skills',
  seed: { type: 'sql-script', path: './init.sql' },
});

Returns databaseUrl (pooled), databaseUrlDirect (direct, for migrations), claimUrl, and claimExpiresAt (Date object). The referrer parameter is required.

Vite Plugin

For Vite projects, vite-plugin-db auto-provisions a database on vite dev if DATABASE_URL is missing. Install with npm install -D vite-plugin-db. See the Claimable Postgres docs for configuration.

Agent Workflow

API path

  1. Confirm intent: If the request is ambiguous, confirm the user wants a temporary, no-signup database. Skip this if they explicitly asked for a quick or temporary database.
  2. Provision: POST to https://pg.new/api/v1/database with {"ref": "agent-skills"}.
  3. Parse response: Extract connection_string, claim_url, and expires_at from the JSON response.
  4. Write .env: Write DATABASE_URL=<connection_string> to the project's .env (or the user's preferred file and key). Do not overwrite an existing key without confirmation.
  5. Seed (if needed): If the user has a seed SQL file, run it against the new database:
    bash
    psql "$DATABASE_URL" -f seed.sql
    
  6. Report: Tell the user where the connection string was written, which key was used, and share the claim URL. Remind them: the database works now; claim within 72 hours to keep it permanently.
  7. Optional: Offer a quick connection test (e.g. SELECT 1).

CLI path

  1. Check .env: Check the target .env for an existing DATABASE_URL (or chosen key). If present, do not run. Offer remove, --env, or --key and get confirmation.
  2. Confirm intent: If the request is ambiguous, confirm the user wants a temporary, no-signup database. Skip this if they explicitly asked for a quick or temporary database.
  3. Gather options: Use defaults unless context suggests otherwise (e.g., user mentions a custom env file, seed SQL, or logical replication).
  4. Run: Execute with @latest --yes plus the confirmed options. Always use @latest to avoid stale cached versions. --yes skips interactive prompts that would stall the agent.
    bash
    npx get-db@latest --yes --ref agent-skills --env .env.local --seed ./schema.sql
    
  5. Verify: Confirm the connection string was written to the intended file.
  6. Report: Tell the user where the connection string was written, which key was used, and that a claim URL is in the env file. Remind them: the database works now; claim within 72 hours to keep it permanently.
  7. Optional: Offer a quick connection test (e.g. SELECT 1).

Output Checklist

Always report:

  • Where the connection string was written (e.g. .env)
  • Which variable key was used (DATABASE_URL or custom key)
  • The claim URL (from .env or API response)
  • That unclaimed databases are temporary (72 hours)

Claiming

Claiming is optional. The database works immediately without it. To optionally claim, the user opens the claim URL in a browser, where they sign in or create a Neon account to claim the database.

  • API/SDK: Give the user the claim_url from the create response.
  • CLI: npx get-db@latest claim reads the claim URL from .env and opens the browser automatically.

Users cannot claim into Vercel-linked orgs; they must choose another Neon org.

Defaults and Limits

ParameterValue
ProviderAWS
Regionus-east-2
Postgres17

Region cannot be changed for claimable databases. Unclaimed databases have stricter quotas. Claiming resets limits to free plan defaults.

UnclaimedClaimed (Free plan)
Storage100 MB512 MB
Transfer1 GB~5 GB
BranchesNoYes
Expiration72 hoursNone

Auto-provisioning

If the agent needs a database to fulfill a task (e.g. "build me a todo app with a real database") and the user has not provided a connection string, provision one via the API and inform the user. Include the claim URL so they can keep it.

Safety and UX Notes

  • Do not overwrite existing env vars. Check first, then use --env or --key (CLI) or skip writing (API) to avoid conflicts.
  • Ask before running destructive seed SQL (DROP, TRUNCATE, mass DELETE).
  • For production workloads, recommend standard Neon provisioning instead of temporary claimable databases.
  • If users need long-term persistence, instruct them to open the claim URL right away.
  • After writing credentials to an .env file, check that it's covered by .gitignore. If not, warn the user. Do not modify .gitignore without confirmation.

相关 Skills

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描119.1k

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描119.1k

接口设计评审

by alirezarezvani

Universal
热门

审查 REST API 设计是否符合行业规范,自动检查命名、HTTP 方法、状态码与文档覆盖,识别破坏性变更并给出设计评分,适合评审接口方案和版本迭代前把关。

做API和架构方案时,它能帮你提前揪出接口设计问题并对齐最佳实践,评审视角系统,团队协作更省心。

平台与服务
未扫描11.5k

相关 MCP 服务

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
83.9k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
78.5k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
37.5k

评论