better-auth-add-plugin
Add a better-auth plugin to an existing project. Configures server and client plugins with proper imports.
Interactive wizard to set up Cloudflare D1 database with database creation, Worker binding configuration, schema generation, and first migration. Use when user wants to create first D1 database or add D1 to existing Worker.
$ npx -y skills add secondsky/claude-skills --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/d1-setupContext preview
What this command does when you run it.
Interactive wizard to set up Cloudflare D1 database with database creation, Worker binding configuration, schema generation, and first migration. Use when user wants to create first D1 database or add D1 to existing Worker.
name: cloudflare-d1:setup description: Interactive wizard to set up Cloudflare D1 database with database creation, Worker binding configuration, schema generation, and first migration. Use when user wants to create first D1 database or add D1 to existing Worker.
Interactive wizard for complete D1 setup: create database, configure bindings, generate schema, and run first migration.
Check before starting:
Use AskUserQuestion to collect setup preferences.
**Question 1: Database Name**
**Question 2: Binding Name**
**Question 3: Schema Source**
**Question 4: Read Replication**
**Question 5: Data Jurisdiction** (if user is on paid plan)
---
Build and execute wrangler command based on user inputs:
# Base command wrangler d1 create <databaseName> # Add jurisdiction if specified and not GLOBAL if [jurisdiction != "GLOBAL"]: wrangler d1 create <databaseName> --jurisdiction <jurisdiction>
**Execute**:
# Example wrangler d1 create my-app-db --jurisdiction EU
**Capture Output**: Extract `database_id` from output (36-character UUID)
✅ Successfully created DB 'my-app-db' (abc123-def456-ghi789-...)
Store `database_id` for next steps.
**Error Handling**:
---
Check if wrangler.jsonc or wrangler.toml exists:
if [ -f "wrangler.jsonc" ]; then CONFIG_FILE="wrangler.jsonc" elif [ -f "wrangler.toml" ]; then CONFIG_FILE="wrangler.toml" else # Ask user which format to create CONFIG_FILE="wrangler.jsonc" # Default to JSON fi
**Add D1 Configuration**:
**If wrangler.jsonc**: Use Edit tool to add to `d1_databases` array (or create array if doesn't exist):
{
"d1_databases": [
{
"binding": "<bindingName>",
"database_name": "<databaseName>",
"database_id": "<databaseId>",
"preview_database_id": "local"
// Conditional fields:
// "replicate": { "enabled": true }, // if enableReplication
// "jurisdiction": "EU" // if jurisdiction != "GLOBAL"
}
]
}**If wrangler.toml**:
[[d1_databases]] binding = "<bindingName>" database_name = "<databaseName>" database_id = "<databaseId>"
**Verify**:
# Show configuration to user cat wrangler.jsonc | grep -A 10 "d1_databases"
**Error Handling**:
---
Create migrations directory structure:
mkdir -p migrations
Confirm directory created:
ls -la migrations
---
**If user has existing schema** (`hasSchema == true`):
cp <schemaPath> migrations/0001_initial_schema.sql
**If generating schema** (`hasSchema == false`):
Ask for table details using AskUserQuestion:
Generate basic schema for each table:
-- migrations/0001_initial_schema.sql -- Example for "users" table CREATE TABLE IF NOT EXISTS users ( id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT NOT NULL UNIQUE, name TEXT NOT NULL, created_at INTEGER DEFAULT (unixepoch()), updated_at INTEGER DEFAULT (unixepoch()) ); CREATE INDEX IF NOT EXISTS idx_users_email ON users(email); -- Example for "posts" table CREATE TABLE IF NOT EXISTS posts ( id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER NOT NULL, title TEXT NOT NULL, content TEXT, created_at INTEGER DEFAULT (unixepoch()), FOREIGN KEY (user_id) REFERENCES users(id) ); CREATE INDEX IF NOT EXISTS idx_posts_user_id ON posts(user_id); -- Optimize query planner PRAGMA optimize;
**Best Practices Applied**:
**Write Schema File**:
# Use Write tool to create migrations/0001_initial_schema.sql
---
**Test Locally First** (recommended):
wrangler d1 migrations apply <databaseName> --local
Check for errors. If successful, proceed to remote.
**Apply to Remote**:
wrangler d1 migrations apply <databaseName> --remote
**Verify**:
145 production-ready skills for Claude Code CLI 🔌 Platform / Harness Support These plugins ship as Claude Code marketplace plugins (.claude-plugin/ manifests) and Codex CLI plugins (.codex-plugin/ manifests).
Repo: secondsky/claude-skills
Add a better-auth plugin to an existing project. Configures server and client plugins with proper imports.
Interactive setup wizard for better-auth authentication. Guides through database, framework, OAuth providers, and plugin configuration.
Explain Better Auth error codes and provide solutions with code examples
Display Better Auth available authentication providers and their configuration