cloudflare-d1:create-migration

cloudflare-d1:create-migration is a command for Claude Code from secondsky/claude-skills. It costs 50 tokens per session (2,945 once invoked), scanned A, original, MIT.

A guided command for creating migrations in Cloudflare D1, a managed SQLite database designed to run close to users. It helps turn a planned schema change into SQL and a tested migration.

In plain words
What is it for?
Use it to add or modify tables and columns, create indexes, update existing records, or write custom SQL migrations.
Why use it?
Database structure changes can break existing data or applications when written by hand. This command checks the change and guides you through testing it safely.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: names the AskUserQuestion tool.

Part of the cloudflare-d1 plugin — 1 skill, 2 commands, 2 agents shipped together

Good fit Use it to add or modify tables and columns, create indexes, update existing records, or write custom SQL migrations.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/secondsky/claude-skills/d1-create-migration
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Made for: Claude Code.

Or install cloudflare-d1, the plugin that ships this one along with the rest of its 1 skill, 2 commands, 2 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cloudflare-d1:create-migration

README.md
[![agentmods](https://agentmods.dev/badge/commands/secondsky/claude-skills/d1-create-migration/github.svg)](https://agentmods.dev/commands/secondsky/claude-skills/d1-create-migration)
Your own site
<a href="https://agentmods.dev/commands/secondsky/claude-skills/d1-create-migration"><img src="https://agentmods.dev/badge/commands/secondsky/claude-skills/d1-create-migration/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cloudflare-d1:create-migration

Your own site · 80×15
<a href="https://agentmods.dev/commands/secondsky/claude-skills/d1-create-migration"><img src="https://agentmods.dev/badge/commands/secondsky/claude-skills/d1-create-migration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,945 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00050 $0.02945
Opus 5.5 $0.00020 $0.01178
Sonnet 5.5 $0.00010 $0.00589
Haiku 4.5 $0.00005 $0.00295

Measured 1mo ago against content hash d7ab7ab80136, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cloudflare-d1:create-migration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cloudflare-d1/commands/d1-create-migration.md · 544 lines

How it starts

The opening of the file, as written. The whole thing — 544 lines — stays where its author put it; the contents beside it link to each section on GitHub.

D1 Create Migration Command

Overview

Guided migration creation with validation, SQL generation, and safe testing workflow.

Prerequisites

  • Existing D1 database configured in wrangler.jsonc
  • migrations/ directory exists (created during setup)
  • wrangler CLI available

Steps

Step 1: Migration Type

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


Step 2: Gather Migration Details

Based on migrationType, collect specific details:

If "Add new table":

Ask:

  • Table name: tableName
  • Columns (comma-separated): columnsList
    • Example: "id INTEGER PRIMARY KEY, name TEXT, email TEXT UNIQUE"
  • Add foreign keys? (yes/no): hasForeignKeys
    • If yes, ask: "Which table.column?" → foreignKeyReferences
If "Modify existing table":

Ask:

  • Table name: tableName
  • Change type:
    • "Add column"
    • "Drop column"
    • "Rename column"
    • Store as: changeType
  • Column details: columnDetails
If "Add indexes":

Ask:

  • Table name: tableName
  • Columns to index (comma-separated): indexColumns
  • Index type:
    • "Single column index"
    • "Composite index (multiple columns)"
    • "Unique index"
    • Store as: indexType
If "Data migration":

Ask:

  • Description of data change: description
  • Warning: "Data migrations should be idempotent and tested in staging first. Proceed?"
If "Custom SQL":

Ask:

  • "Provide SQL file path or paste SQL directly"
  • Store as: customSQL

Step 3: Generate Migration File

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:

Read the full file on GitHub · 544 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 544 lines · 50 tokens per session scan A d7ab7ab80136

Subscribe to this mod's changes

cloudflare-d1:create-migration is a command published in the GitHub repository secondsky/claude-skills (231 stars, last pushed today), licensed MIT. It adds 50 tokens to every session and 2,945 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.