Env Config logo

Env Config

Community
kazdenc
env-config

Set up environment variables across local, staging, and production with validation and documentation. Use when user says "set up env vars", "environment variables", "configure secrets", ".env setup", "env validation", or needs to manage configuration across environments.

Overview

Publisherkazdenc
Repositorybuilder-skills
Skill nameenv-config
Stars
46
Forks
5
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by kazdenc on GitHub. Read the source before you install it.

Installation

Install the Env Config AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/kazdenc/builder-skills/tree/main/.claude/skills/dev/setup/env-config
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/kazdenc/builder-skills.git /tmp/builder-skills
mkdir -p .claude/skills
cp -r /tmp/builder-skills/.claude/skills/dev/setup/env-config .claude/skills/env-config
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Env Config in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Env Config on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Env Config is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Environment Variable Configuration

Set up environment variables with validation, documentation, and secure handling across environments. If target names a service (Supabase, Stripe, etc.), scope to that service's vars. Otherwise, set up the full env system.

Step 1: File Structure

Create these files in the project root:

FilePurposeCommitted to git?
.env.localLocal development overrides. Highest priority.No
.env.developmentDefaults for next devYes (no secrets)
.env.productionDefaults for next buildYes (no secrets)
.env.exampleTemplate documenting every variableYes
.env.testTest environment overridesYes (no secrets)

Load order (Next.js)

Next.js loads env files in this order (later files override earlier):

  1. .env (all environments)
  2. .env.local (all environments, git-ignored)
  3. .env.[environment] (e.g., .env.development)
  4. .env.[environment].local (e.g., .env.development.local, git-ignored)

Step 2: Naming Conventions

RuleExampleWhy
SCREAMING_SNAKE_CASEDATABASE_URLStandard convention
NEXT_PUBLIC_ prefix for client-sideNEXT_PUBLIC_APP_URLNext.js exposes only prefixed vars to the browser
Group by serviceSUPABASE_URL, SUPABASE_ANON_KEYEasy to find related vars
No NEXT_PUBLIC_ for secretsSTRIPE_SECRET_KEY (not NEXT_PUBLIC_STRIPE_SECRET_KEY)Never expose secrets to the client

Common variable groups

ServiceVariablesClient-safe?
AppNEXT_PUBLIC_APP_URL, NEXT_PUBLIC_APP_NAMEYes
SupabaseNEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEYURL and anon key: yes. Service role: no.
StripeNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY, STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRETPublishable: yes. Others: no.
AuthNEXTAUTH_SECRET, NEXTAUTH_URLNo
EmailRESEND_API_KEY, EMAIL_FROMNo
AnalyticsNEXT_PUBLIC_POSTHOG_KEY, NEXT_PUBLIC_POSTHOG_HOSTYes

Step 3: Validate with t3-env

Install t3-env for runtime validation:

bash
pnpm add @t3-oss/env-nextjs zod

Create src/env.ts:

ts
import { createEnv } from '@t3-oss/env-nextjs'
import { z } from 'zod'

export const env = createEnv({
  // Server-side variables (never exposed to client)
  server: {
    DATABASE_URL: z.string().url(),
    SUPABASE_SERVICE_ROLE_KEY: z.string().min(1),
    STRIPE_SECRET_KEY: z.string().startsWith('sk_'),
    STRIPE_WEBHOOK_SECRET: z.string().startsWith('whsec_'),
    NEXTAUTH_SECRET: z.string().min(1),
    NEXTAUTH_URL: z.string().url(),
  },

  // Client-side variables (exposed to browser)
  client: {
    NEXT_PUBLIC_APP_URL: z.string().url(),
    NEXT_PUBLIC_SUPABASE_URL: z.string().url(),
    NEXT_PUBLIC_SUPABASE_ANON_KEY: z.string().min(1),
    NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: z.string().startsWith('pk_'),
  },

  // Map env vars to the schema
  runtimeEnv: {
    DATABASE_URL: process.env.DATABASE_URL,
    SUPABASE_SERVICE_ROLE_KEY: process.env.SUPABASE_SERVICE_ROLE_KEY,
    STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
    STRIPE_WEBHOOK_SECRET: process.env.STRIPE_WEBHOOK_SECRET,
    NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
    NEXTAUTH_URL: process.env.NEXTAUTH_URL,
    NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
    NEXT_PUBLIC_SUPABASE_URL: process.env.NEXT_PUBLIC_SUPABASE_URL,
    NEXT_PUBLIC_SUPABASE_ANON_KEY: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
    NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY:
      process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY,
  },

  // Skip validation in Docker builds or CI where env vars aren't needed
  skipValidation: !!process.env.SKIP_ENV_VALIDATION,
})

