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 workflowscripts/create-ephemeral-db.ts- Create a temporary databasescripts/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.
More from neondatabase/ai-rules
neon-drizzle
Creates a fully functional Drizzle ORM setup with a provisioned Neon database. Installs dependencies, provisions database credentials, configures connections, generates schemas, and runs migrations. Results in working code that can immediately connect to and query the database. Use when creating new projects with Drizzle, adding ORM to existing applications, or modifying database schemas.
421neon-serverless
Configures Neon Serverless Driver for Next.js, Vercel Edge Functions, AWS Lambda, and other serverless environments. Installs @neondatabase/serverless, sets up environment variables, and creates working API route examples with TypeScript types. Use when users need to connect their application to Neon, fetch or query data from a Neon database, integrate Neon with Next.js or serverless frameworks, or set up database access in edge/serverless environments where traditional PostgreSQL clients don't work.
134neon-auth
Sets up Neon Auth for your application. Configures authentication, creates auth routes, and generates UI components. Use when adding authentication to Next.js, React SPA, or Node.js projects.
122add-neon-docs
Use this skill when the user asks to add documentation, add docs, add references, or install documentation about Neon. Adds Neon best practices reference links to project AI documentation (CLAUDE.md, AGENTS.md, or Cursor rules). Does not install packages or modify code.
81neon-js
Sets up the full Neon JS SDK with unified auth and PostgREST-style database queries. Configures auth client, data client, and type generation. Use when building apps that need both authentication and database access in one SDK.
74