implement-crud

Implement CRUD operations for Supabase tables with RLS and validation.

1|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/rdimascio/supabase-marketplace --skill implement-crud
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: implement-crud
Source: https://github.com/rdimascio/supabase-marketplace/tree/main/plugins/database-operations/.claude/skills/implement-crud
Command: npx skills add https://github.com/rdimascio/supabase-marketplace --skill implement-crud

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers generate production-ready CRUD operations for Supabase tables, with rigorous validation, error handling, and Row Level Security (RLS). It reduces boilerplate and ensures consistent data access controls.

Core Features & Use Cases

  • Read & List: Fetch single records or lists with filters and pagination.
  • Create/Update/Delete: Create new records, update partially, soft/hard delete strategies, and proper error handling.
  • RLS & Validation: Enforce data access rules and input validation to prevent insecure operations.
  • Use Case: Build a complete user profile API with typed inputs and guaranteed access control.

Quick Start

Create CRUD operations for the posts table with id, title, content, and author_id; enable RLS; provide read/list/create/update/delete examples.

Frequently Asked Questions about implement-crud

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

FAQPage Schema
How do I implement CRUD operations with Row-Level Security in Supabase?

Row-Level Security (RLS) in Supabase enforces data access controls at the database level. Enable RLS on your table, define policies that match user ownership or roles, then implement Create, Read, Update, and Delete operations that respect those policies. This ensures users can only access their own records without additional application-layer checks.

What's the best way to handle validation and errors in Supabase CRUD operations?

Validate input data before sending requests—check required fields, data types, and constraints. Structure error responses consistently with status codes and messages. Handle duplicate-key errors, foreign-key violations, and RLS policy rejections. Log errors server-side for debugging while returning safe, user-friendly messages to clients.

Can I implement soft deletes and hard deletes in Supabase?

Yes. Soft deletes mark records as deleted with a timestamp column while preserving data; filter queries to exclude soft-deleted rows. Hard deletes remove records permanently. Choose soft deletes for audit trails and recovery; use hard deletes for permanent removal. Implement both strategies conditionally based on your data retention requirements.

How do I add pagination and filtering to Supabase list queries?

Use limit and offset parameters to paginate results; apply WHERE clauses or Supabase filters to narrow datasets by column values. Return pagination metadata—current page, total count, and remaining records—alongside results. This enables efficient browsing of large datasets and reduces payload size on mobile or bandwidth-constrained clients.

Do I need type safety for Supabase CRUD operations?

Type safety prevents runtime errors and improves code maintainability. Use TypeScript or your language's type system to define table schemas, request payloads, and response structures. Generate types from your Supabase schema or define them manually. Typed CRUD operations catch mismatches at development time rather than in production.

What ownership validation should I include in CRUD operations?

Ownership validation ensures users modify only their own records. Verify the user's ID matches the record's owner field before allowing updates or deletes. Combine this with RLS policies for defense-in-depth. Log unauthorized access attempts and return permission-denied errors to prevent data leakage or tampering.

Related Skills