security-best-practices

Enforce RBAC, CSRF, CSP, audit logging, and tenant isolation in Next.js admin portals.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill standardizes and enforces enterprise-grade security practices for Next.js applications, focusing on admin portals, APIs, and multi-tenant deployments.

Core Features & Use Cases

  • RBAC enforcement on API routes and server components to ensure least privilege.
  • CSRF protection and secure session handling to prevent cross-site attacks.
  • Content Security Policy (CSP) hardening with nonce-based script execution and safe defaults.
  • Immutable audit logging with sensitive data redaction and context capture (IP, User-Agent, timestamps).
  • Tenant isolation with database-level scoping and cross-tenant access prevention.
  • Compliance-ready workflows that map to GDPR, SOC 2, and internal security policies.

Quick Start

Integrate RBAC with server-side guards, apply CSRF protection for admin mutations, enable CSP with nonce-based scripts, and enforce tenant isolation in all data queries and audits.

Frequently Asked Questions about security-best-practices

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

FAQPage Schema
How do I implement RBAC in Next.js admin portals?▼

RBAC in Next.js is enforced through server-side guards on API routes and server components to ensure least privilege access. This skill applies role-based access controls specifically for admin portals and internal tooling via guided workflows.

What's the best way to add CSRF protection to Next.js API routes?▼

CSRF protection for Next.js API routes is applied by securing admin mutations and handling sessions safely. This skill enforces cross-site request forgery prevention through server-side checks integrated directly into your API workflows.

How do I configure CSP with nonce-based script execution in Next.js?▼

Configure CSP in Next.js by enabling nonce-based script execution with safe defaults. This skill hardens Content Security Policy by applying nonce-based script execution to prevent cross-site scripting attacks in admin portals.

Can I enforce tenant isolation in a multi-tenant Next.js application?▼

Yes, tenant isolation is enforced in multi-tenant Next.js applications through database-level scoping. This skill prevents cross-tenant access by applying strict data query boundaries and isolation checks across all server-side operations.

How do I set up immutable audit logging with sensitive data redaction?▼

Set up immutable audit logging by capturing context like IP, User-Agent, and timestamps while redacting sensitive data. This skill enforces audit trails with sensitive data redaction that map to GDPR and SOC 2 compliance workflows.

Does this security approach work for SOC 2 and GDPR compliance?▼

Yes, this approach works for SOC 2 and GDPR compliance by mapping security workflows to internal policies. The skill enforces RBAC, audit logging, and tenant isolation to meet enterprise compliance requirements for Next.js applications.