smithery.ai

runtime-env-vite-plugin

Guidance on using runtime-env with Vite to distinguish between runtime and build-time environment variables.

First seen Mar 23, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

More metadata
workflows
[".\/references\/01-setup.md",".\/references\/02-discovery.md",".\/references\/03-migration.md"]
guides
[".\/references\/the-string-trap.md"]

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,298 B
  • docs SUMMARY.md 139 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

runtime-env-vite-plugin

This skill ensures that environment variables are handled correctly in Vite projects by distinguishing between build-time (static) variables and runtime (dynamic) variables. It enforces a sequential workflow to ensure proper analysis and clean implementation.

When to apply

You MUST apply this skill when:

  • Setting up a new Vite project that requires environment variables.
  • Refactoring an existing Vite project to use runtime environment variables.
  • Adding new environment variables to a project already using @runtime-env/vite-plugin.

Execution Sequence

This skill MUST be executed in the following order. Do not skip steps:

  1. [01 - Setup](./references/01-setup.md): Infrastructure, installation, and initial configuration.
  2. [02 - Discovery](./references/02-discovery.md): Analyzing the codebase to identify variables and their true types (The "Think" phase).
  3. [03 - Migration](./references/03-migration.md): Applying the schema and updating the source code (The "Act" phase).

Pattern Guides

  • [The String Trap](./references/the-string-trap.md): How to avoid manual parsing and leverage runtimeEnv for type safety.

Core Mandates

  • Never assume a variable is a string just because it was one in a legacy file. Always perform discovery.
  • Always remove manual parsing logic (parseInt, JSON.parse) during migration.
  • Always run npx runtime-env gen-ts after updating the schema.
  • Always place the script tag in index.html before the app entry point.

Strict Prohibitions

  • NEVER use the default keyword in .runtimeenvschema.json. All environment values must originate from the environment.
  • NEVER modify or delete existing .env files. They are read-only sources of truth.
  • NEVER add import { runtimeEnv } from ... or similar. runtimeEnv is a global.
  • NEVER add redundant gen-ts or gen-js scripts to package.json.