jpskill.com
🛠️ 開発・MCP コミュニティ

supabase-cli

ローカル開発環境の構築、データベースの移行管理、プロジェクト管理、クラウドへのデプロイなど、Supabase CLIを使った作業を効率的に進めるためのコマンド実行を支援するSkill。

📜 元の英語説明(参考)

Supabase CLI commands for local development, migrations, project management, and deployment. Use when working with Supabase CLI, starting local dev, managing migrations, or deploying changes.

🇯🇵 日本人クリエイター向け解説

一言でいうと

ローカル開発環境の構築、データベースの移行管理、プロジェクト管理、クラウドへのデプロイなど、Supabase CLIを使った作業を効率的に進めるためのコマンド実行を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o supabase-cli.zip https://jpskill.com/download/9501.zip && unzip -o supabase-cli.zip && rm supabase-cli.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9501.zip -OutFile "$d\supabase-cli.zip"; Expand-Archive "$d\supabase-cli.zip" -DestinationPath $d -Force; ri "$d\supabase-cli.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して supabase-cli.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → supabase-cli フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Supabase CLI Skill

Supabase 開発のための完全な CLI コマンドリファレンスです。

クイックリファレンス

タスク コマンド
CLI のインストール npm install supabase --save-dev
ログイン supabase login
プロジェクトの初期化 supabase init
リモートへのリンク supabase link --project-ref <ref>
ローカルスタックの起動 supabase start
ローカルスタックの停止 supabase stop
ステータスの確認 supabase status
マイグレーションの作成 supabase migration new <name>
リモートへのプッシュ supabase db push
リモートからのプル supabase db pull
ローカル DB のリセット supabase db reset
型の生成 supabase gen types typescript --local > types.ts

インストール

# NPM (プロジェクト推奨)
npm install supabase --save-dev
npx supabase [command]

# Homebrew (macOS/Linux)
brew install supabase/tap/supabase

# Scoop (Windows)
scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
scoop install supabase

前提条件: Docker (ローカル開発に必要)

プロジェクトのセットアップ

プロジェクトの初期化

supabase init

作成されるファイル:

  • supabase/config.toml - 設定ファイル
  • supabase/migrations/ - マイグレーションファイル
  • supabase/seed.sql - シードデータ

リモートプロジェクトへのリンク

supabase link --project-ref <project-ref>

プロジェクトの ref は以下から取得: ダッシュボード → プロジェクト設定 → 一般

ローカル開発

ローカルスタックの起動

supabase start

起動されるもの:

  • PostgreSQL データベース
  • PostgREST API
  • GoTrue Auth
  • Realtime サーバー
  • Storage サービス
  • Studio ダッシュボード
  • Inbucket (メールテスト)

出力される URL:

API URL: http://localhost:54321
DB URL: postgresql://postgres:postgres@localhost:54322/postgres
Studio URL: http://localhost:54323
Inbucket URL: http://localhost:54324

ローカルスタックの停止

# 停止してデータを保存
supabase stop

# 停止してすべてのデータを削除
supabase stop --no-backup

ステータスの確認

supabase status

URL、API キー、サービスステータスを表示します。

データベースコマンド

マイグレーションの作成

supabase migration new create_users_table

作成されるファイル: supabase/migrations/<timestamp>_create_users_table.sql

変更からのマイグレーションの生成

# ローカルで変更を行い、マイグレーションを生成
supabase db diff -f my_schema_changes

# 特定のスキーマに対して差分を取る
supabase db diff -f changes --schema public,extensions

マイグレーションの適用

# 保留中のマイグレーションをローカルに適用
supabase migration up

# リモートにプッシュ
supabase db push

# プッシュされる内容をプレビュー
supabase db push --dry-run

リモートの変更のプル

supabase db pull

ダッシュボードの変更からマイグレーションを作成します。

ローカルデータベースのリセット

supabase db reset

データベースを再作成し、すべてのマイグレーションを適用します。

マイグレーションの一覧表示

supabase migration list

ローカルとリモートのマイグレーションステータスを表示します。

マイグレーションのロールバック

# 最後の n 個のマイグレーションをロールバック
supabase migration down --count 1

