neon-toolkit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNeon Toolkit Skill
Neon Toolkit 技能
Automates creation, management, and cleanup of temporary Neon databases using the Neon Toolkit.
通过Neon Toolkit自动化创建、管理和清理临时Neon数据库。
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).
- 为每次测试运行创建全新数据库
- 在CI/CD流水线中快速搭建数据库
- 构建隔离开发环境
- 无需手动配置的快速原型开发
不推荐用于: 生产数据库、团队共享环境、仅本地开发(建议使用Docker)或免费层级账户(需要付费项目)。
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
当生成TypeScript/JavaScript代码时:
- 在生成导入语句之前,检查tsconfig.json中的路径别名(compilerOptions.paths)
- 如果存在路径别名(例如"@/": ["./src/"]),则使用它们(例如import { x } from '@/lib/utils')
- 如果不存在路径别名或不确定,始终使用相对导入(例如import { x } from '../../../lib/utils')
- 验证导入是否与项目配置匹配
- 默认使用相对导入——无论配置如何,它们始终有效
Reference Documentation
参考文档
Primary Resource: See in project root for comprehensive guidelines including:
[neon-toolkit.mdc](https://raw.githubusercontent.com/neondatabase-labs/ai-rules/main/neon-toolkit.mdc)- Core concepts (Organization, Project, Branch, Endpoint)
- Installation and authentication setup
- Database lifecycle management patterns
- API client usage examples
- Error handling strategies
主要资源: 请查看项目根目录下的,获取包含以下内容的全面指南:
[neon-toolkit.mdc](https://raw.githubusercontent.com/neondatabase-labs/ai-rules/main/neon-toolkit.mdc)- 核心概念(组织、项目、分支、端点)
- 安装与认证设置
- 数据库生命周期管理模式
- API客户端使用示例
- 错误处理策略
Quick Setup
快速设置
Installation
安装
bash
npm install @neondatabase/toolkitbash
npm install @neondatabase/toolkitBasic Usage
基础用法
typescript
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();typescript
import { NeonToolkit } from '@neondatabase/toolkit';
const neon = new NeonToolkit({ apiKey: process.env.NEON_API_KEY! });
// 创建临时数据库
const db = await neon.createEphemeralDatabase();
console.log(`Database URL: ${db.url}`);
// 使用数据库...
// 清理
await db.delete();Templates & Scripts
模板与脚本
- - Complete ephemeral database workflow
templates/toolkit-workflow.ts - - Create a temporary database
scripts/create-ephemeral-db.ts - - Clean up ephemeral database
scripts/destroy-ephemeral-db.ts
- - 完整的临时数据库工作流
templates/toolkit-workflow.ts - - 创建临时数据库
scripts/create-ephemeral-db.ts - - 清理临时数据库
scripts/destroy-ephemeral-db.ts
Common Use Cases
常见使用场景
Testing
测试
typescript
const db = await neon.createEphemeralDatabase();
// Run tests with fresh database
await db.delete();typescript
const db = await neon.createEphemeralDatabase();
// 使用全新数据库运行测试
await db.delete();CI/CD Integration
CI/CD集成
bash
export NEON_API_KEY=${{ secrets.NEON_API_KEY }}
npm test # Uses ephemeral databasebash
export NEON_API_KEY=${{ secrets.NEON_API_KEY }}
npm test # 使用临时数据库Related Skills
相关技能
- neon-serverless - For connecting to databases
- neon-drizzle - For schema and migrations
Want best practices in your project? Run with parameter to add reference links.
neon-plugin:add-neon-docsSKILL_NAME="neon-toolkit"- neon-serverless - 用于连接数据库
- neon-drizzle - 用于架构与迁移
想要在项目中应用最佳实践? 运行并传入参数以添加参考链接。
neon-plugin:add-neon-docsSKILL_NAME="neon-toolkit"