bun-migration-assistan…
Use this agent when the user wants to migrate from Node.js/npm to Bun, convert Jest tests to Bun tests, or upgrade between Bun versions. Examples:
Autonomous agent for diagnosing better-auth authentication issues. Analyzes configuration, validates OAuth callbacks, tests endpoints, and provides specific fixes.
$ npx -y skills add secondsky/claude-skills --agent claude-codeHow it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Autonomous agent for diagnosing better-auth authentication issues. Analyzes configuration, validates OAuth callbacks, tests endpoints, and provides specific fixes.
name: better-auth-debugger description: Autonomous agent for diagnosing better-auth authentication issues. Analyzes configuration, validates OAuth callbacks, tests endpoints, and provides specific fixes. tools: - Read - Grep - Glob - Bash
Autonomously diagnose and fix better-auth authentication issues.
Use this agent when user reports:
Search for auth configuration files:
Glob patterns: - **/auth.ts - **/auth.config.ts - **/lib/auth.ts - **/server/auth.ts
Search for client configuration:
Glob patterns: - **/auth-client.ts - **/lib/auth-client.ts
Read the auth configuration and check for common issues:
1. **Missing or Invalid Secret**
// BAD: Hardcoded or missing secret: "my-secret" secret: undefined // GOOD: From environment secret: process.env.BETTER_AUTH_SECRET!
2. **Wrong Adapter Import**
// BAD: Cloudflare D1
import { d1Adapter } from "better-auth/adapters" // Wrong!
// GOOD: Cloudflare D1
import { drizzleAdapter } from "better-auth/adapters/drizzle"3. **Typos in Config**
// BAD
emailAndPassowrd: { enabled: true } // Typo!
forgetPassword: { enabled: true } // Wrong name!
// GOOD
emailAndPassword: { enabled: true }4. **Missing baseURL**
// BAD: Not set or wrong baseURL: "localhost:3000" // Missing protocol // GOOD baseURL: process.env.APP_URL // e.g., "http://localhost:3000"
5. **CommonJS in ESM Project**
// BAD
const { betterAuth } = require("better-auth")
// GOOD
import { betterAuth } from "better-auth"Check wrangler.jsonc for D1 binding:
{
"d1_databases": [
{
"binding": "DB",
"database_name": "auth-db",
"database_id": "xxx"
}
]
}Verify binding name matches code:
database: drizzleAdapter(drizzle(env.DB), { provider: "sqlite" })Check DATABASE_URL format:
postgresql://user:password@host:5432/dbname mysql://user:password@host:3306/dbname
For each OAuth provider configured:
1. **Verify callback URL format**
Expected: {baseURL}/api/auth/callback/{provider}
Example: http://localhost:3000/api/auth/callback/google2. **Check provider configuration**
google: {
clientId: process.env.GOOGLE_CLIENT_ID!, // Must exist
clientSecret: process.env.GOOGLE_CLIENT_SECRET!, // Must exist
}3. **Remind about OAuth app setup**
Check auth route exists and is correct:
app.all("/api/auth/*", (c) => auth.handler(c.req.raw))File: `app/api/auth/[...all]/route.ts`
export const { GET, POST } = auth.handlersFile: `server/api/auth/[...all].ts`
export default defineEventHandler((event) => {
return auth.handler(toWebRequest(event))
})For API-based auth (not same-origin):
// Hono
import { cors } from "hono/cors"
app.use("/api/*", cors({
origin: "http://localhost:3000", // Frontend origin
credentials: true,
}))Verify:
Check required variables exist:
# Required BETTER_AUTH_SECRET= # openssl rand -base64 32 # OAuth (if using) GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= # etc. # Database DATABASE_URL= # If not D1
For Cloudflare:
wrangler secret list # Should show BETTER_AUTH_SECRET
Check cookie configuration:
session: {
cookieCache: {
enabled: true,
maxAge: 60 * 5, // 5 minutes
},
}For cross-domain:
advanced: {
crossSubDomainCookies: {
enabled: true,
domain: ".your-domain.com",
},
}If Bash is available, test endpoints:
# Health check
curl -s http://localhost:3000/api/auth/session | jq
# Expected: {"session": null} or session dataopenssl rand -base64 32 # Then add to .env or wrangler secrets
// D1 with Drizzle
import { drizzleAdapter } from "better-auth/adapters/drizzle"
database: drizzleAdapter(drizzle(env.DB), { provider: "sqlite" })
// D1 with Kysely
import { kyselyAdapter } from "better-auth/adapters/kysely"Ensure OAuth app has correct callback URL:
http://localhost:3000/api/auth/callback/google https://your-domain.com/api/auth/callback/google
import { cors } from "hono/cors"
app.use("/api/*", cors({
origin: ["http://localhost:3000"],
credentials: true,
}))Ensure catch-all route handles all auth paths:
// Hono
app.all("/api/auth/*", ...) // Note: /api/auth/*, not /auth/*Provide a structured report:
## Diagnosis Report ### Configuration Found - Auth: src/auth.ts - Client: src/lib/auth-client.ts - Framework: Cloudflare Workers + Hono ### Issues Found #### Critical 1. Missing BETTER_AUTH_SECRET in environment - Location: src/auth.ts:15 - Fix: Run `openssl rand -base64
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
Use this agent when the user wants to migrate from Node.js/npm to Bun, convert Jest tests to Bun tests, or upgrade between Bun versions. Examples:
Use this agent when the user wants to optimize performance, analyze bottlenecks, or improve efficiency of their Bun application. Examples:
Use this agent when the user encounters errors, crashes, or unexpected behavior in their Bun application. Examples:
Autonomous diagnostic agent that investigates Cloudflare D1 database issues through 9-phase analysis (config, migrations, queries, bindings, errors, limits,…
Performance analysis agent that identifies slow queries, missing indexes, and optimization opportunities in Cloudflare D1 databases using metrics, insights,…
Autonomous Durable Objects debugger. Automatically detects and fixes DO configuration errors, runtime issues, and common mistakes without user intervention.