env-management

Split environment variables into .env.client and .env.api files.

Updated Nov 21, 2025
One-click install
npx skills add https://github.com/ColdstartLabs-ca/myimageupscaler.com --skill env-management
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: env-management
Source: https://github.com/ColdstartLabs-ca/myimageupscaler.com/tree/main/.claude/skills/env-management
Command: npx skills add https://github.com/ColdstartLabs-ca/myimageupscaler.com --skill env-management

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing environment variables across client and server code can be error-prone and insecure; this skill helps enforce a split structure to reduce secrets leakage and misconfiguration.

Core Features & Use Cases

  • Split structure: Public browser vars live in .env.client with NEXT_PUBLIC_* prefixes, while server secrets reside in .env.api with no public prefix.
  • Adding new variables: Client-side additions go to .env.client and server-side additions go to .env.api, each with clear usage and access rules.
  • Security & deployment: Enforces safe handling of secrets, supports local development and Cloudflare deployment, and documents security rules.

Quick Start

Copy the example env templates and start using the split environment files in local, build, and deployment environments.

Frequently Asked Questions about env-management

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

FAQPage Schema
How do I separate client and server environment variables to prevent secrets leakage?

To separate environment variables, place public browser variables in a `.env.client` file using `NEXT_PUBLIC_*` prefixes, and store server secrets in a `.env.api` file to prevent secrets leakage. This split structure keeps configurations secure and maintainable.

What's the best way to manage environment variables for Cloudflare deployment?

The best way to manage environment variables for Cloudflare deployment is adopting a split file structure. By isolating server secrets in `.env.api` and public client variables in `.env.client`, you enforce safe handling and reduce misconfiguration during the build and deployment process.

How do I add new environment variables when using a split env file structure?

To add new environment variables, insert client-side additions into `.env.client` and server-side additions into `.env.api`. Each file enforces clear usage and access rules, ensuring public browser access is restricted to only the appropriately prefixed variables.

Why do I need to split dotenv files for local development and deployment?

You need to split dotenv files to enforce security rules and reduce misconfiguration across local development and deployment. Separating client-facing vars from server secrets ensures that sensitive data is never exposed to the browser, making configuration highly maintainable.

Does the split env file approach work with Next.js applications?

Yes, the split env file approach works seamlessly with Next.js applications. It enforces the `NEXT_PUBLIC_*` prefix convention for client-side variables in `.env.client`, while keeping your server-side logic isolated and secure within the `.env.api` file.