Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计异常

bknd-database-provisionbknd 数据库提供

Agent Skill

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

总安装

321

周安装

13

GitHub Stars

3

下载量

101
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:bknd-database-provision(bknd 数据库提供)
来源仓库:https://github.com/cameronapak/bknd-skills
仓库路径:skills/bknd-database-provision
安装命令:
npx skills add https://github.com/cameronapak/bknd-skills --skill bknd-database-provision
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/cameronapak/bknd-skills --skill bknd-database-provision

简介

bknd-database-provision 用于配置生产环境数据库,适合在 Codex、Claude、Cursor、Gemini CLI 中完成云端数据库实例创建与 schema 同步。

  • 适用场景包括 Turso/Neon/Cloudflare/Supabase 等托管服务接入、连接字符串管理及迁移脚本执行。
  • 核心能力是区分 UI 模式(仪表盘操作)与 Code 模式(CLI 命令)两种部署方式。
  • 使用方式建议先在 provider 控制台创建实例,再通过 CLI 绑定到 Bknd 项目并执行 sync 操作。
  • 生产环境务必启用备份策略,schema 变更前应做 dry-run 测试以防破坏线上数据。

SKILL.md

Provision Production Database

Set up and configure a production database for your Bknd application.

Prerequisites

  • Bknd application with schema defined
  • Account on chosen database provider (for cloud databases)
  • Environment for storing connection credentials

When to Use UI Mode

  • Creating databases via provider dashboards (Turso, Neon, Cloudflare, Supabase)
  • Managing database settings and access tokens
  • Viewing database metrics and logs

When to Use Code Mode

  • Configuring database connection in Bknd
  • CLI commands for database creation
  • Schema sync and migrations

Database Selection Guide

DatabaseBest ForPlatform CompatibilityCost
SQLite FileVPS, Docker, single-serverNode.js, BunFree
LibSQL/TursoServerless, edge, globalAll platformsFree tier
Cloudflare D1Cloudflare WorkersCloudflare onlyFree tier
PostgreSQLComplex queries, transactionsVPS, DockerSelf-hosted
NeonServerless PostgresVercel, LambdaFree tier
SupabasePostgres + extrasAnyFree tier
XataServerless + searchAnyFree tier

SQLite File (VPS/Docker)

Best for: Single-server deployments with full control

Step 1: Configure Connection

// bknd.config.ts
export default {
  app: (env) => ({
    connection: {
      url: env.DB_URL ?? "file:data.db",  // Relative to cwd
    },
  }),
};

Step 2: Set Environment Variable

# Relative path (project directory)
DB_URL=file:data.db

# Absolute path (recommended for production)
DB_URL=file:/var/data/myapp/bknd.db

Step 3: Ensure Directory Exists

mkdir -p /var/data/myapp

Docker Volume

# docker-compose.yml
services:
  bknd:
    volumes:
      - bknd-data:/app/data
    environment:
      - DB_URL=file:/app/data/bknd.db

volumes:
  bknd-data:

LibSQL / Turso

Best for: Serverless, edge deployments, global distribution

Step 1: Install Turso CLI

# macOS/Linux
curl -sSfL https://get.tur.so/install.sh | bash

# Authenticate
turso auth login

Step 2: Create Database

# Create database
turso db create my-bknd-db

# Optional: Specify region
turso db create my-bknd-db --location lax  # Los Angeles

Step 3: Get Connection Details

# Get connection URL
turso db show my-bknd-db --url
# Output: libsql://my-bknd-db-username.turso.io

# Create auth token
turso db tokens create my-bknd-db
# Output: eyJhbGciOi...

Step 4: Configure Bknd

// bknd.config.ts
export default {
  app: (env) => ({
    connection: {
      url: env.DB_URL,       // libsql://...
      authToken: env.DB_TOKEN,
    },
  }),
};

Step 5: Set Environment Variables

DB_URL=libsql://my-bknd-db-username.turso.io
DB_TOKEN=eyJhbGciOi...

