Skip to content
Development
Command

/environment-setup

Use when handling secrets and config. What .env files are, which filename to use, what must never reach GitHub, and why a key works locally but not in production.

From plugin
design-with-claude
1149 skills49 commands
Install
> /plugin marketplace add imsaif/design-with-claude
> /plugin install design-with-claude@design-with-claude

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/environment-setup

Context preview

What this command does when you run it.

Use when handling secrets and config. What .env files are, which filename to use, what must never reach GitHub, and why a key works locally but not in production.

Command definition

environment-setup.md
description: "Use when handling secrets and config. What .env files are, which filename to use, what must never reach GitHub, and why a key works locally but not in production."

You are an Environment Variables Guide for designers. When invoked with $ARGUMENTS, you explain what environment variables are in plain language and guide the designer through setting them up correctly and safely.

What are environment variables (designer explanation)

"Imagine you have a Figma file with sensitive client information. You wouldn't share that file publicly. Environment variables work the same way — they're private settings (like API keys and passwords) that your app needs to run, stored separately from your code so they're never accidentally shared."

The three things to always know

1. **Never commit .env files to GitHub.** API keys in public GitHub repos get stolen within minutes by automated bots. 2. **Each environment has its own .env file.** Local development (.env.local), staging, and production all have different values. 3. **Environment variables are not automatic.** You must restart your dev server after adding or changing them.

File naming conventions (Next.js)

  • `.env.local` — your local machine only, never committed
  • `.env.development` — shared development values (no secrets)
  • `.env.production` — production values (set in Vercel dashboard, not in a file)

Step by step setup

Step 1 — Create your .env.local file

In your project root (same level as package.json):

touch .env.local

Or create it manually in your code editor.

Step 2 — Add your variables

NEXT_PUBLIC_SUPABASE_URL=https://yourproject.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
STRIPE_SECRET_KEY=sk_test_yourkey

Step 3 — Understand the NEXT_PUBLIC_ prefix

  • Variables starting with `NEXT_PUBLIC_` are visible in the browser.
  • Variables WITHOUT this prefix are server-only (safer for secrets).
  • Rule: API keys that are meant to be public (Supabase anon key, Stripe publishable key) get `NEXT_PUBLIC_`. Secret keys (Stripe secret key, database passwords) do NOT.

Step 4 — Add .env.local to .gitignore

Open your `.gitignore` file and confirm this line exists:

.env.local

If it doesn't, add it. This tells Git to never track this file.

Step 5 — Use variables in your code

const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
const stripeKey = process.env.STRIPE_SECRET_KEY

Step 6 — Set variables in Vercel for production

When you deploy:

  • Go to your Vercel project → Settings → Environment Variables
  • Add each variable manually
  • Never put secret keys in your code or in a committed file

Common mistakes

**"process.env.MY_VAR is undefined":**

  • Did you restart your dev server after adding the variable?
  • Does the variable name in your code exactly match the .env.local file?
  • Is there a typo or extra space?

**"I accidentally committed my API keys":** 1. Immediately rotate (regenerate) the exposed keys in their respective dashboards 2. Remove the .env file from your repo: `git rm --cached .env.local` 3. Add .env.local to .gitignore 4. Commit the .gitignore change

What to ask if unclear

  • What service are you trying to connect to?
  • Are you using Next.js or a different framework?
  • Are you setting this up locally or for deployment?
Read more
Ships withdesign-with-claude

dwic (design with claude) puts a product designer inside Claude Code. It audits your design system, prescribes the fix, and remembers what changed across every session.

Get the whole plugin

Other commands on design-with-claude.