IM

A robust way to sync production data into a local D1 development database.

Install

mkdir -p .claude/skills/import-d1-database && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10254" && unzip -o skill.zip -d .claude/skills/import-d1-database && rm skill.zip

Installs to .claude/skills/import-d1-database

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Import or refresh a Cloudflare D1 database locally from a remote export when direct SQL dump execution fails because of foreign key ordering, transaction limitations, or wrangler import quirks. Use this skill when syncing production D1 data into the local development database.
277 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • →Refresh local D1 from remote
  • →Handle foreign key ordering
  • →Sync production data to local
  • →Restore local database state

How it works

The script extracts INSERT statements from a remote export, reorders them to satisfy dependency constraints, and executes them against a fresh local state directory.

Inputs & outputs

You give it
Remote D1 SQL export
You get back
Populated local D1 SQLite state

When to use import-d1-database

  • →Refresh local d1 data
  • →Sync production to local
  • →Restore database state

About import-d1-database

Automates the import process for D1 databases, handling foreign key ordering and transaction constraints that typically break raw SQL imports.

Import or refresh a Cloudflare D1 database locally from a remote export when direct SQL dump execution fails because of foreign key ordering, transaction limitations, or wrangler import quirks. Use this skill when syncing production D1 data into the local development database.

When not to use it

  • →Schema design
  • →Schema migrations

Prerequisites

Cloudflare account IDSource database nameTarget state directoryFresh export file path

Limitations

  • →Requires manual restoration of players.currentRankingId
  • →Does not support schema migrations
  • →Requires stopping all local dev processes

How it compares

Unlike raw SQL imports that fail due to transaction or foreign key restrictions, this script uses a controlled, dependency-aware insertion order.

Compared to similar skills

import-d1-database side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
import-d1-database (this skill)04moReviewIntermediate
drizzle-orm323moNo flagsIntermediate
event-store-design54moNo flagsAdvanced
backend-development176moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry