AgentSkillsCN

configuration

配置管理的常用模式(类型化配置、校验机制与环境隔离)。关键词:配置、环境变量、配置管理、环境、设置。

SKILL.md
--- frontmatter
name: configuration
description: "Configuration management patterns (typed config, validation, and environment separation). Keywords: config, environment variables, configuration, env, settings."

Configuration

This skill describes a safe configuration pattern for backend services.


Core rule

Centralize configuration in one module and validate it at startup.

Avoid scattered access to environment variables throughout the codebase.


Pattern: typed config + validation

  1. Read environment variables in a single place.
  2. Validate and normalize them.
  3. Export a typed config object.
ts
export const config = {
  env: process.env.NODE_ENV ?? "development",
  port: Number(process.env.PORT ?? "3000"),
};

If validation fails, fail fast at startup.


Related Skills

  • architecture-overview