Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Next.js Environment Variables and Config Audit

    by Saizul Amin

    1

    This skill gives your agent a proven procedure plus scripts that check the facts, so you get the same correct answer every time, with exact fixes instead of vague advice.

    Free

    Security scanned
    Next.js Environment Variables and Config Audit

    Next.js Environment Variables and Config Audit

    Example session with this skill installed

    Run the Next.js Environment Variables and Config Audit skill on my project and give me a prioritised list of what to fix, with exact changes.

    • Read your context and instructions
    • Compiled the next js environment

    Here is what the Next.js Environment Variables and Config Audit skill produced.

    Demo: real, unedited output of the skill's bundled script on a sample input from its test suite.

    Output

    env audit: 5 high, 3 medium, 9 low, 0 info
    HIGH   ENV001  .env.local
           .env.local has values but is not covered by .gitignore
           fix: add `.env*` and `!.env.example` to .gitignore; rotate anything already committed
    HIGH   ENV003  .env.local
           NEXT_PUBLIC_STRIPE_SECRET_KEY: secret-looking name with NEXT_PUBLIC_ prefix (shipped to every visitor)
           fix: drop the prefix and move the code that uses it to the server
    HIGH   ENV002  .env.local
           NEXT_PUBLIC_PAYMENTS holds what looks like a secret credential; it is inlined into browser JS
           fix: rename without NEXT_PUBLIC_, read it only on the server, rotate the credential
    HIGH   ENV006  components/Checkout.tsx:4
           server-only variable DATABASE_URL read in a Client Component (undefined in the browser; keep this secret on the server)
           fix: read it in a Server Component/Action and pass only the needed result as props
    HIGH   ENV010  next.config.js:3
           next.config env.API_SECRET inlines process.env.API_SECRET into client and server bundles
           fix: remove it from `env`; read process.env on the server or use NEXT_PUBLIC_ on purpose
    MEDIUM ENV011  Dockerfile
           NEXT_PUBLIC_API_URL is inlined at build time but the Dockerfile never sets it (ARG/ENV)
           fix: ARG NEXT_PUBLIC_API_URL before `RUN npm run build` and pass --build-arg, or read it at runtime on the server instead
    MEDIUM ENV005  components/Checkout.tsx:3
           destructuring process.env in a Client Component: values are not inlined
           fix: write process.env.NEXT_PUBLIC_X literally at each use
    MEDIUM ENV005  components/Checkout.tsx:6
           dynamic process.env[...] in a Client Component is always undefined
           fix: write process.env.NEXT_PUBLIC_X literally at each use
    LOW    ENV004  .env.local
           NODE_ENV set in an env file (Next.js manages it; non-standard values break builds)
           fix: remove it; next dev/build/start set NODE_ENV
    LOW    ENV008  .env.local
           NEXT_PUBLIC_API_URL is defined but missing from .env.example
           fix: add `NEXT_PUBLIC_API_URL=` (no value) to .env.example
    LOW    ENV008  .env.local
           NEXT_PUBLIC_PAYMENTS is defined but missing from .env.example
           fix: add `NEXT_PUBLIC_PAYMENTS=` (no value) to .env.example
    LOW    ENV008  .env.local
           NEXT_PUBLIC_STRIPE_SECRET_KEY is defined but missing from .env.example
           fix: add `NEXT_PUBLIC_STRIPE_SECRET_KEY=` (no value) to .env.example
    LOW    ENV007  app/page.tsx:2
           UNDOCUMENTED_FLAG is used but not documented in .env.example
           fix: add `UNDOCUMENTED_FLAG=` to .env.example
    LOW    ENV007  components/Checkout.tsx:5
           NEXT_PUBLIC_API_URL is used but not documented in .env.example
           fix: add `NEXT_PUBLIC_API_URL=` to .env.example
    LOW    ENV007  next.config.js:3
           API_SECRET is used but not documented in .env.example
           fix: add `API_SECRET=` to .env.example
    LOW    ENV007  next.config.js:4
           BUILD_LABEL is used but not documented in .env.example
           fix: add `BUILD_LABEL=` to .env.example
    LOW    ENV010  next.config.js:4
           next.config env.BUILD_LABEL inlines process.env.BUILD_LABEL into client and server bundles
           fix: remove it from `env`; read process.env on the server or use NEXT_PUBLIC_ on purpose
    

    What you do next

    1. Fix the highest-severity items first.
    2. Ask your agent to apply the fixes it suggests, then run the skill again to confirm.
    3. Keep the skill installed and re-run it whenever the project changes.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Audit and fix environment variables in Next.js - which values reach the browser (NEXT_PUBLIC_ inlining at build time), secrets accidentally exposed through NEXT_PUBLIC_ names or next.config env, server-only variables read in Client Components (undefined at runtime), dynamic process.env access, .env file load order and .gitignore coverage, .env.example drift, runtime vs build-time values in Docker images, and typed env validation with zod. Includes an audit script that never prints values.

    Who it's for

    Use when the user adds API keys or secrets to a Next.js app, asks "is it safe to use NEXT_PUBLIC_ for this", sees process.env.X undefined in the browser or after deploy, sets up .env files, builds one Docker image for several environments, or wants a secret-leak check before going public.

    What's inside

    • Tested, offline Python script(s): env_audit.py (deterministic results, standard library only unless noted)
    • Reference guides: env-rules.md
    • Step-by-step agent instructions in SKILL.md covering: When to use; When not to use; Workflow; Never

    Why it's worth it

    Generic prompts guess. This skill gives your agent a proven procedure plus scripts that check the facts, so you get the same correct answer every time, with exact fixes instead of vague advice. See the real demo below.

    Works with every major AI agent

    Built on the open SKILL.md standard: Claude Code, Codex CLI, Cursor, VS Code Copilot, Gemini CLI, Windsurf and 20+ other agents.

    Requirements

    • Python 3.8+ for the bundled scripts
    • No API keys, no account, runs locally

    Open source: saizul/nextjs-react-skills on GitHub (MIT licence, by Saizul Amin).

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Frequently Asked Questions

    Audit and fix environment variables in Next.js - which values reach the browser (NEXT_PUBLIC_ inlining at build time), secrets accidentally exposed through NEXT_PUBLIC_ names or next.config env, server-only variables read in Client Components (undefined at runtime), dynamic process.env access, .e...

    This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

    Connect your AI agent to Agensi through MCP, then ask it to use Next.js Environment Variables and Config Audit on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

    Free