add-setting-env
Add server-side environment variables that control default values for user settings.
Security Assessment
About add-setting-env
add-setting-env is a codebase-workflow skill for the LobeHub project that guides an agent through adding a server-side environment variable to control the default value of a user setting. It solves the problem of correctly threading a new configuration value through LobeHub's layered settings architecture, where the resolution priority is User Custom > Server Env Var > Hardcoded Default.
The skill lays out a six-step process with concrete TypeScript snippets: defining the env var with `@t3-oss/env-core` and a Zod schema in `packages/env/src/<domain>.ts`, extending the `GlobalServerConfig` type (reusing existing types where possible), assembling the server config in `apps/server/src/globalConfig/index.ts`, merging it into the user store slice, updating `.env.example`, and updating the English and Chinese environment-variable docs. It includes a worked example using `AI_IMAGE_DEFAULT_IMAGE_NUM` showing each edit in context.
It targets LobeHub contributors and maintainers working on configuration and settings, and TypeScript developers extending the app's server config. This is a benign development helper: it edits typed source files and documentation and uses standard Zod validation for env vars, with no code execution, credential handling beyond ordinary config wiring, or destructive behavior.
FAQ
What is the settings priority order?
User Custom values win, then the Server Env Var, then the hardcoded default. This skill adds the middle layer.
What tooling does it rely on?
It uses @t3-oss/env-core with Zod schemas to define and validate the env var, and follows LobeHub's package/monorepo structure (packages/env, packages/types, apps/server, and the user store slice).
Do I need to update documentation?
Yes. The final steps update .env.example and the basic environment-variable docs in both English and Chinese.
Is this a user-invoked skill?
Yes. Its frontmatter sets disable-model-invocation: true and accepts a setting-name argument, so it runs as an explicit workflow rather than auto-triggering.
Install add-setting-env
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
lobehub/lobehub