api-patterns

Automate secure API routes with RLS, Zod validation, and error handling.

395|84|Updated Oct 5, 2025
One-click install
npx skills add https://github.com/bybren-llc/wtfb-safe-agentic-workflow --skill api-patterns-bybren-llc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: api-patterns
Source: https://github.com/bybren-llc/wtfb-safe-agentic-workflow/tree/main/.claude/skills/api-patterns
Command: npx skills add https://github.com/bybren-llc/wtfb-safe-agentic-workflow --skill api-patterns-bybren-llc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

API route patterns with RLS, Zod validation, and error handling.

Core Features & Use Cases

  • RLS Context APIs: user/admin
  • Zod Validation: request validation
  • Webhook Handling: pattern
  • Bonus Content: protected content route

Quick Start

Create a protected API route using RLS and Zod validation

Frequently Asked Questions about api-patterns

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

FAQPage Schema
How do I build secure API routes with RLS and validation?▼

RLS (Row Level Security) API routes enforce user-scoped data access through context wrappers combined with Zod validation for request schemas. This Skill automates implementing protected endpoints that validate incoming requests, apply RLS context, and return structured error responses with appropriate HTTP status codes.

What's the best way to validate API requests and responses?▼

Use Zod schemas to validate request and response payloads before processing. This Skill applies Zod validation patterns across CRUD endpoints, webhook handlers, and protected routes to catch malformed data early and return consistent validation errors with proper HTTP status codes.

How do I implement webhook handling in APIs?▼

Webhook handling requires validation of incoming payloads, idempotency checks, and structured error responses. This Skill provides webhook patterns that integrate Zod validation and error handling to safely process external event data while maintaining API security and consistency.

Can I use RLS with standard CRUD endpoints?▼

Yes. This Skill wraps CRUD operations in RLS context to restrict data access by user or admin role. It combines RLS context wrappers with Zod validation and error handling across create, read, update, and delete operations to enforce access control automatically.

What error handling patterns should API routes follow?▼

Structured error responses with appropriate HTTP status codes ensure consistent API feedback. This Skill implements error handling that pairs validation failures with 400 responses, RLS violations with 403, and server errors with 500, all with standardized response formats.

Do I need RLS for every protected API route?▼

RLS context wrappers are essential for user or admin routes to prevent unauthorized data access. This Skill enforces RLS patterns across all protected endpoints, ensuring that user-scoped and admin routes automatically restrict results to appropriate data based on context.