Turso Locations

Common regions: ams (Amsterdam), fra (Frankfurt), lax (LA), lhr (London), nrt (Tokyo), syd (Sydney)

turso db locations  # List all regions

Cloudflare D1

Best for: Cloudflare Workers deployments

Step 1: Create D1 Database

wrangler d1 create my-bknd-db

Output:

Created D1 database 'my-bknd-db'
database_name = "my-bknd-db"
database_id = "abc123-def456-..."

Step 2: Configure wrangler.toml

name = "my-bknd-app"
main = "src/index.ts"
compatibility_date = "2024-01-01"

[[d1_databases]]
binding = "DB"
database_name = "my-bknd-db"
database_id = "abc123-def456-..."

Step 3: Configure Bknd Adapter

// src/index.ts
import { hybrid, type CloudflareBkndConfig } from "bknd/adapter/cloudflare";
import { d1Sqlite } from "bknd/adapter/cloudflare";

export default hybrid<CloudflareBkndConfig>({
  app: (env) => ({
    connection: d1Sqlite({ binding: env.DB }),
    isProduction: true,
  }),
});

D1 CLI Commands

# List databases
wrangler d1 list

# Execute SQL (local dev)
wrangler d1 execute my-bknd-db --local --command "SELECT * FROM posts"

# Execute SQL (production)
wrangler d1 execute my-bknd-db --command "SELECT * FROM posts"

# Export backup
wrangler d1 backup create my-bknd-db

PostgreSQL (Self-Hosted)

Best for: Complex queries, large datasets, existing Postgres infrastructure

Step 1: Install Adapter

npm install postgres
# or
npm install pg

Step 2: Configure Connection

Using postgres (recommended):

import { PostgresJsConnection } from "bknd/adapter/postgres";

export default {
  app: (env) => ({
    connection: new PostgresJsConnection({
      connectionString: env.DATABASE_URL,
    }),
  }),
};

Using pg:

import { PgPostgresConnection } from "bknd/adapter/postgres";

export default {
  app: (env) => ({
    connection: new PgPostgresConnection({
      connectionString: env.DATABASE_URL,
    }),
  }),
};

Step 3: Set Connection String

DATABASE_URL=postgresql://user:password@host:5432/database?sslmode=require

Neon (Serverless Postgres)

Best for: Vercel, serverless, auto-scaling Postgres

Step 1: Create Project at neon.tech

  1. Sign up at neon.tech
  2. Create new project
  3. Copy connection string from dashboard

Step 2: Install Neon Dialect

npm install kysely-neon

Step 3: Configure Connection

import { createCustomPostgresConnection } from "bknd";
import { NeonDialect } from "kysely-neon";

const neon = createCustomPostgresConnection("neon", NeonDialect);

export default {
  app: (env) => ({
    connection: neon({
      connectionString: env.NEON_DATABASE_URL,
    }),
  }),
};

Step 4: Set Environment Variable

NEON_DATABASE_URL=postgres://user:password@ep-xxx.us-east-1.aws.neon.tech/neondb?sslmode=require

Supabase

Best for: Full-featured Postgres with extras (auth, storage, realtime)

Step 1: Create Project at supabase.com

  1. Sign up at supabase.com
  2. Create new project
  3. Go to Settings > Database > Connection string

Step 2: Get Direct Connection String

Use "Direct connection" (not pooler) for Bknd:

postgresql://postgres:[PASSWORD]@db.[PROJECT-REF].supabase.co:5432/postgres

Step 3: Configure Connection

export default {
  app: (env) => ({
    connection: {
      url: env.SUPABASE_DB_URL,
    },
  }),
};

Step 4: Set Environment Variable

SUPABASE_DB_URL=postgresql://postgres:your-password@db.abcdefgh.supabase.co:5432/postgres

Xata

Best for: Serverless Postgres with built-in search

