add-setting-env

Create typed server-side environment variables with zod in src/envs and integrate them into global config and user store.

Updated May 11, 2026
One-click install
npx skills add https://github.com/zmh13928433602-sys/lobe-chat --skill add-setting-env-zmh13928433602-sys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-setting-env
Source: https://github.com/zmh13928433602-sys/lobe-chat/tree/main/.agents/skills/add-setting-env
Command: npx skills add https://github.com/zmh13928433602-sys/lobe-chat --skill add-setting-env-zmh13928433602-sys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guide developers to add and configure server-side environment variables that control default values for user settings.

Core Features & Use Cases

  • Define Environment Variable: Create src/envs/<domain>.ts with a typed config using createEnv and zod.
  • Update Type & Server Config: Extend server/globalConfig and related types when introducing a new domain.
  • Assemble & Merge: Wire the new domain config into the global config and user store.
  • Documentation & Env Example: Update .env.example and relevant docs to reflect the new variable.

Quick Start

Create an environment variable file under src/envs for your domain and wire it into the server's global configuration.

Frequently Asked Questions about add-setting-env

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

FAQPage Schema
How do I add server-side environment variables for default user settings?

To add environment variables for default user settings, create a typed config file under src/envs using createEnv and zod, then wire it into the server's global configuration and update the relevant type definitions. This ensures domain-specific settings are properly validated and merged into the user store.

What is the best way to type and validate domain-specific environment variables in TypeScript?

Typing and validating domain-specific environment variables is best handled using zod schemas within a createEnv configuration file. This approach provides runtime validation and TypeScript type inference, ensuring server config values for user settings are safe and predictable.

How do I wire a new environment variable config into an existing global server config?

Wiring a new environment variable config into the global server config requires extending the server/globalConfig types and assembling the new domain configuration. You merge the zod-validated config object into the global configuration and user store integration.

Do I need to update .env.example when introducing new environment variables for user settings?

Yes, you need to update .env.example when introducing new environment variables. Documenting changes in the env example file and relevant docs is a required step to reflect the new variable and ensure team members know the required server config inputs.

Can I use this approach to manage environment variables for multiple distinct user settings domains?

Yes, you can use this approach to manage multiple distinct user settings domains. By creating separate src/envs/<domain>.ts files for each domain and assembling them into the global config, you can scale environment variable management across different user settings.

Why use zod and createEnv for server config instead of standard process.env in TypeScript?

Using zod and createEnv for server config provides runtime validation and centralized type safety that standard process.env lacks. This method ensures default user settings are correctly typed and validated against the schema before being merged into the global configuration.