add-setting-env

Add Zod-validated server-side env defaults for user settings domains.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/kingheu0818-sketch/lobehub_yu --skill add-setting-env-kingheu0818-sketch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-setting-env
Source: https://github.com/kingheu0818-sketch/lobehub_yu/tree/main/.agents/skills/add-setting-env
Command: npx skills add https://github.com/kingheu0818-sketch/lobehub_yu --skill add-setting-env-kingheu0818-sketch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of hardcoded or inconsistently configured default user settings by letting a server administrator define sensible defaults through environment variables.

Core Features & Use Cases

  • Priority-based defaults: Ensures defaults follow the rule User Custom > Server Env Var > Hardcoded Default.
  • Typed configuration by domain: Adds validated server-side env variables in src/envs/<domain>.ts using Zod and integrates them into global server config.
  • User store merging: Merges server-provided defaults into the user settings store so new users inherit configured defaults without extra UI steps.
  • Documentation + .env hygiene: Updates .env.example and keeps both EN and CN self-hosting docs aligned for deployers.

Quick Start

Add a new domain-specific default like AI_IMAGE_DEFAULT_IMAGE_NUM by defining the validated env var in src/envs/image.ts, wiring it into global server config and the user settings slice, then documenting it in .env.example and the environment-variable docs.

Frequently Asked Questions about add-setting-env

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

FAQPage Schema
How do I set default user settings via server environment variables for self-hosting?

You can set default user settings via server environment variables by defining typed configurations with Zod validation, which are then integrated into the global server config and merged into the user settings store.

What is the priority order when overriding default user settings with server env vars?

The priority order for overriding default user settings follows the chain of User Custom overrides first, then Server Env Var defaults, and finally Hardcoded Default fallbacks.

How do I add validated environment variables for specific user preference domains?

You add validated environment variables by defining them in domain-specific files like `src/envs/<domain>.ts` using Zod validation, then wiring them into the global server config and user settings slice.

Can I use Zod validation to parse server-side configuration for new users?

Yes, you can use Zod validation to parse server-side configuration, ensuring that server-provided defaults are safely merged into the user store so new users inherit configured defaults without extra UI steps.

What documentation needs updating when adding new environment variables for user settings?

When adding new environment variables, you must update the `.env.example` file and keep both EN and zh-CN self-hosting documentation aligned for deployers.