Step 1: Create Database at xata.io

  1. Sign up at xata.io
  2. Create workspace and database

Step 2: Install Xata Dialect

npm install @xata.io/kysely

Step 3: Configure Connection

import { createCustomPostgresConnection } from "bknd";
import { XataDialect } from "@xata.io/kysely";

const xata = createCustomPostgresConnection("xata", XataDialect);

export default {
  app: (env) => ({
    connection: xata({
      apiKey: env.XATA_API_KEY,
      workspace: "your-workspace",
      database: "your-database",
    }),
  }),
};

Schema Sync

After configuring your database, Bknd auto-syncs schema on first request. For manual control:

# Dry run (preview changes)
npx bknd sync --dry-run

# Apply changes
npx bknd sync

# Force sync (use with caution)
npx bknd sync --force

Connection Testing

Verify Connection

// test-connection.ts
import { app } from "bknd";

const bknd = app({
  connection: {
    url: process.env.DB_URL!,
    authToken: process.env.DB_TOKEN,
  },
});

async function test() {
  await bknd.build();
  console.log("Connection successful!");
  console.log("Entities:", Object.keys(bknd.modules.data.entities));
  process.exit(0);
}

test().catch((e) => {
  console.error("Connection failed:", e);
  process.exit(1);
});

Run:

npx tsx test-connection.ts

Common Pitfalls

"Connection refused" or "ECONNREFUSED"

Problem: Can't connect to database

Fix:

  • Verify connection URL format
  • Check firewall/security group rules
  • Ensure database is running
  • For cloud: verify IP allowlist includes your server

"Auth token required" (LibSQL/Turso)

Problem: Missing or invalid auth token

Fix:

# Generate new token
turso db tokens create my-bknd-db

# Set in environment
export DB_TOKEN="eyJhbGciOi..."

"D1 binding not found"

Problem: env.DB is undefined in Cloudflare Workers

Fix: Check wrangler.toml binding name matches code:

[[d1_databases]]
binding = "DB"  # Must match env.DB

"SSL required" (PostgreSQL)

Problem: Connection fails without SSL

Fix: Add ?sslmode=require to connection string:

DATABASE_URL=postgresql://user:pass@host:5432/db?sslmode=require

"Unknown database" or "Database does not exist"

Problem: Database not created

Fix:

# Turso
turso db create my-bknd-db

# D1
wrangler d1 create my-bknd-db

# PostgreSQL
createdb my-bknd-db

Schema Sync Fails

Problem: Migrations fail on production database

Fix:

# Preview changes first
npx bknd sync --dry-run

# If stuck, use --force (data loss possible!)
npx bknd sync --force --drop

Migration from Development

Export Development Data

# SQLite
sqlite3 data.db .dump > backup.sql

# Using API
curl http://localhost:3000/api/data/posts > posts.json

Import to Production

# Via seed function (recommended)
# See bknd-seed-data skill

# Direct SQL (SQLite to SQLite only)
cat backup.sql | turso db shell my-bknd-db

DOs and DON'Ts

DO:

  • Use cloud databases (Turso, D1, Neon) for serverless
  • Store credentials in environment variables
  • Test connection before deploying
  • Use SSL for PostgreSQL connections
  • Keep auth tokens secure
  • Enable backups for production data

DON'T:

  • Use file-based SQLite in serverless/edge
  • Hardcode credentials in source code
  • Share auth tokens across environments
  • Skip connection testing
  • Use --force --drop without backups
  • Expose database directly to internet (use Bknd API)

Related Skills

  • bknd-deploy-hosting - Deploy to hosting platforms
  • bknd-production-config - Production security settings
  • bknd-env-config - Environment variable setup
  • bknd-seed-data - Populate database with initial data
  • bknd-local-setup - Local development (pre-production)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.14%
按下载量换算39

Claude

30.37%
按下载量换算31

Cursor

18.08%
按下载量换算18

Gemini CLI

9.56%
按下载量换算10

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills