api-design-security

Enforce RBAC, CSRF protection, tenant isolation, and audit logging in Next.js 16 admin APIs.

Updated Dec 26, 2025
One-click install
npx skills add https://github.com/dthompsonfl/crispy-fishstick --skill api-design-security-dthompsonfl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-design-security
Source: https://github.com/dthompsonfl/crispy-fishstick/tree/main/.agent/skills/api-design-security
Command: npx skills add https://github.com/dthompsonfl/crispy-fishstick --skill api-design-security-dthompsonfl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Design and implement secure admin APIs in Next.js 16 that enforce RBAC, CSRF protection, tenant isolation, and comprehensive audit logging.

Core Features & Use Cases

  • Defense-in-depth wrappers (adminRead/adminMutation) for consistent security.
  • Tenant isolation patterns to prevent cross-tenant data access.
  • Safe data selection to avoid exposing sensitive fields.
  • Auditing and compliance support for privileged mutations.

Quick Start

Implement a secured admin API route by choosing the appropriate wrapper, defining a Zod schema, applying tenant scoping, using safe selects, and validating with tests.

Frequently Asked Questions about api-design-security

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

FAQPage Schema
How do I secure admin API routes in Next.js with RBAC and CSRF protection?

Secure admin API routes in Next.js by applying defense-in-depth wrappers like adminRead and adminMutation, which enforce RBAC, CSRF protection, tenant isolation, and audit logging for privileged operations.

How do I prevent cross-tenant data access in a multi-tenant Next.js deployment?

Prevent cross-tenant data access in multi-tenant Next.js deployments by applying tenant isolation patterns that scope database queries and ensure users only interact with their assigned tenant data.

How do I validate input and safely select fields for secure API mutations?

Validate input and select fields safely for secure API mutations by defining a Zod schema for request data and applying safe selection patterns to prevent exposing sensitive fields.

What's the best way to implement audit logging for privileged admin mutations?

Implement audit logging for privileged admin mutations by wrapping operations with standardized security controls that automatically record comprehensive audit logs for compliance tracking.

Do I need Zod to enforce input validation for secure admin APIs?

Yes, you need Zod to enforce input validation for secure admin APIs, as it provides the schema validation required to sanitize inputs before they reach your adminRead or adminMutation operations.