home/dot_agents/skills/fix-migration-leftover/SKILL.md
DBマイグレーション失敗時に、別ブランチの残骸(既存のビューやテーブル等)を特定してドロップし、マイグレーションを再実行する。「migration failed」「already exists」「マイグレーションエラー」などと言及された際に使用。
npx skillsauth add kryota-dev/dotfiles fix-migration-leftoverInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
別ブランチで作成されたDBオブジェクト(ビュー、テーブル等)がローカルDBに残っている場合、マイグレーションが already exists エラーで失敗する。
このスキルは、残骸を特定・ドロップしてマイグレーションを再実行する。
relation "xxx" already exists(ビュー、テーブル)type "xxx" already exists(ENUM型)index "xxx" already exists(インデックス)constraint "xxx" already exists(制約)マイグレーションエラー出力から以下を特定する:
"xxx" already exists の xxxCREATE VIEW / CREATE TABLE / CREATE TYPE 等)Failed query に含まれるSQL文docker ps --format "{{.Names}} {{.Image}}" | grep -i postgres
docker exec <コンテナ名> psql -U postgres -c "\l"
開発用DB(spec_tracker_development 等)を使用する。
オブジェクト種別に応じたクエリで存在を確認する:
# ビューの場合
docker exec <コンテナ名> psql -U postgres -d <DB名> -c \
"SELECT viewname FROM pg_views WHERE viewname = '<オブジェクト名>';"
# テーブルの場合
docker exec <コンテナ名> psql -U postgres -d <DB名> -c \
"SELECT tablename FROM pg_tables WHERE tablename = '<オブジェクト名>';"
# ENUM型の場合
docker exec <コンテナ名> psql -U postgres -d <DB名> -c \
"SELECT typname FROM pg_type WHERE typname = '<オブジェクト名>';"
# インデックスの場合
docker exec <コンテナ名> psql -U postgres -d <DB名> -c \
"SELECT indexname FROM pg_indexes WHERE indexname = '<オブジェクト名>';"
AskUserQuestion ツールを使用し、以下を報告した上でドロップの許可を求める:
ユーザーが承認した場合のみ実行する:
# ビューの場合
docker exec <コンテナ名> psql -U postgres -d <DB名> -c \
"DROP VIEW IF EXISTS <オブジェクト名>;"
# テーブルの場合(依存関係に注意)
docker exec <コンテナ名> psql -U postgres -d <DB名> -c \
"DROP TABLE IF EXISTS <オブジェクト名>;"
# ENUM型の場合
docker exec <コンテナ名> psql -U postgres -d <DB名> -c \
"DROP TYPE IF EXISTS <オブジェクト名>;"
# インデックスの場合
docker exec <コンテナ名> psql -U postgres -d <DB名> -c \
"DROP INDEX IF EXISTS <オブジェクト名>;"
pnpm -F @acsim/api db:migrate
spec_tracker_test_worker_* DBも確認するCASCADE オプションの使用をユーザーに確認するdevelopment
`cc-code-review` エージェントを起動して独立したコンテキストでコードレビューを実行する。 現在のセッションのバイアスのないフレッシュな視点で、プロジェクトの CLAUDE.md を踏まえたレビューを行う。 トリガー: "cc-code-review", "ccでレビュー", "別の視点でレビュー", "セカンドオピニオン" 使用場面: (1) PRのコードレビュー (2) ブランチ差分のレビュー (3) 特定ファイルのレビュー (4) 現在の変更のレビュー
tools
Comprehensive guide for the `wtp` (Worktree Plus) CLI by satococoa — an enhanced Git worktree manager. Use this whenever the user wants to create, list, remove, or navigate Git worktrees with wtp, mentions `wtp add`/`wtp cd`/`wtp list`/`wtp remove`/`wtp exec`, asks about automatic worktree paths from branch names, post-create hooks (copy/symlink/command) in `.wtp.yml`, branch tracking for worktrees, or shell integration (`wtp shell-init`, `wtp hook`, tab completion, auto-cd). Trigger this even when the user just describes the workflow — e.g. 'spin up a worktree for this feature branch', 'jump to my auth worktree', 'clean up the worktree and its branch' — without naming wtp explicitly, as long as wtp is the available tool.
tools
Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector).
data-ai
Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.