crdb-change
Generate CockroachDB SQL and migrations for schema changes. Use when creating migrations, updating the database schema, or when the user mentions migrations, schema changes, or dbinit.sql.
Install
mkdir -p .claude/skills/crdb-change && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5015" && unzip -o skill.zip -d .claude/skills/crdb-change && rm skill.zipInstalls to .claude/skills/crdb-change
About this skill
CockroachDB database changes
Generate database changes for this repository. This includes changes to:
schema/crdb/dbinit.sql- Migrations for changes
Instructions
Follow these steps in order. Do not skip ahead.
Step 0: Read the README
You MUST read schema/crdb/README.adoc first. Pay attention to important instructions and limitations, such as the requirement for idempotency and the inability to rename columns.
Step 1: Ascertain the scope of the request
If not already provided, prompt the user whether they'd like to:
- Perform both a dbinit.sql change and a migration: If this is the case, then:
- Ask the user to describe the changes they'd like to perform to
dbinit.sql. - Make those changes, asking the user followup questions as necessary.
- Go directly to step 3, with the scope of the migration being to cover those changes.
- Ask the user to describe the changes they'd like to perform to
- Write migrations for pre-existing changes: In this case, changes need to be fetched from version control. Go to step 2.
Step 2: Get the diff
Check if .jj exists in the repository to determine whether to use jj or git commands.
Prompt the user to ask where the schema changes are:
-
Uncommitted changes: Changes not yet committed.
- git:
git diff -- schema/crdb/dbinit.sql(unstaged) orgit diff --cached -- schema/crdb/dbinit.sql(staged) - jj:
jj diff -- schema/crdb/dbinit.sql
- git:
-
This commit only (stacked diff workflow): Changes are in the current commit only.
- git:
git diff HEAD^ -- schema/crdb/dbinit.sql - jj:
jj diff --from @-- -- schema/crdb/dbinit.sql
- git:
-
This branch (feature branch workflow): Changes span the entire branch.
- git:
git diff $(git merge-base HEAD main) -- schema/crdb/dbinit.sql - jj:
jj diff --from 'fork_point(trunk() | @)' -- schema/crdb/dbinit.sql
- git:
If the diff doesn't show anything, ask the user which ref to diff from.
Step 3: Create migration folder
Create a new folder under schema/crdb/ using the provided name or a short descriptive name derived from the schema changes.
Use existing folder names in schema/crdb/ as examples for naming conventions.
NOTE: The numbered folders, e.g. 1.0.0, are for legacy support only. No additional numbered directories should be added.
Step 4: Write migration files
Based on the diff from step 1, write migration files in order:
- Use
up01.sql,up02.sqletc. (zero-padded) if you have more than 10 files. - Use
up1.sql,up2.sqletc. if you have 10 or fewer files. - For Data Definition Language (DDL) statements, one statement per file!
- For Data Modifying Language (DML) statements, multiple statements are allowed per file.
- For
ALTER TABLEwith multiple columns, you can add them all in one statement. - When adding
NOT NULLcolumns to existing tables, add temporary defaults, then remove them in later migration files. - Use
IF NOT EXISTSfor idempotency where supported. - Individual
up.sqlfiles are executed within a transaction (this always happens), and should be idempotent (this is an expectation that the migration author must uphold, with, e.g.IF NOT EXISTS).
Step 5: Update dbinit.sql version
Bump the version number at the end of schema/crdb/dbinit.sql.
Step 6: Update SCHEMA_VERSION
In nexus/db-model/src/schema_versions.rs, bump SCHEMA_VERSION.
Step 7: Add to KNOWN_VERSIONS
In nexus/db-model/src/schema_versions.rs, add the new version to the KNOWN_VERSIONS list.
Step 8: Generate verification files
Run EXPECTORATE=overwrite cargo nextest run -p nexus-db-model 'test_migration_verification_files' to auto-generate .verify.sql files for any migration steps that contain backfill-prone DDL (CREATE INDEX, ADD CONSTRAINT, ALTER COLUMN SET NOT NULL, or ADD COLUMN with NOT NULL / non-null DEFAULT / STORED computed columns). Check in any generated files alongside the migration. If your migration doesn't contain backfill-prone DDL, no files are generated and this step is a no-op.
Step 9: Test the migration
Run cargo nextest run -p omicron-nexus schema to verify that the migration is correct.
Common issues
- Don't guess table names—use the diff from step 1 to find the correct table.
- When adding constraints, always use
IF NOT EXISTSfor idempotency. - For columns with defaults in migration but not in final schema, add the defaults during migration then remove them.
- Don't skip step 1—always run the diff command first to understand what needs to be migrated.
Data migration tests
When creating a migration that affects existing data (like adding columns to existing tables), also add a data migration test in nexus/tests/integration_tests/schema.rs:
- Add
before_X_0_0function to create test data in the old format. - Add
after_X_0_0function to verify the migration worked correctly. - Add the version to the
get_migration_checks()map.
This ensures old rows can be migrated smoothly in production.
You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversTransform any OpenAPI specification into callable tools. Easily test an API, handle authentication, and generate schemas
Quickly rp prototype web apps with Scaffold Generator: create consistent scaffolding using templates, variable substitut
Generate conventional commit messages from staged git changes. Streamline your git amend commit message process with aut
Unlock AI-ready web data with Firecrawl: scrape any website, handle dynamic content, and automate web scraping for resea
Validate Oh My Posh theme configurations quickly and reliably against the official schema to ensure error-free prompts a
Connect Blender to Claude AI for seamless 3D modeling. Use AI 3D model generator tools for faster, intuitive, interactiv
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.