NestJS patterns -- modules, DI, exception filters, validation pipes, guards, interceptors, testing, config
98
89%
Does it follow best practices?
Impact
100%
1.36xAverage score across 12 eval scenarios
Passed
No known issues
{
"context": "Tests whether the agent follows NestJS best practices for configuration (ConfigModule isGlobal, ConfigService instead of process.env), dependency injection (no new), testing (Test.createTestingModule with mocks), response envelopes ({ data: ... }), and error handling ({ error: { code, message } }).",
"type": "weighted_checklist",
"checklist": [
{
"name": "Response data envelope",
"description": "The UsersController wraps return values from both POST and GET endpoints in { data: ... } rather than returning raw results",
"max_score": 12
},
{
"name": "Error envelope shape",
"description": "The exception filter returns { error: { code: ..., message: ... } } for both HttpException and unknown errors — not { statusCode, message } or any other shape",
"max_score": 12
},
{
"name": "console.error for unknown errors",
"description": "The exception filter calls console.error for non-HttpException errors before returning 500",
"max_score": 10
},
{
"name": "ConfigModule isGlobal",
"description": "ConfigModule.forRoot() in app.module.ts is called with isGlobal: true",
"max_score": 8
},
{
"name": "No process.env in service",
"description": "The refactored UsersService does NOT contain any direct process.env references",
"max_score": 8
},
{
"name": "No new EmailService",
"description": "The refactored UsersService does NOT instantiate EmailService using new — it receives it via constructor injection",
"max_score": 8
},
{
"name": "Test.createTestingModule used",
"description": "The spec file uses Test.createTestingModule() to set up the test module (not jest.mock() or manual instantiation)",
"max_score": 8
},
{
"name": "Dependencies mocked in tests",
"description": "In the test module, EmailService and ConfigService are replaced with useValue providing jest.fn() stubs",
"max_score": 8
},
{
"name": "Global ValidationPipe",
"description": "main.ts registers a global ValidationPipe with whitelist: true and transform: true",
"max_score": 8
},
{
"name": "Global filter in main.ts",
"description": "main.ts registers the exception filter globally via app.useGlobalFilters()",
"max_score": 8
},
{
"name": "Catch-all filter decorator",
"description": "The exception filter uses @Catch() with no arguments to catch all exception types",
"max_score": 6
},
{
"name": "DTO with class-validator",
"description": "The register-user DTO uses class-validator decorators on its properties",
"max_score": 4
}
]
}evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
skills
nestjs-best-practices
verifiers