# 特定の数をロールバック
supabase migration down --count 3

マイグレーションのスカッシュ

# 複数のマイグレーションを 1 つに結合
supabase migration squash --version 20240101000000

# 指定されたバージョンまでのすべてのマイグレーションをスカッシュ
supabase migration squash --version <target_version>

リリース前にマイグレーション履歴を整理するのに役立ちます。

型生成

TypeScript 型の生成

# ローカルデータベースから
supabase gen types typescript --local > database.types.ts

# リンクされたリモートから
supabase gen types typescript --linked > database.types.ts

# 特定のプロジェクトから
supabase gen types typescript --project-id "your-id" > database.types.ts

Edge Functions

Function の作成

supabase functions new hello-world

作成されるファイル: supabase/functions/hello-world/index.ts

ローカルでの提供

# すべての Function を提供
supabase functions serve

# 特定の Function を提供
supabase functions serve hello-world

# env ファイルを使用し、JWT を検証しない
supabase functions serve --env-file .env --no-verify-jwt

デプロイ

# すべての Function をデプロイ
supabase functions deploy

# 特定の Function をデプロイ
supabase functions deploy hello-world

# JWT 検証なしでデプロイ (webhook 用)
supabase functions deploy webhook-handler --no-verify-jwt

Function のテスト

curl -i --request POST \
  'http://localhost:54321/functions/v1/hello-world' \
  --header 'Authorization: Bearer <ANON_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{"name":"Functions"}'

シークレット管理

# シークレットの設定
supabase secrets set API_KEY=abc123

# 複数のシークレットの設定
supabase secrets set API_KEY=abc123 DB_PASSWORD=secret

# .env ファイルからの設定
supabase secrets set --env-file .env

# シークレットの一覧表示
supabase secrets list

# シークレットの削除
supabase secrets unset API_KEY

プロジェクト管理

# 組織の一覧表示
supabase orgs list

# プロジェクトの一覧表示
supabase projects list

# プロジェクトの作成
supabase projects create <name> --org-id <id> --region <region>

# プロジェクトの削除
supabase projects delete --project-ref <ref>

# ローカルからリモート設定を更新
supabase projects update-config

データベースの検査

# キャッシュヒット率
supabase inspect db cache-hit --linked

# 未使用のインデックス
supabase inspect db unused-indexes --local

# テーブルの肥大化
supabase inspect db bloat --linked

# 長時間実行されているクエリ
supabase inspect db long-running-queries --linked

# アクティブな接続
supabase inspect db role-connections --linked

バックアップとリストア

バックアップ

# ロールをダンプ
supabase db dump --linked -f roles.sql --role-only

# スキーマをダンプ
supabase db dump --linked -f schema.sql

# データをダンプ
supabase db dump --linked -f data.sql --use-copy --data-only

リストア

psql --single-transaction \
  --file roles.sql \
  --file schema.sql \
  --command 'SET session_replication_role = replica' \
  --file data.sql \
  --dbname [CONNECTION_STRING]

共通フラグ

フラグ 説明
--debug Ve
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Supabase CLI Skill

Complete CLI command reference for Supabase development.

Quick Reference

Task Command
Install CLI npm install supabase --save-dev
Login supabase login
Init project supabase init
Link to remote supabase link --project-ref <ref>
Start local stack supabase start
Stop local stack supabase stop
Check status supabase status
Create migration supabase migration new <name>
Push to remote supabase db push
Pull from remote supabase db pull
Reset local DB supabase db reset
Generate types supabase gen types typescript --local > types.ts

Installation

# NPM (recommended for projects)
npm install supabase --save-dev
npx supabase [command]

# Homebrew (macOS/Linux)
brew install supabase/tap/supabase

# Scoop (Windows)
scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
scoop install supabase

Prerequisites: Docker (required for local development)

Project Setup

Initialize Project

supabase init

Creates:

  • supabase/config.toml - Configuration file
  • supabase/migrations/ - Migration files
  • supabase/seed.sql - Seed data

Link to Remote Project

supabase link --project-ref <project-ref>

Get project ref from: Dashboard → Project Settings → General

