n8n-pilot: Command for Claude Code

.claude/commands/db-migrate.md

db-migrate is a command for Claude Code from AI-agents-incubator/n8n-pilot. It costs 9 tokens per session (2,220 once invoked), scanned A, original, MIT.

A guided command for creating a database migration, which is a controlled change to a database's structure or data. It first examines the current schema and recent migrations, then plans and tests a safer change.

In plain words
What is it for?
Use it when adding tables, columns, indexes, or constraints, or when changing or removing existing database fields. It also considers data preservation, compatibility, and required downtime.
Why use it?
It helps prevent lost data, broken dependencies, and unsafe production changes by checking existing database state and distinguishing safer changes from risky ones.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions Claude Code.

This is AI-agents-incubator/n8n-pilot's own configuration. It tells Claude Code how to work on n8n-pilot itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything n8n-pilot configures →

Reuse

Borrowing it

Nothing to install: this file belongs to AI-agents-incubator/n8n-pilot. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/AI-agents-incubator/n8n-pilot/main/.claude/commands/db-migrate.md
Clone the repo
git clone --depth 1 https://github.com/AI-agents-incubator/n8n-pilot

Made for: Claude Code.

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 db-migrate

README.md
[![agentmods](https://agentmods.dev/badge/commands/ai-agents-incubator/n8n-pilot/db-migrate/github.svg)](https://agentmods.dev/commands/ai-agents-incubator/n8n-pilot/db-migrate)
Your own site
<a href="https://agentmods.dev/commands/ai-agents-incubator/n8n-pilot/db-migrate"><img src="https://agentmods.dev/badge/commands/ai-agents-incubator/n8n-pilot/db-migrate/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 db-migrate

Your own site · 80×15
<a href="https://agentmods.dev/commands/ai-agents-incubator/n8n-pilot/db-migrate"><img src="https://agentmods.dev/badge/commands/ai-agents-incubator/n8n-pilot/db-migrate.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9 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,220 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.00009 $0.02220
Opus 5 $0.00005 $0.01110
Sonnet 5 $0.00002 $0.00444
Haiku 4.5 $0.00001 $0.00222

Measured 5d ago against content hash cb9a2b836b5b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

db-migrate 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 5d 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.

.claude/commands/db-migrate.md · 340 lines

How it starts

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

Создай database migration следуя лучшим практикам.

ВАЖНО: Миграции - критическая часть. Тестируй все тщательно!

Процесс:

1. Анализ текущей схемы БД

Прочитай и проанализируй:

# Найди файлы схемы БД
find . -name "schema.*" -o -name "*.prisma" -o -name "*migration*"

# Посмотри последние миграции
ls -la supabase/migrations/ || ls -la prisma/migrations/ || ls -la migrations/

Прочитай:

  • Текущую схему БД
  • Последние миграции
  • Database documentation (если есть в ARCHITECTURE.md)

2. Пойми требования

Спроси себя:

  • Какие изменения в схеме нужны?
  • Есть ли существующие данные, которые нужно сохранить?
  • Нужна ли обратная совместимость?
  • Есть ли зависимости от других таблиц?

3. Спланируй миграцию

Типы изменений:

Безопасные (можно делать на проде):

  • ✅ ADD column (с DEFAULT или NULL)
  • ✅ ADD index (concurrent)
  • ✅ ADD new table
  • ✅ ADD constraint (NOT VALID, потом VALIDATE)

Опасные (требуют осторожности):

  • ⚠️ DROP column (может сломать приложение)
  • ⚠️ RENAME column (нужна двухфазная миграция)
  • ⚠️ CHANGE column type (может потерять данные)
  • ⚠️ ADD NOT NULL (сначала заполни данные)

Очень опасные (только с downtime):

  • 🔴 DROP table
  • 🔴 CHANGE primary key
  • 🔴 Большая структурная переделка

4. Создай migration файл

Naming convention:

YYYYMMDDHHMMSS_descriptive_name.sql

Пример: 20250110120000_add_user_preferences_table.sql

Структура миграции:

-- Migration: Add user preferences table
-- Created: 2025-01-10
-- Author: Claude Code
-- Description: Add table to store user preferences with foreign key to users

-- ============================================
-- Up Migration
-- ============================================

BEGIN;

-- Create table
CREATE TABLE IF NOT EXISTS user_preferences (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
  theme VARCHAR(20) DEFAULT 'light' CHECK (theme IN ('light', 'dark', 'auto')),
  language VARCHAR(10) DEFAULT 'en',
  notifications_enabled BOOLEAN DEFAULT true,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),

  -- Constraints
  CONSTRAINT unique_user_preferences UNIQUE(user_id)
);

-- Create indexes
CREATE INDEX idx_user_preferences_user_id ON user_preferences(user_id);

-- Add comments
COMMENT ON TABLE user_preferences IS 'Stores user-specific preferences';
COMMENT ON COLUMN user_preferences.theme IS 'UI theme preference';

-- Enable Row Level Security
ALTER TABLE user_preferences ENABLE ROW LEVEL SECURITY;

-- Create RLS policies
CREATE POLICY "Users can view own preferences"
  ON user_preferences
  FOR SELECT
  USING (auth.uid() = user_id);

CREATE POLICY "Users can update own preferences"
  ON user_preferences
  FOR UPDATE
  USING (auth.uid() = user_id);

CREATE POLICY "Users can insert own preferences"
  ON user_preferences
  FOR INSERT
  WITH CHECK (auth.uid() = user_id);

COMMIT;

-- ============================================
-- Down Migration (Rollback)
-- ============================================

-- Uncomment to enable rollback:
-- BEGIN;
-- DROP TABLE IF EXISTS user_preferences CASCADE;
-- COMMIT;

Read the full file on GitHub · 340 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. 5d ago First seen · 340 lines · 9 tokens per session scan A cb9a2b836b5b

Subscribe to this mod's changes

db-migrate is a command published in the GitHub repository AI-agents-incubator/n8n-pilot (29 stars, last pushed 6mo ago), licensed MIT. It adds 9 tokens to every session and 2,220 once invoked, about $0.0000 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-04.