CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/separation-of-concerns

Enforce strict three-layer architecture: thin HTTP routes, pure service logic with domain errors, isolated data access with dependency injection.

94

1.08x
Quality

93%

Does it follow best practices?

Impact

97%

1.08x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

criteria.jsonevals/scenario-3/

{
  "context": "Tests whether the agent splits a god service into focused, single-domain services, uses the correct file structure (routes/, services/, repositories/, errors/), and ensures each service handles one cohesive area without crossing concerns.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "No god service",
      "description": "There is NO single service file that handles all four original domains (patients, appointments, billing, auth) — the monolithic service is split",
      "max_score": 10
    },
    {
      "name": "Focused services per domain",
      "description": "At least 4 separate service files exist covering the original domains: patient/profile, appointment, billing, and auth (plus telehealth = 5 total)",
      "max_score": 10
    },
    {
      "name": "Correct services/ directory",
      "description": "Service files are placed in a src/services/ directory (or equivalent services folder)",
      "max_score": 5
    },
    {
      "name": "Correct repositories/ directory",
      "description": "Repository/data access files are placed in a src/repositories/ directory (or equivalent)",
      "max_score": 5
    },
    {
      "name": "Correct routes/ directory",
      "description": "Route handler files are placed in a src/routes/ directory (or equivalent)",
      "max_score": 5
    },
    {
      "name": "Domain errors file",
      "description": "A dedicated src/errors/domain.ts (or equivalent) file exists with domain error class definitions",
      "max_score": 5
    },
    {
      "name": "No SQL in services",
      "description": "Service files do NOT contain direct SQL queries or ORM calls — data access is delegated to repositories",
      "max_score": 10
    },
    {
      "name": "No HTTP errors in services",
      "description": "Service files do NOT throw HTTP-coded errors (e.g., no 'throw new Error(\"404: ...\")', no .status(), no HTTP status numbers in throws)",
      "max_score": 10
    },
    {
      "name": "No HTTP imports in services",
      "description": "Service files do NOT import or reference express, fastify, req, res, request, response, or ctx",
      "max_score": 8
    },
    {
      "name": "Routes handle HTTP mapping",
      "description": "Route files are present and map domain operations to HTTP endpoints, catching domain errors and returning appropriate status codes",
      "max_score": 8
    },
    {
      "name": "Telehealth service present",
      "description": "A separate telehealth service file exists in src/services/ covering session management",
      "max_score": 8
    },
    {
      "name": "Restructure plan accurate",
      "description": "restructure-plan.md identifies at least 4 focused services split from the god service and describes what each is responsible for",
      "max_score": 8
    },
    {
      "name": "Side effects in services",
      "description": "Email sending (sendWelcome, appointment notifications, payment confirmation) is called from service files, not from route handlers",
      "max_score": 8
    }
  ]
}

evals

tile.json