rls-patterns

Enforce Row Level Security patterns in Prisma database queries and API routes.

Updated Jul 31, 2026
One-click install
npx skills add https://github.com/vikas-gits-good/Test-SAW-Repo --skill rls-patterns-vikas-gits-good
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rls-patterns
Source: https://github.com/vikas-gits-good/Test-SAW-Repo/tree/main/.gemini/skills/rls-patterns
Command: npx skills add https://github.com/vikas-gits-good/Test-SAW-Repo --skill rls-patterns-vikas-gits-good

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill prevents unauthorized data access and cross-user data leakage by enforcing strict Row Level Security (RLS) patterns across all database operations.

Core Features & Use Cases

  • Context-Aware Security: Provides standardized helpers (withUserContext, withAdminContext, withSystemContext) to ensure every query is scoped correctly.
  • Prisma Guardrails: Eliminates the risk of developers accidentally using direct, insecure Prisma calls.
  • Use Case: When building a multi-tenant SaaS application, use this skill to ensure that a user can only ever query their own subscription data, even if they attempt to modify an API route.

Quick Start

Apply the rls-patterns skill to refactor the current database query to use the appropriate context helper.

Frequently Asked Questions about rls-patterns

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

FAQPage Schema
How do I enforce Row Level Security in Prisma to prevent cross-user data access?

You implement Row Level Security by replacing direct Prisma calls with context helpers like withUserContext and withAdminContext, ensuring every query is scoped correctly to prevent unauthorized data access across users.

What is the best way to isolate multi-tenant SaaS data in backend API routes?

Isolating multi-tenant SaaS data requires applying Row Level Security context helpers to API route handlers, guaranteeing users can only query their own subscription data even if they attempt to modify the route logic.

Why should I avoid direct Prisma calls when building authentication-secured backends?

Direct Prisma calls bypass authentication boundaries and risk cross-user data leakage. Using Row Level Security guardrails eliminates the danger of developers accidentally executing insecure database queries outside the scoped user context.

Do I need specific context helpers for webhook implementations requiring database access?

Webhook implementations requiring database access need specific context helpers like withSystemContext to maintain security boundaries. Wrapping these database interactions ensures data isolation and prevents unauthorized access during webhook processing.

Does Row Level Security work with existing Prisma database queries?

Row Level Security integrates with Prisma by refactoring existing database queries to use appropriate context helpers. This wraps standard Prisma operations to enforce strict security boundaries without losing native Prisma database query capabilities.