security-nextjs

Audit Next.js projects for environment variable exposure and authorization issues.

7|2|Updated Jan 18, 2026
One-click install
npx skills add https://github.com/jal-co/jalco-opencode --skill security-nextjs-jal-co
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: security-nextjs
Source: https://github.com/jal-co/jalco-opencode/tree/main/opencode/.config/opencode/skills/security-nextjs
Command: npx skills add https://github.com/jal-co/jalco-opencode --skill security-nextjs-jal-co

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires rg, and includes scripts (resource) components.

What problem does it solve?

This Skill provides structured security audit patterns for Next.js applications, focusing on protecting environment variables, Server Actions, middleware matchers, and API routes during review and deployment.

Core Features & Use Cases

  • Environment variable exposure checks: identify NEXT_PUBLIC_ vars and inlined env values in client bundles.
  • Server Action and API route auditing: verify authentication, authorization, and input validation across app//actions.ts and app/api//route.ts.
  • Middleware and headers review: ensure matcher coverage includes protected paths and security headers are configured.
  • Use Case: run a proactive security review on a Next.js project to reduce data leakage and unauthorized access.

Quick Start

Run the security scan script to automatically detect common Next.js security issues in your app.

Frequently Asked Questions about security-nextjs

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

FAQPage Schema
How do I audit my Next.js App Router for Server Actions security issues?

To audit Next.js App Router security, scan app/**/actions.ts files to verify authentication, authorization, and input validation for server actions. Automated pattern checks detect missing protections and provide recommended fixes to prevent unauthorized access.

What is the best way to check Next.js environment variable exposure in client bundles?

Checking Next.js environment variable exposure involves scanning for NEXT_PUBLIC_ variables and inlined env values in client bundles. Automated pattern checks identify these exposed values and provide guidance to reduce data leakage risks.

How do I ensure my Next.js middleware matcher covers protected routes?

Ensuring Next.js middleware matcher coverage requires reviewing your middleware configuration to verify it includes all protected paths. Automated checks analyze matcher patterns and security header configurations to enforce route protections.

Does this Next.js security audit check API route protections?

Yes, the Next.js security audit checks API route protections by scanning app/api/**/route.ts files. It verifies authentication and input validation patterns across your API routes, identifying vulnerabilities and recommending fixes to mitigate unauthorized access.

Do I need ripgrep installed to run a Next.js security audit?

Yes, you need ripgrep installed as a dependency to run the automated security scan scripts. The tool uses ripgrep to efficiently perform pattern checks across your Next.js project files for environment variables, server actions, and middleware configurations.

What security headers should I configure for a Next.js application?

Configuring Next.js security headers requires reviewing your middleware and response configurations to ensure necessary headers are set. The audit checks your header configurations and provides guidance to align with recommended security practices.