test-as-user

Emulate authenticated database users to test RLS policies in psql.

3|Updated Feb 7, 2026
One-click install
npx skills add https://github.com/GDSDN/kord-aios --skill test-as-user
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-as-user
Source: https://github.com/GDSDN/kord-aios/tree/main/src/features/builtin-skills/kord-aios/qa/test-as-user
Command: npx skills add https://github.com/GDSDN/kord-aios --skill test-as-user

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill allows developers to test Row Level Security (RLS) policies in a database by emulating authenticated users, ensuring data access controls function as intended before deployment.

Core Features & Use Cases

  • User Emulation: Temporarily assume the identity and role of any user for testing purposes.
  • RLS Policy Validation: Execute queries and operations to verify that RLS policies correctly permit or deny access based on user roles and data ownership.
  • Interactive Testing: Provides an interactive psql session pre-configured with emulated user credentials for real-time policy verification.
  • Use Case: Before deploying a new feature that restricts user access to their own data, use this Skill to test if a regular user can only view, update, and delete their own records, and is blocked from accessing others'.

Quick Start

Run the test-as-user skill to emulate user '123e4567-e89b-12d3-a456-426614174000' with the 'authenticated' role.

Frequently Asked Questions about test-as-user

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test Supabase Row Level Security policies for different user roles?

You can test Supabase Row Level Security (RLS) policies by emulating authenticated users and executing queries in an interactive psql session. This approach validates whether SELECT, INSERT, UPDATE, and DELETE operations are correctly permitted or denied based on user roles and data ownership.

Can I emulate an 'anon' or 'service_role' user to verify database access controls?

Yes, you can emulate 'anon', 'authenticated', and 'service_role' users for RLS testing. The emulation sets specific session claims to verify that your database security policies correctly restrict or allow access for each distinct role.

What is the best way to validate RLS policies before deploying new features?

The best way to validate RLS policies is through scenario-based testing in an interactive psql environment. By temporarily assuming a user's identity, you can execute operations to confirm they can only view, update, and delete their own records before deployment.

Does testing RLS policies with emulated users work in a production database environment?

Testing RLS policies with emulated users is not intended for production environments. The Skill includes explicit security warnings against production use, meaning you should restrict scenario-based policy validation to development or staging databases to prevent unauthorized access.

How do I check if a regular user is blocked from accessing other users' records in PostgreSQL?

To check if a user is blocked from accessing other records in PostgreSQL, emulate that authenticated user and attempt cross-record operations. The RLS policy testing will confirm whether the database correctly denies access to data not owned by the emulated session.