Expert guide for automated and manual Web Accessibility (a11y) testing — axe-core, Pa11y, Playwright a11y, screen reader testing, and WCAG 2.2 Level AA/AAA compliance / Panduan ahli pengujian aksesibilitas web.
日本語の概要は準備中です。原文の説明を表示しています。
Design and implement multi-tenant SaaS architectures with RLS, tenant isolation, and PostgreSQL / Desain dan implementasikan arsitektur SaaS multi-tenant dengan RLS, isolasi tenant, dan PostgreSQL.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
<a name="english"></a>
Connects and orchestrates with relevant domain skills like brainstorming, zero-to-prod-orchestrator, and session-memory-manager to ensure cohesive execution.
Expert guide for designing and implementing multi-tenant SaaS architectures with full tenant isolation, Supabase/PostgreSQL Row Level Security (RLS), schema-per-org patterns, RBAC, and Super Admin access controls.
| Strategy | Isolation Level | Cost | Complexity | Best For |
|---|---|---|---|---|
| Shared Schema + RLS | Row-level | Low | Medium | Standard SaaS (< 1M tenants) |
| Schema per Org | Table-level | Medium | High | Compliance-heavy (HIPAA, finance) |
| DB per Org | Database-level | High | Very High | Enterprise, regulated industries |
-- Central workspaces (tenants) table
CREATE TABLE workspaces (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
slug TEXT UNIQUE NOT NULL,
plan TEXT NOT NULL DEFAULT 'free' CHECK (plan IN ('free', 'pro', 'enterprise')),
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- Users belong to multiple workspaces via memberships
CREATE TABLE workspace_members (
workspace_id UUID REFERENCES workspaces(id) ON DELETE CASCADE,
user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
role TEXT NOT NULL DEFAULT 'member' CHECK (role IN ('owner', 'admin', 'member', 'viewer')),
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (workspace_id, user_id)
);
-- All tenant data has workspace_id
CREATE TABLE projects (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
workspace_id UUID NOT NULL REFERENCES workspaces(id) ON DELETE CASCADE,
name TEXT NOT NULL,
created_by UUID REFERENCES auth.users(id),
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- Enable RLS on all tenant tables
ALTER TABLE projects ENABLE ROW LEVEL SECURITY;
-- Policy: Users can only see projects in their workspaces
CREATE POLICY "workspace members can view projects"
ON projects FOR SELECT
USING (
workspace_id IN (
SELECT workspace_id FROM workspace_members
WHERE user_id = auth.uid()
)
);
-- Policy: Only admins and owners can create projects
CREATE POLICY "admins can create projects"
ON projects FOR INSERT
WITH CHECK (
workspace_id IN (
SELECT workspace_id FROM workspace_members
WHERE user_id = auth.uid()
AND role IN ('owner', 'admin')
)
);
-- Policy: Super Admin can bypass RLS (service role only)
-- ⚠️ NEVER expose service role key to frontend
To avoid performance bottlenecks, embed workspace_id and role directly into the user's Session JWT (Custom Claims). This allows RLS policies to check the session token directly (auth.jwt()->>'workspace_id') instead of joining the workspace_members table on every query.
-- Helper: Check if current user has a minimum role in a workspace
CREATE OR REPLACE FUNCTION user_has_role(
p_workspace_id UUID,
p_min_role TEXT
) RETURNS BOOLEAN AS $$
DECLARE
role_hierarchy TEXT[] := ARRAY['viewer', 'member', 'admin', 'owner'];
user_role TEXT;
BEGIN
SELECT role INTO user_role
FROM workspace_members
WHERE workspace_id = p_workspace_id AND user_id = auth.uid();
RETURN (
array_position(role_hierarchy, user_role) >=
array_position(role_hierarchy, p_min_role)
);
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
For regulated industries requiring strict data separation:
-- Dynamically create a schema for each new tenant
CREATE OR REPLACE FUNCTION create_tenant_schema(p_slug TEXT) RETURNS VOID AS $$
BEGIN
EXECUTE format('CREATE SCHEMA IF NOT EXISTS tenant_%s', p_slug);
-- Create all tenant tables in the new schema
EXECUTE format('
CREATE TABLE tenant_%s.projects (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
)', p_slug);
END;
$$ LANGUAGE plpgsql;
-- Bypass pattern: set search_path per connection
SET search_path TO tenant_acme, public;
SELECT * FROM projects; -- Reads from tenant_acme.projects only
Super Admin is a separate system that operates across all tenants with elevated privileges:
// Super Admin routes are ONLY accessible at admin.yourdomain.com
// Enforced at DNS + middleware level
// middleware.ts — verify super admin domain
if (hostname === 'admin.yourdomain.com') {
const session = await verifyAdminSession(req);
if (!session?.user.isSuperAdmin) {
return NextResponse.redirect('https://yourdomain.com');
}
}
-- Super Admin uses service role to bypass RLS
-- admin.sql — queries bypass all RLS policies when using service role key
-- Cross-tenant query (only accessible with service role)
SELECT w.name, COUNT(wm.user_id) as member_count, w.plan
FROM workspaces w
LEFT JOIN workspace_members wm ON w.id = wm.workspace_id
GROUP BY w.id
ORDER BY member_count DESC;
type Role = 'owner' | 'admin' | 'member' | 'viewer';
const ROLE_PERMISSIONS: Record<Role, string[]> = {
owner: ['*'], // All permissions
admin: ['project:create', 'project:delete', 'member:invite', 'member:remove'],
member: ['project:create', 'project:read', 'project:update'],
viewer: ['project:read'],
};
function can(userRole: Role, permission: string): boolean {
const perms = ROLE_PERMISSIONS[userRole];
return perms.includes('*') || perms.includes(permission);
}
// Usage in API handler
if (!can(currentMember.role, 'project:delete')) {
throw new ForbiddenError('Insufficient permissions');
}
zero-to-prod-orchestrator or SaaS design lock in brainstorming.database-orm-expert and security audit / App Check rules to supabase-security-expert.saas-billing and payment-gateway-expert.admin.yourdomain.com) to cloud-hosting-expert.saas-architect when upgrading single-tenant apps to multi-tenant.<a name="bahasa-indonesia"></a>
Terhubung dan mengorkestrasi skill domain yang relevan seperti brainstorming, zero-to-prod-orchestrator, dan session-memory-manager untuk memastikan eksekusi yang kohesif.
Panduan ahli untuk merancang dan mengimplementasikan arsitektur SaaS multi-tenant dengan isolasi tenant penuh, Row Level Security (RLS) Supabase/PostgreSQL, pola schema-per-org, RBAC, dan kontrol akses Super Admin.
| Strategi | Level Isolasi | Biaya | Kompleksitas | Terbaik Untuk |
|---|---|---|---|---|
| Shared Schema + RLS | Row-level | Rendah | Sedang | SaaS standar (< 1M tenant) |
| Schema per Org | Table-level | Sedang | Tinggi | Kepatuhan ketat (HIPAA, keuangan) |
| DB per Org | Database-level | Tinggi | Sangat Tinggi | Enterprise, industri teratur |
Rancang tabel workspaces (tenant), workspace_members (keanggotaan + role), dan semua tabel data dengan kolom workspace_id. Terapkan RLS agar pengguna hanya dapat melihat data workspace mereka sendiri.
Untuk menghindari bottleneck performa, sematkan workspace_id dan role langsung ke dalam Session JWT pengguna (Custom Claims). Ini memungkinkan kebijakan RLS untuk memeriksa token sesi secara langsung (auth.jwt()->>'workspace_id') daripada melakukan join ke tabel workspace_members pada setiap query.
Buat fungsi user_has_role() yang dapat digunakan kembali di seluruh kebijakan RLS untuk memeriksa apakah pengguna saat ini memiliki role minimum yang diperlukan dalam workspace tertentu.
Untuk industri teratur yang membutuhkan pemisahan data ketat. Buat schema PostgreSQL terpisah untuk setiap tenant secara dinamis. Atur search_path per koneksi untuk mengarahkan query ke schema tenant yang benar.
Super Admin adalah sistem terpisah yang beroperasi di semua tenant dengan hak istimewa yang ditingkatkan. Hanya dapat diakses di admin.yourdomain.com — diberlakukan di level DNS dan middleware. Menggunakan service role key Supabase untuk mem-bypass RLS dan melakukan query lintas tenant.
Definisikan peta izin per role (owner, admin, member, viewer) dan fungsi can() helper untuk memeriksa izin dalam API handler.
zero-to-prod-orchestrator atau saat finalisasi SaaS di brainstorming.database-orm-expert dan audit keamanan / RLS ke supabase-security-expert.saas-billing dan payment-gateway-expert.admin.domain.com) ke cloud-hosting-expert.saas-architect saat mentransformasi aplikasi single-tenant ke multi-tenant.まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Expert guide for automated and manual Web Accessibility (a11y) testing — axe-core, Pa11y, Playwright a11y, screen reader testing, and WCAG 2.2 Level AA/AAA compliance / Panduan ahli pengujian aksesibilitas web.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for intelligent model cascading and routing — complexity-scored task routing from Flash/Haiku to Sonnet/Opus/Astra, dynamic escalation with quality gates, 40-60% token cost reduction while maintaining output quality / Panduan ahli untuk kaskade dan routing model cerdas — routing tugas berbasis skor kompleksitas dari Flash/Haiku ke Sonnet/Opus/Astra, eskalasi dinamis dengan gerbang kualitas, pengurangan biaya token 40-60% dengan kualitas output terjaga.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for Affective Computing, emotional AI, and real-time sentiment analysis through native multimodal tokens (voice intonation and facial micro-expressions) / Panduan ahli komputasi afektif, AI emosional, dan analisis sentimen real-time melalui token multimodal native.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for AI-assisted coding workflows — agentic code generation, multi-agent code swarms, self-healing CI/CD, automated PR review, spec-to-code pipelines, codebase knowledge graphs, and human-in-the-loop approval gates / Panduan ahli untuk workflow pengkodean berbasis AI — generasi kode agentic, code swarm multi-agen, CI/CD self-healing, review PR otomatis, pipeline spec-to-code, knowledge graph codebase, dan gate persetujuan human-in-the-loop.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for long-term episodic memory integration (Mem0 v2, Letta/MemGPT, Zep v2), memory tier architecture, pgvector HNSW storage, and unified context management for autonomous AI agents / Panduan ahli untuk integrasi memori episodik jangka panjang (Mem0 v2, Letta/MemGPT, Zep v2), arsitektur tier memori, penyimpanan pgvector HNSW, dan manajemen konteks terpadu untuk agen AI otonom.
日本語の概要は準備中です。原文の説明を表示しています。
Expert guide for designing Machine-to-Machine (M2M) micro-economies, autonomous agent wallets, and swarm budget allocation / Panduan ahli merancang ekonomi mikro antar-agen (M2M), dompet agen otonom, dan alokasi anggaran swarm.
日本語の概要は準備中です。原文の説明を表示しています。