Security Nextjs
Security audit patterns for Next.js App Router, Server Actions, middleware, and API routes with severity ratings.
- CCM score
- 52 of 100
- skills.sh installs
- 381
- GitHub stars
- 121
- last updated
- Jun 3, 2026
Own this skill? Claim it
What it does
- Covers NEXT_PUBLIC_ env exposure, Server Action auth, API route auth, middleware matcher gaps, and security headers
- Includes a severity table rating each issue from CRITICAL to LOW, plus quick
grepandrgaudit commands - Enforces checks that Server Actions verify sessions and validate input with Zod before database writes
- Designed for reviewing Next.js apps that use next-auth or similar session handling
Install
$ npx -y skills add igorwarzocha/opencode-workflows --skill security-nextjs -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Security audit patterns for Next.js applications covering environment variable exposure, Server Actions, middleware auth, API routes, and App Router security.
Environment Variable Exposure
The NEXT_PUBLIC_ Footgun
NEXT_PUBLIC_* → Bundled into client JavaScript → Visible to everyone
No prefix → Server-only → Safe for secrets
Audit steps:
grep -r "NEXT_PUBLIC_" . -g "*.env*"- For each var, ask: "Would I be OK if this was in view-source?"
- Common mistakes:
NEXT_PUBLIC_API_KEY(SHOULD be server-only)NEXT_PUBLIC_DATABASE_URL(MUST NOT use)NEXT_PUBLIC_STRIPE_SECRET_KEY(useSTRIPE_SECRET_KEY)
Safe pattern:
// Server-only (API route, Server Component, Server Action)
const apiKey = process.env.API_KEY; // ✓ No NEXT_PUBLIC_
// Client-safe (truly public)
const publishableKey = process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY; // ✓ Publishable
next.config.js env Is Always Bundled
Values set in next.config.js under env are inlined into the client bundle, even without NEXT_PUBLIC_. Treat them as public.
Details
- Repository
- github.com/igorwarzocha/opencode-workflows
- Categories
- Security, Frontend & UI Code
- First seen
- Jun 3, 2026
Questions
What does the security-nextjs skill check for?
The security-nextjs skill audits Next.js App Router and Server Actions code for NEXT_PUBLIC_ environment variable exposure, missing auth in Server Actions and API routes, and middleware matcher gaps. It also flags dangerouslySetInnerHTML use and missing security headers in next.config.js.
How do I install the security-nextjs skill?
Run npx -y skills add igorwarzocha/opencode-workflows --skill security-nextjs -y in your project. Once installed, the agent can review your Next.js app for the security issues this skill covers.
Where does security-nextjs stand in the Security category?
It is one of the Security category skills on Claude Marketplaces, alongside azure-compliance, entra-agent-id, firebase-security-rules-auditor, security-audit and cloudflare-one. Its focus is narrower than those, covering Next.js-specific patterns such as NEXT_PUBLIC_ leaks and Server Action auth.
More from igorwarzocha/opencode-workflows
All 7Similar to Security Nextjs
More Securitynextjs-code-reviewgiuseppe-trisciuoglio/developer-kit4.1K installsComprehensive Next.js App Router review covering component boundaries, data fetching, caching, Server Actions, middleware, and metadata.
nextjspproenca/dot-skills1.2K installsNext.js 16 App Router guide with 45 rules across nine categories, covering caching, Server Components, and codebase hygiene reviews.
frontend-securityschalkneethling/webdev-agent-skills473 installsSecurity audit workflow for frontend codebases covering XSS, CSRF, CSP, input handling, uploads, and dependencies.
nextjs-best-practicessickn33/agentic-awesome-skills7.6K installsNext.js App Router principles covering Server vs Client Components, data fetching, routing, caching, and Server Actions.
clerk-nextjs-patternsclerk/skills56.9K installsAdvanced Next.js patterns for Clerk auth covering middleware, Server Actions, and user-scoped caching.
typescript-security-reviewgiuseppe-trisciuoglio/developer-kit4.2K installsStructured security review for TypeScript/Node.js apps covering OWASP Top 10, JWT/OAuth2, injection, and secrets exposure.