Usage

Import env instead of accessing process.env directly:

ts
// Good — validated and typed
import { env } from '@/env'
const url = env.NEXT_PUBLIC_APP_URL

// Bad — unvalidated, untyped, silent failure
const url = process.env.NEXT_PUBLIC_APP_URL

This crashes at startup if required variables are missing, instead of failing silently at runtime.

Step 4: Generate .env.example

Create .env.example with every variable, no real values, and comments:

bash
# App
NEXT_PUBLIC_APP_URL=http://localhost:3000

# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key

# Stripe
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

# Auth
NEXTAUTH_SECRET=generate-with-openssl-rand-base64-32
NEXTAUTH_URL=http://localhost:3000

# Email
RESEND_API_KEY=re_...
EMAIL_FROM=onboarding@yourdomain.com

Keep .env.example in sync whenever you add or remove a variable.

Step 5: Secrets Management

Rules

RuleEnforcement
Never commit .env.localListed in .gitignore by default
Never commit real API keysUse .env.example with placeholder values
Never log env varsRedact in error handlers
Rotate compromised keys immediatelyRevoke in provider dashboard, update in platform
Use platform env vars for productionVercel, Railway, Fly.io all have env var management

Generate secrets

bash
# Generate a random secret (e.g., for NEXTAUTH_SECRET)
openssl rand -base64 32

Production env vars

Set via your hosting platform, never in files:

bash
# Vercel
vercel env add STRIPE_SECRET_KEY production

# Railway
railway variables set STRIPE_SECRET_KEY=sk_live_...

Step 6: Adding a New Env Var Checklist

Follow this checklist every time you add a new environment variable:

StepAction
1Add to src/env.ts schema (server or client)
2Add to runtimeEnv mapping in src/env.ts
3Add to .env.local with real value
4Add to .env.example with placeholder value
5Add to .env.development if it has a safe default
6Set in Vercel/platform for production and preview
7Update any documentation that lists env vars
8Import from @/env in code (not process.env)

Common Patterns

Feature flags via env vars

ts
// In env.ts
server: {
  ENABLE_NEW_BILLING: z.enum(['true', 'false']).default('false'),
}

// In code
if (env.ENABLE_NEW_BILLING === 'true') {
  // new billing logic
}

Per-environment API URLs

bash
# .env.development
NEXT_PUBLIC_API_URL=http://localhost:3001

# .env.production
NEXT_PUBLIC_API_URL=https://api.yourdomain.com

Optional variables

ts
// In env.ts — use .optional() for non-required vars
server: {
  SENTRY_DSN: z.string().url().optional(),
  ANALYTICS_ID: z.string().optional(),
}

Debugging Env Issues

SymptomLikely causeFix
undefined in browserMissing NEXT_PUBLIC_ prefixRename with prefix
undefined on serverVariable not set in current environmentCheck .env.local and platform settings
Old value after changeNext.js caches env at build timeRestart dev server or redeploy
Validation error at startupMissing or malformed variableCheck src/env.ts schema against actual values
Works locally, fails in CICI doesn't have .env.localSet vars in CI environment settings or use SKIP_ENV_VALIDATION=1 for build-only steps

Frequently asked questions

What does the Env Config AI skill do?

Set up environment variables across local, staging, and production with validation and documentation. Use when user says "set up env vars", "environment variables", "configure secrets", ".env setup", "env validation", or needs to manage configuration across environments.

Why use Env Config on TypingMind?

Because you install it once and use it with any model. Env Config is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Env Config in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/kazdenc/builder-skills/tree/main/.claude/skills/dev/setup/env-config. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Env Config?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Env Config?

As many as you like. As long as a model supports skills, you can use Env Config with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Env Config AI skill free?

Yes. It is published on GitHub by kazdenc under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