CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/nestjs-best-practices

NestJS patterns -- modules, DI, exception filters, validation pipes, guards, interceptors, testing, config

98

1.36x
Quality

89%

Does it follow best practices?

Impact

100%

1.36x

Average score across 12 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

criteria.jsonevals/scenario-5/

{
  "context": "Tests whether the agent follows NestJS best practices for error handling (error envelope shape { error: { code, message } }), response wrapping ({ data: ... }), validation configuration, and logging interceptor implementation.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "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": "Response data envelope",
      "description": "Controller endpoints wrap their return values in { data: ... } rather than returning raw results — applies to both POST and GET endpoints",
      "max_score": 12
    },
    {
      "name": "console.error for unknown errors",
      "description": "The exception filter calls console.error (not console.log or console.warn) for non-HttpException errors before returning 500",
      "max_score": 10
    },
    {
      "name": "Global ValidationPipe with whitelist and transform",
      "description": "main.ts registers a global ValidationPipe with whitelist: true and transform: true",
      "max_score": 10
    },
    {
      "name": "Performance logging interceptor with tap",
      "description": "Logging interceptor implements NestInterceptor and uses next.handle().pipe(tap(...)) to measure duration after response",
      "max_score": 10
    },
    {
      "name": "Interceptor logs method URL duration",
      "description": "The logging interceptor logs HTTP method, URL, and duration in milliseconds",
      "max_score": 8
    },
    {
      "name": "Catch-all filter decorator",
      "description": "The exception filter uses @Catch() with NO arguments to catch all exception types",
      "max_score": 10
    },
    {
      "name": "Global filter in main.ts",
      "description": "The exception filter is registered globally in main.ts using app.useGlobalFilters()",
      "max_score": 8
    },
    {
      "name": "DTO with class-validator decorators",
      "description": "The create-shipment DTO uses class-validator decorators on its properties",
      "max_score": 8
    },
    {
      "name": "Feature module structure",
      "description": "Shipments code is organized in its own feature folder with separate module, controller, service, and DTO files",
      "max_score": 6
    },
    {
      "name": "Filter in common/filters",
      "description": "The exception filter is placed in common/filters/ directory",
      "max_score": 6
    }
  ]
}

evals

tile.json