Agent Skills
› xinity-ai/xinity-ai
› add-env-variable
add-env-variable
GitHub指导在任意服务包中新增环境变量,遵循env-schema分离模式。通过Zod Schema定义字段、描述及密钥标记,自动解析运行时配置,并更新示例文件以支持本地开发默认值。
Trigger Scenarios
需要添加新的环境变量到服务配置时
需要为现有变量添加描述或标记为密钥时
Install
npx skills add xinity-ai/xinity-ai --skill add-env-variable -g -y
SKILL.md
Frontmatter
{
"name": "add-env-variable",
"description": "Add a new environment variable to any service package following the env-schema \/ parseEnv pattern with Zod schema, describe(), and meta(secret()) annotations."
}
Add Environment Variable
When adding a new environment variable to any service package, follow this pattern.
Env schema separation
Each service package has two env files:
env-schema.ts: exports a Zod object schema with.describe()and.meta(secret())annotations. No side effects, safe to import from CLI or tests.env.ts(orserverenv.tsfor dashboard): imports the schema and callsparseEnv()which readsprocess.env.
| Package | Schema file | Runtime file |
|---|---|---|
| gateway | src/env-schema.ts -> gatewayEnvSchema |
src/env.ts |
| daemon | src/env-schema.ts -> daemonEnvSchema |
src/env.ts |
| dashboard | src/lib/server/env-schema.ts -> dashboardEnvSchema |
src/lib/server/serverenv.ts |
Steps
- Add to the schema file with
.describe("Human-readable description"). - Mark secrets with
.meta(secret())(imported fromcommon-env). The CLI readsz.globalRegistry.get(field)?.secretto decide what goes into systemdLoadCredentialsecret files vs. plainEnvironmentFileentries. - The runtime file does not need changes - it parses from the schema automatically.
- Update
example.envif this variable should have a default for local dev.
Example
// In env-schema.ts
import { secret } from "common-env";
export const gatewayEnvSchema = z.object({
// ... existing vars
MY_NEW_VAR: z.string().describe("What this var controls"),
MY_SECRET_VAR: z.string().describe("A secret value").meta(secret()),
});
Version History
- 9817b2f Current 2026-07-25 05:51


