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数据库。无需账户。除非认领到Neon账户,否则数据库将在72小时后过期。
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数据库产生过多数据传输(出站流量)的应用端查询模式。大多数高额出站流量账单源于应用程序获取的数据量超出实际使用量。