Local Development

Start Local Stack

supabase start

Starts:

  • PostgreSQL database
  • PostgREST API
  • GoTrue Auth
  • Realtime server
  • Storage service
  • Studio dashboard
  • Inbucket (email testing)

Output URLs:

API URL: http://localhost:54321
DB URL: postgresql://postgres:postgres@localhost:54322/postgres
Studio URL: http://localhost:54323
Inbucket URL: http://localhost:54324

Stop Local Stack

# Stop and save data
supabase stop

# Stop and delete all data
supabase stop --no-backup

Check Status

supabase status

Shows URLs, API keys, and service status.

Database Commands

Create Migration

supabase migration new create_users_table

Creates: supabase/migrations/<timestamp>_create_users_table.sql

Generate Migration from Changes

# Make changes locally, then generate migration
supabase db diff -f my_schema_changes

# Diff against specific schemas
supabase db diff -f changes --schema public,extensions

Apply Migrations

# Apply pending migrations locally
supabase migration up

# Push to remote
supabase db push

# Preview what would be pushed
supabase db push --dry-run

Pull Remote Changes

supabase db pull

Creates migration from Dashboard changes.

Reset Local Database

supabase db reset

Recreates database and applies all migrations.

List Migrations

supabase migration list

Shows local vs remote migration status.

Rollback Migrations

# Rollback last n migrations
supabase migration down --count 1

# Rollback specific number
supabase migration down --count 3

Squash Migrations

# Combine multiple migrations into one
supabase migration squash --version 20240101000000

# Squash all migrations up to version
supabase migration squash --version <target_version>

Useful for cleaning up migration history before release.

Type Generation

Generate TypeScript Types

# From local database
supabase gen types typescript --local > database.types.ts

# From linked remote
supabase gen types typescript --linked > database.types.ts

# From specific project
supabase gen types typescript --project-id "your-id" > database.types.ts

Edge Functions

Create Function

supabase functions new hello-world

Creates: supabase/functions/hello-world/index.ts

Serve Locally

# Serve all functions
supabase functions serve

# Serve specific function
supabase functions serve hello-world

# With env file and no JWT
supabase functions serve --env-file .env --no-verify-jwt

Deploy

# Deploy all functions
supabase functions deploy

# Deploy specific function
supabase functions deploy hello-world

# Deploy without JWT verification (for webhooks)
supabase functions deploy webhook-handler --no-verify-jwt

Test Function

curl -i --request POST \
  'http://localhost:54321/functions/v1/hello-world' \
  --header 'Authorization: Bearer <ANON_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{"name":"Functions"}'

Secrets Management

# Set secret
supabase secrets set API_KEY=abc123

# Set multiple secrets
supabase secrets set API_KEY=abc123 DB_PASSWORD=secret

# Set from .env file
supabase secrets set --env-file .env

# List secrets
supabase secrets list

# Remove secret
supabase secrets unset API_KEY

Project Management

# List organizations
supabase orgs list

# List projects
supabase projects list

# Create project
supabase projects create <name> --org-id <id> --region <region>

# Delete project
supabase projects delete --project-ref <ref>

# Update remote config from local
supabase projects update-config

Database Inspection

# Cache hit ratio
supabase inspect db cache-hit --linked

# Unused indexes
supabase inspect db unused-indexes --local

# Table bloat
supabase inspect db bloat --linked

# Long running queries
supabase inspect db long-running-queries --linked

# Active connections
supabase inspect db role-connections --linked

Backup & Restore

Backup

# Dump roles
supabase db dump --linked -f roles.sql --role-only

# Dump schema
supabase db dump --linked -f schema.sql

# Dump data
supabase db dump --linked -f data.sql --use-copy --data-only

Restore

psql --single-transaction \
  --file roles.sql \
  --file schema.sql \
  --command 'SET session_replication_role = replica' \
  --file data.sql \
  --dbname [CONNECTION_STRING]

Common Flags

Flag Description
--debug Verbose output
--local Use local database
--linked Use linked remote
--project-ref <ref> Specific project
--db-url <url> Connection string
--dry-run Preview without executing
-f <file> Output to file

References