Supabase test harness patterns including local Supabase setup, test user creation via Auth Admin API, RLS testing, migration testing (db_reset), seed sequences, rate limiting, and environment detection. Use when setting up Supabase testing infrastructure, creating test users, troubleshooting Supabase test failures, or implementing RLS validation. Triggers on: supabase test setup, test user creation, supabase local testing, RLS testing, migration testing, supabase test harness, auth test helpers.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Supabase test harness patterns including local Supabase setup, test user creation via Auth Admin API, RLS testing, migration testing (db_reset), seed sequences, rate limiting, and environment detection. Use when setting up Supabase testing infrastructure, creating test users, troubleshooting Supabase test failures, or implementing RLS validation. Triggers on: supabase test setup, test user creation, supabase local testing, RLS testing, migration testing, supabase test harness, auth test helpers.
allowed-tools
["Read"]
triggers
["supabase test setup","test user creation","supabase local testing","RLS testing","migration testing","supabase test harness","auth test helpers","supabase db reset test","supabase seed sequence","auth admin api test","supabase rate limiting"]
version
1.0.0
===SUPABASE_TEST_HARNESS===
META:
TYPE::SKILL
VERSION::"1.0.0"
STATUS::ACTIVE
PURPOSE::"Supabase test harness patterns: local setup, Auth Admin API test users, RLS validation, migration testing, seed sequences, rate limiting, environment detection"
PROVEN_INFRASTRUCTURE::"/Volumes/HestAI-Projects/eav-ops/eav-apps/scripts-web/src/test/"
FILES::[
supabase-test-client.ts::"Test client with environment detection, fail-fast guards",
auth-helpers.ts::"Auth utilities with rate limiting (750ms delay)"
]
OPERATIONAL_SCRIPTS::"/Volumes/HestAI-Projects/eav-ops/eav-apps/scripts-web/scripts/"
FILES::[
create-test-users-via-api.mjs::"Test user creation via Auth Admin API (used by CI)"
]
§4::CRITICAL_PATTERNS_POC_PROVEN
PATTERN_1::MIGRATION_TESTING::[
USE::supabase_db_reset_local[NOT_db_push],
BECAUSE::"EMERGENCY FIX 2025-10-26 — db push fails with complex trigger functions",
EVIDENCE::POC_ci.yml:105
]
PATTERN_6::SEED_SEQUENCE::[
ORDER::migrations→test_users_via_auth_api→seed_data_via_sql,
BECAUSE::"Order matters for FK constraints (users must exist before data references them)",
EVIDENCE::POC_ci.yml:100-168
]
§5::TEST_USERS_STANDARDIZED
ADMIN_EMAIL::admin.test@example.com
CLIENT_EMAIL::client.test@example.com
UNAUTH_EMAIL::unauthorized.test@example.com
PASSWORDS::"see .env — TEST_USER_ADMIN_PASSWORD, TEST_USER_CLIENT_PASSWORD, TEST_USER_UNAUTH_PASSWORD"
NOTE::"Emails are stable test fixtures. Passwords come from .env — never hardcode credentials."
SOURCE::POC_src/test/supabase-test-client.ts:102-115
PATH_EXCLUSIONS::["packages//src/test/**", "apps//src/test/", "/.test.ts", "**/.test.tsx"]
PATTERN_EXCLUSIONS::["test-mock-.*", "test-project\.supabase\.co", "127\.0\.0\.1:54321", "test-password-(admin|client|unauth)-123"]
RATIONALE::"Real credentials in .env (gitignored), test fixtures non-functional"
§8::AGENT_CONSULTATION
CONSULT::[
security-specialist::"Credential management, GitGuardian patterns, test data isolation",
critical-engineer::"Production risk from test infrastructure failures",
universal-test-engineer::"Actual test writing (delegate, don't implement)"
]