aceternity-ui
100+ animated React components (Aceternity UI) for Next.js with Tailwind. Use for hero sections, parallax, 3D effects, or…
Cloudflare D1 serverless SQLite on edge. Use for databases, migrations, bindings, or encountering D1_ERROR, statement too long, too many requests queued errors.
Claude Code
$ npx -y skills add secondsky/claude-skills --skill cloudflare-d1 --agent claude-code
Codex
$ npx skills add secondsky/claude-skills --skill cloudflare-d1 -a codex -y
Cursor
$ npx skills add secondsky/claude-skills --skill cloudflare-d1 -a cursor -y
Gemini CLI
$ npx skills add secondsky/claude-skills --skill cloudflare-d1 -a gemini-cli -y
GitHub Copilot
$ npx skills add secondsky/claude-skills --skill cloudflare-d1 -a github-copilot -y
OpenCode
$ npx skills add secondsky/claude-skills --skill cloudflare-d1 -a opencode -y
Windsurf
$ npx skills add secondsky/claude-skills --skill cloudflare-d1 -a windsurf -y
name: cloudflare-d1
description: "Cloudflare D1 serverless SQLite on edge. Use for databases, migrations, bindings, or encountering D1_ERROR, statement too long, too many requests queued errors."
license: MIT
metadata:
version: "3.0.0"
last_verified: "2025-01-15"
production_tested: true
token_savings: "~58%"
errors_prevented: 8
templates_included: 3
references_included: 4
wrangler_version: "4.81.0"
workers_types_version: "4.20260408.0"
drizzle_orm_version: "0.45.2"
keywords:
- d1
- d1 database
- cloudflare d1
- wrangler d1
- d1 migrations
- d1 bindings
- sqlite workers
- edge database
- d1 queries
- sql cloudflare
- prepared statements
- batch queries
- d1 api
- wrangler migrations
- D1_ERROR
- D1_EXEC_ERROR
- statement too long
- database bindings
- sqlite cloudflare
- sql workers api
- d1 indexes
- query optimization
- d1 schema
- read replication
- read replica
- withSession
- Sessions API
- global replication
- database replication
- served_by_region
- bookmarks
- sequential consistency**Status**: Production Ready ✅ | **Last Verified**: 2025-01-15
1. [What Is D1?](#what-is-d1) 2. [Quick Start](#quick-start-5-minutes) 3. [Critical Rules](#critical-rules) 4. [D1 API Methods](#d1-api-methods) 5. [Top 5 Use Cases](#top-5-use-cases) 6. [Migrations Best Practices](#migrations-best-practices) 7. [Common Patterns](#common-patterns) 8. [SQLite Type Affinity](#sqlite-type-affinity) 9. [Top 5 Errors Prevented](#top-5-errors-prevented)
---
Cloudflare D1 is **serverless SQLite** on the edge:
---
D1 received major updates throughout 2025:
**Full details**: Load `references/2025-features.md`
---
bunx wrangler d1 create my-database
Save the `database_id` from output!
Add to `wrangler.jsonc`:
{
"name": "my-worker",
"main": "src/index.ts",
"compatibility_date": "2025-10-11",
"d1_databases": [
{
"binding": "DB", // env.DB
"database_name": "my-database",
"database_id": "<UUID>",
"preview_database_id": "local-db"
}
]
}bunx wrangler d1 migrations create my-database create_users
Edit `migrations/0001_create_users.sql`:
CREATE TABLE IF NOT EXISTS users ( user_id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT NOT NULL UNIQUE, username TEXT NOT NULL, created_at INTEGER NOT NULL ); CREATE INDEX IF NOT EXISTS idx_users_email ON users(email); PRAGMA optimize;
# Local bunx wrangler d1 migrations apply my-database --local # Production bunx wrangler d1 migrations apply my-database --remote
import { Hono } from 'hono';
type Bindings = {
DB: D1Database;
};
const app = new Hono<{ Bindings: Bindings }>();
app.get('/users/:email', async (c) => {
const { results } = await c.env.DB.prepare(
'SELECT * FROM users WHERE email = ?'
)
.bind(c.req.param('email'))
.all();
return c.json(results);
});
export default app;**Load `references/setup-guide.md` for complete walkthrough.**
---
1. **Use prepared statements** with `.bind()` (never string concatenation) 2. **Create indexes** for WHERE/JOIN/ORDER BY columns 3. **Use migrations** for schema changes (never manual SQL) 4. **Batch queries** for multiple operations (.batch()) 5. **Run PRAGMA optimize** after schema changes 6. **Handle errors** explicitly (try/catch) 7. **Use INTEGER for timestamps** (Date.now()) 8. **Test locally** before deploying migrations 9. **Use read replicas** for global read performance 10. **Validate input** before SQL queries
1. **Never concatenate** user input into SQL 2. **Never commit database_id** to public repos 3. **Never skip migrations** for schema changes 4. **Never use VARCHAR** (use TEXT instead) 5. **Never skip indexes** for filtered columns 6. **Never ignore** SQLite type affinity rules 7. **Never use SELECT *** without LIMIT 8. **Never run migrations** without testing locally 9. **Never exceed** 1MB per row 10. **Never use DATETIME** (use INTEGER for timestamps)
---
// Single result
const { results } = await env.DB.prepare(
'SELECT * FROM users WHERE email = ?'
)
.bind(email)
.all();
// First result only
const user = await env.DB.prepare(
'SELECT * FROM users WHERE user_id = ?'
)
.bind(userId)
.first();
// Raw results (faster)
const { results } = await env.DB.prepare(
'SELECT username FROM users'
)
.raw(); // Returns arrays instead145 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).
100+ animated React components (Aceternity UI) for Next.js with Tailwind. Use for hero sections, parallax, 3D effects, or…
Secure API authentication with JWT, OAuth 2.0, API keys. Use for authentication systems, third-party integrations,…
Creates comprehensive API changelogs documenting breaking changes, deprecations, and migration strategies for API consumers. Use…
Verifies API contracts between services using consumer-driven contracts, schema validation, and tools like Pact. Use when testing…
Master REST and GraphQL API design principles to build intuitive, scalable, and maintainable APIs that delight developers. Use…
Implements standardized API error responses with proper status codes, logging, and user-friendly messages. Use when building…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.