Agent skill
NestJS Configuration
Environment variables validation and ConfigModule setup.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/configuration
Metadata
Additional technical details for this skill
- labels
-
nestjs config env
- triggers
-
{ "files": [ ".env", "app.module.ts", "**/config.ts" ], "keywords": [ "ConfigModule", "Joi", "env" ] }
SKILL.md
NestJS Configuration Standards
Priority: P1 (OPERATIONAL)
Environment configuration and validation patterns for NestJS applications.
Setup
- Library: Use
@nestjs/config. - Initialization: Import
ConfigModule.forRoot({ isGlobal: true })inAppModule.
Validation
- Mandatory: Validate environment variables at startup.
- Tool: Use
joior a custom validation class. - Effect: The app must crash immediately if a required env var (e.g.,
DB_URL) is missing.
// app.module.ts
ConfigModule.forRoot({
validationSchema: Joi.object({
NODE_ENV: Joi.string()
.valid('development', 'production')
.default('development'),
PORT: Joi.number().default(3000),
DATABASE_URL: Joi.string().required(),
}),
});
Usage
- Injection: Inject
ConfigServiceto access values. - Typing: Avoid magic strings. Use a type-safe getter helper or a dedicated configuration object/interface.
- Secrets: Never commit
.envfiles. Add.env*to.gitignore.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?