neon-toolkit

作者: neondatabase

建立並管理用於測試、CI/CD 管線及隔離開發環境的臨時 Neon 資料庫。適用於建立暫時性資料庫時…

npx skills add https://github.com/neondatabase/ai-rules --skill neon-toolkit

Neon Toolkit Skill

Automates creation, management, and cleanup of temporary Neon databases using the Neon Toolkit.

When to Use

  • Creating fresh databases for each test run
  • Spinning up databases in CI/CD pipelines
  • Building isolated development environments
  • Rapid prototyping without manual setup

Not recommended for: Production databases, shared team environments, local-only development (use Docker), or free tier accounts (requires paid projects).

Code Generation Rules

When generating TypeScript/JavaScript code:

  • BEFORE generating import statements, check tsconfig.json for path aliases (compilerOptions.paths)
  • If path aliases exist (e.g., "@/": ["./src/"]), use them (e.g., import { x } from '@/lib/utils')
  • If NO path aliases exist or unsure, ALWAYS use relative imports (e.g., import { x } from '../../../lib/utils')
  • Verify imports match the project's configuration
  • Default to relative imports - they always work regardless of configuration

Reference Documentation

Primary Resource: See [neon-toolkit.mdc](https://raw.githubusercontent.com/neondatabase-labs/ai-rules/main/neon-toolkit.mdc) in project root for comprehensive guidelines including:

  • Core concepts (Organization, Project, Branch, Endpoint)
  • Installation and authentication setup
  • Database lifecycle management patterns
  • API client usage examples
  • Error handling strategies

Quick Setup

Installation

npm install @neondatabase/toolkit

Basic Usage

import { NeonToolkit } from '@neondatabase/toolkit';

const neon = new NeonToolkit({ apiKey: process.env.NEON_API_KEY! });

// Create ephemeral database
const db = await neon.createEphemeralDatabase();
console.log(`Database URL: ${db.url}`);

// Use the database...

// Cleanup
await db.delete();

Templates & Scripts

  • templates/toolkit-workflow.ts - Complete ephemeral database workflow
  • scripts/create-ephemeral-db.ts - Create a temporary database
  • scripts/destroy-ephemeral-db.ts - Clean up ephemeral database

Common Use Cases

Testing

const db = await neon.createEphemeralDatabase();
// Run tests with fresh database
await db.delete();

CI/CD Integration

export NEON_API_KEY=${{ secrets.NEON_API_KEY }}
npm test  # Uses ephemeral database

Related Skills

  • neon-serverless - For connecting to databases
  • neon-drizzle - For schema and migrations

Want best practices in your project? Run neon-plugin:add-neon-docs with parameter SKILL_NAME="neon-toolkit" to add reference links.

來自 neondatabase 的更多技能

claimable-postgres
neondatabase
即時 Postgres 資料庫,適用於本地開發、展示、原型設計與測試環境。無需註冊帳號。資料庫在 72 小時後到期,除非認領至 Neon 帳號。
neon
neondatabase
Neon平台概述,涵蓋Postgres、Auth、Data API,以及新服務:物件儲存、計算函數和AI閘道。每當提及「Neon」時,用於概述如何操作Neon及入門方式。否則,個別功能即為觸發條件:「物件儲存」或「S3相容儲存」、「無伺服器函數」、「背景任務」或「在資料庫附近執行程式碼」、「AI閘道」、「LLM代理」、「模型路由」或「呼叫LLM」→...
apidatabasedevelopment
plugin-manager
neondatabase
管理此儲存庫在 Cursor 和 Claude Code 中的插件結構與配置。在建立、更新或審查插件資料夾時使用…
skill-creator
neondatabase
建立有效技能的指南。當使用者想要建立新技能(或更新現有技能)以擴展 Claude 的功能時,應使用此技能。
using-neon
neondatabase
使用 Neon Serverless Postgres 的指南與最佳實踐。涵蓋入門、使用 Neon 進行本地開發、選擇連線方式、Neon…
neon-js-react
neondatabase
在 React 應用程式(Vite、CRA)中設定完整的 Neon SDK,包含驗證與資料庫查詢功能。建立型別化客戶端、產生資料庫型別,並配置…
postgres-best-practices
neondatabase
使用 Postgres 的最佳實踐與指南,涵蓋資料表設計、索引策略、查詢最佳化、遷移與常見陷阱。運用…
neon-postgres-egress-optimizer
neondatabase
引導使用者診斷並修復應用端查詢模式,這些模式會導致從其 Postgres 資料庫傳輸過多資料(出口流量)。大多數高額出口帳單來自應用程式擷取超出實際使用的資料。