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

dependency-injection.jsonverifiers/

{
  "instruction": "Use constructor injection for all service dependencies; never inject Request/Response into services",
  "relevant_when": "Agent creates NestJS services with dependencies",
  "context": "NestJS uses constructor-based dependency injection. Services must receive dependencies through their constructor, not by instantiating them with new. Services must NEVER import or reference Express/NestJS Request or Response objects -- this couples them to HTTP and makes testing impossible. Controllers handle HTTP concerns; services handle business logic only.",
  "sources": [
    {
      "type": "file",
      "filename": "skills/nestjs-best-practices/SKILL.md",
      "tile": "tessl-labs/nestjs-best-practices@0.2.0"
    }
  ],
  "checklist": [
    {
      "name": "constructor-injection",
      "rule": "Agent receives service dependencies through constructor parameters, not by creating them with new",
      "relevant_when": "Agent creates a NestJS service that depends on other services"
    },
    {
      "name": "no-request-response-in-services",
      "rule": "Agent does NOT import or reference Request or Response objects in NestJS services",
      "relevant_when": "Agent creates NestJS services"
    },
    {
      "name": "controller-delegates-to-service",
      "rule": "Agent has controllers call service methods rather than implementing business logic inline",
      "relevant_when": "Agent creates NestJS controller endpoints"
    },
    {
      "name": "injectable-decorator",
      "rule": "Agent marks all services with @Injectable() decorator",
      "relevant_when": "Agent creates NestJS service classes"
    },
    {
      "name": "response-data-envelope",
      "rule": "Agent wraps controller endpoint return values in a { data: result } envelope",
      "relevant_when": "Agent creates NestJS controller endpoints that return data"
    }
  ]
}

tile.json