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
- •Read environment variables in a single place.
- •Validate and normalize them.
- •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