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-4/

{
  "context": "Tests whether the agent implements a catch-all exception filter that returns a consistent { error: { code, message } } envelope for all error types, logs unknown errors with console.error, and registers the filter globally.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "@Catch() no args",
      "description": "The exception filter class uses @Catch() with NO arguments (not @Catch(HttpException) or any specific type)",
      "max_score": 10
    },
    {
      "name": "HttpException error shape",
      "description": "For HttpException errors, the response body is exactly { error: { code: ..., message: ... } } — not { statusCode, message } or any other shape",
      "max_score": 12
    },
    {
      "name": "Unknown error shape",
      "description": "For non-HttpException errors, the response body is also { error: { code: ..., message: ... } } (e.g. code: 'INTERNAL_ERROR')",
      "max_score": 12
    },
    {
      "name": "console.error for unknown",
      "description": "The catch-all branch calls console.error (with the exception as an argument) before sending the 500 response — not console.log or console.warn",
      "max_score": 10
    },
    {
      "name": "Global filter in main.ts",
      "description": "app.useGlobalFilters(new AllExceptionsFilter()) is called in main.ts (not on individual controllers or modules)",
      "max_score": 10
    },
    {
      "name": "Implements ExceptionFilter",
      "description": "The filter class implements the ExceptionFilter interface from @nestjs/common",
      "max_score": 8
    },
    {
      "name": "HttpException status code",
      "description": "For HttpException errors, the HTTP status code sent in the response matches the exception's status (not hardcoded as 500 for all errors)",
      "max_score": 10
    },
    {
      "name": "500 for unknown",
      "description": "For non-HttpException errors, the HTTP response status is 500",
      "max_score": 8
    },
    {
      "name": "Filter file location",
      "description": "The exception filter is placed in common/filters/ (not inline in main.ts or directly in a feature folder)",
      "max_score": 8
    },
    {
      "name": "ValidationPipe global",
      "description": "main.ts also registers a global ValidationPipe (whitelist and/or transform options present)",
      "max_score": 12
    }
  ]
}

evals

tile.json