better-env_skill

This skill helps you manage typed environment variables across local and remote providers with safe config schemas, validation, and CLI-driven sync.
  • TypeScript

8

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill andrelandgraf/fullstackrecipes --skill better-env

  • SKILL.md2.9 KB

Overview

This skill provides better environment variable management with full TypeScript type safety, CLI-driven workflows, and remote synchronization across major hosting providers. It enforces schema-based validation, separates server/public boundaries, and automates syncing between local dotenv files and provider dashboards. Use it to prevent runtime surprises and keep local and remote environments consistent.

How this skill works

Define typed config schemas in feature-level modules (for example src/lib/auth/config.ts) using the exported configSchema. The CLI inspects those modules, loads dotenv files with Next.js semantics, and validates declared variables early. A runtime configuration file (better-env.ts) declares adapters and mappings so the CLI can push, pull, or synchronize variables with Vercel, Netlify, Railway, Cloudflare, and Fly.io.

When to use it

  • When you need compile-time type safety for environment variables in TypeScript apps
  • Before dev, build, or deploy to fail fast on missing/invalid env values
  • When syncing local dotenv files with remote provider environment dashboards
  • In CI to validate or load production-like envs during automated workflows
  • When managing distinct environments (development, preview, production) with consistent rules

Best practices

  • Place typed config modules at feature level (e.g., src/lib/<feature>/config.ts) to keep scope clear
  • Run better-env validate --environment <name> early in your startup or CI pipeline to catch issues fast
  • Use upsert for idempotent automation, add when duplicates must fail, and update when missing keys should fail
  • Declare per-environment ignoreUnused entries to suppress intentionally unused dotenv keys
  • Keep better-env.ts under source control but avoid committing sensitive env files; use gitignore mappings in the runtime config

Example use cases

  • Initialize a project with better-env init and verify provider adapters before first deploy
  • Pull remote variables into .env.local for local testing with better-env pull --environment development
  • Validate that all declared configSchema keys exist in CI before builds using better-env validate --environment production
  • Batch load variables from a dotenv file into a provider using better-env load for repeatable deployments
  • Use upsert in automation to maintain remote envs idempotently across environments

FAQ

Add environment-specific suppressions in better-env.ts using environments.<env>.ignoreUnused: string[] to skip unused keys for that environment.

Which command should I use for automation?

Prefer upsert for idempotent automation. Use add when you want duplicates to fail and update when missing keys must cause an error.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
better-env skill by andrelandgraf/fullstackrecipes | VeilStrat