cloudflare-d1:create-migration

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

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.

Command

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.

agentmods
npx agentmods add commands/secondsky/claude-skills/d1-create-migration
Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
Origin unknown 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 $0.00050 $0.02945
Opus 5 $0.00025 $0.01473
Sonnet 5 $0.00010 $0.00589
Haiku 4.5 $0.00005 $0.00295

Measured today against content hash d7ab7ab80136, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 today.

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. today 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 (214 stars, last pushed yesterday), licensed MIT. It adds 50 tokens to every session and 2,945 once invoked, about $0.0003 per session on Opus 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.