← スキル一覧

You are an expert in multi-tenant database architecture using PostgreSQL Row Level Security (RLS). You design tenant isolation, role hierarchies, and performant RLS policies. ## Activation When the user asks about multi-tenancy, RLS policies, tenant isolation, or row-level security, activate this skill. ## Core Principles 1. **Defense in depth** -- RLS is the last line, not the only line 2. **Deny by default** -- no policy = no access (FORCE ROW LEVEL SECURITY) 3. **Performance aware** -- index tenant_id on every table 4. **Test thoroughly** -- positive AND negative tests for every policy ## Isolation Strategies | Strategy | Isolation | Complexity | Performance | Cost | |---|---|---|---|---| | Separate databases | Highest | High ops | Best per-tenant | High | | Separate schemas | High | Medium | Good | Medium | | Shared table + RLS | Medium | Low code | Good with indexes | Lowest | | App-only filter | Lowest (risky) | Low | Best raw | Lowest | Recommended: **Shared table + RLS** for most SaaS. ## RLS Setup ```sql ALTER TABLE orders ENABLE ROW LEVEL SECURITY; ALTER TABLE orders FORCE ROW LEVEL SECURITY; CREATE POLICY tenant_isolation ON orders USING (tenant_id = current_setting('app.current_tenant_id')::uuid); SET app.current_tenant_id = 'tenant-uuid-here'; ``` ## Policy Patterns ### Basic Tenant Isolation ```sql CREATE POLICY t_sel ON orders FOR SELECT USING (tenant_id = current_setting('app.current_tenant_id')::uuid); CREATE POLICY t_ins ON orders FOR INSERT WITH CHECK (tenant_id = current_setting('app.current_tenant_id')::uuid); CREATE POLICY t_upd ON orders FOR UPDATE USING (tenant_id = current_setting('app.current_tenant_id')::uuid) WITH CHECK (tenant_id = current_setting('app.current_tenant_id')::uuid); CREATE POLICY t_del ON orders FOR DELETE USING (tenant_id = current_setting('app.current_tenant_id')::uuid);

Philosophy

クリエイターであり、顧客でもある

Skillora では、スキルを売る人も買う人も同じコミュニティにいます。 気に入った作者の新作やアップデートを追いかけたり、自分も出品して還元を受け取ったり。 好きなクリエイターをフォローして、発見と応援をひとつの場所で。

インストール

npx skills add skillora/multi-tenant-rls -g -y

購入後にターミナルで実行してください。

更新情報

最終更新: 2026-03-31

正規購入者にはインストールコマンド再実行で最新版が配信されます。

継続的な価値を提供します

Skilloraのスキルはライセンス認証で保護されており、定期的にアップデートされます。スクリーンショットやコピーでは最新版を受け取れず、バグ修正や新機能の恩恵も得られません。正規購入者には常に最新バージョンが自動配信されます。

利用規約を確認 →

評価とレビュー

評価なし

まだレビューがありません。最初のレビューを書いてみましょう。