better-auth-add-plugin
Add a better-auth plugin to an existing project. Configures server and client plugins with proper imports.
Guided migration creation for Cloudflare D1 with schema change validation, SQL generation, and testing workflow. Use when user wants to create migration, modify schema, add tables/indexes, or change database structure.
$ npx -y skills add secondsky/claude-skills --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/d1-create-migrationContext preview
What this command does when you run it.
Guided migration creation for Cloudflare D1 with schema change validation, SQL generation, and testing workflow. Use when user wants to create migration, modify schema, add tables/indexes, or change database structure.
name: cloudflare-d1:create-migration description: Guided migration creation for Cloudflare D1 with schema change validation, SQL generation, and testing workflow. Use when user wants to create migration, modify schema, add tables/indexes, or change database structure.
Guided migration creation with validation, SQL generation, and safe testing workflow.
Use AskUserQuestion to determine what kind of migration to create.
**Prompt**: "What type of migration are you creating?"
**Options**: 1. "Add new table" 2. "Modify existing table (add/remove columns)" 3. "Add indexes" 4. "Data migration (update existing records)" 5. "Custom SQL"
**Store as**: `migrationType`
---
Based on `migrationType`, collect specific details:
**Ask**:
**Ask**:
**Ask**:
**Ask**:
**Ask**:
---
Create migration file with timestamp:
# Generate timestamp
TIMESTAMP=$(date +%Y%m%d%H%M%S)
# Create migration filename
MIGRATION_FILE="migrations/${TIMESTAMP}_<description>.sql"**Generate SQL based on migration type**:
-- Migration: Add <tableName> table -- Created: <timestamp> CREATE TABLE IF NOT EXISTS <tableName> ( id INTEGER PRIMARY KEY AUTOINCREMENT, <columnsList>, created_at INTEGER DEFAULT (unixepoch()) ); -- Indexes for foreign keys and commonly queried columns <for each indexed column> CREATE INDEX IF NOT EXISTS idx_<tableName>_<column> ON <tableName>(<column>); </for each> -- Optimize query planner PRAGMA optimize;
-- Migration: Add column <columnName> to <tableName> -- Created: <timestamp> -- SQLite doesn't support ADD COLUMN IF NOT EXISTS -- Check if column exists first (defensive) ALTER TABLE <tableName> ADD COLUMN <columnName> <type> <constraints>; PRAGMA optimize;
-- Migration: Add index on <tableName>(<columns>) -- Created: <timestamp> CREATE INDEX IF NOT EXISTS idx_<tableName>_<columns> ON <tableName>(<columns>); PRAGMA optimize;
-- Migration: <description> -- Created: <timestamp> -- WARNING: Test in staging first! -- Example: Update all users' status UPDATE users SET status = 'active' WHERE status IS NULL; PRAGMA optimize;
**Write Migration File**: Use Write tool to create the SQL file in migrations/
---
Run automated checks on generated migration:
**1. Syntax Validation** (dry-run):
# Note: Dry-run not directly supported, but can test locally wrangler d1 execute <database-name> --local --file=<migration-file>
**2. Best Practices Check**:
**3. Warn if Destructive**:
⚠️ Warning: This migration contains destructive operations: - DROP TABLE <table> - DROP COLUMN <column> Recommendations: 1. Backup data first (Time Travel: wrangler d1 time-travel...) 2. Test in staging environment 3. Ensure data is no longer needed 4. Consider archiving instead of dropping
**Output Example**:
✓ Migration validation passed - Uses IF NOT EXISTS - Includes PRAGMA optimize - Indexes created for foreign keys ⚠️ Recommendation: Test in local database first
---
**Ask User**: "Test migration in local development database first? (Recommended)"
**If yes**:
# Apply to local D1 wrangler d1 migrations apply <database-name> --local # Verify schema wrangler d1 execute <database-name> --local --command ".schema <tableName>" # Test query wrangler d1 execute <database-name> --local --command "SELECT * FROM <tableName>"
**Show Results**:
✓ Local migration applied successfully Schema after migration: CREATE TABLE users ( id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT NOT NULL UNIQUE, name TEXT NOT NULL, status TEXT DEFAULT 'pending', ← New column created_at INTEGER DEFAULT (unixepoch()) ); Indexes: - idx_users_email - idx_users_status ← New index
**Error Handling**:
❌ Local migration failed: Error: UNIQUE constraint failed: users.email Possible causes: 1. Duplicate emails exist in data 2. Column constraint conflicts with existing data Solution: 1. Edit migration file to handle duplicates 2. Clean data first, then reapply migration
---
**Warning Prompt**:
⚠️ Apply migration to remote (production) database? This will modify your production database: - Database: <database-name> - Migration: <migration-file> Ensure you have: ✓ Tested locally ✓ Reviewed SQL c
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