CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/prisma-best-practices

Prisma ORM patterns — schema design, migrations, type-safe queries, testing, error handling, and performance

96

1.28x
Quality

95%

Does it follow best practices?

Impact

100%

1.28x

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

prisma-testing.jsonverifiers/

{
  "instruction": "Set up Prisma test database with proper environment configuration, cleanup, seeding, and isolation",
  "relevant_when": "Agent writes tests for code that uses Prisma ORM",
  "context": "Tests must use a separate database configured via DATABASE_URL environment variable (from .env.test), never hardcode the database URL. Each test must be isolated: use deleteMany in beforeEach to clean all tables in child-to-parent order, then seed known test data in the same beforeEach. Call prisma.$disconnect() in afterAll. Never depend on data from other tests.",
  "sources": [
    {
      "type": "file",
      "filename": "skills/prisma-best-practices/SKILL.md",
      "tile": "tessl-labs/prisma-best-practices@0.1.0"
    }
  ],
  "checklist": [
    {
      "name": "separate-test-database",
      "rule": "Tests use a separate test database, not the development or production database, configured via DATABASE_URL in .env.test or environment",
      "relevant_when": "Agent sets up database testing infrastructure"
    },
    {
      "name": "no-hardcoded-db-url",
      "rule": "Database URL is NOT hardcoded in test files — it comes from environment variables (.env.test or process.env), never passed as a literal string to PrismaClient datasources",
      "relevant_when": "Agent creates a PrismaClient instance for tests"
    },
    {
      "name": "beforeeach-cleanup",
      "rule": "beforeEach runs deleteMany on all relevant tables in child-to-parent order to ensure clean state before each test",
      "relevant_when": "Agent writes database test setup"
    },
    {
      "name": "seed-data-in-beforeeach",
      "rule": "Test data (seed data) is created in beforeEach after cleanup — each test starts with known, consistent data rather than depending on previous tests or an empty database",
      "relevant_when": "Agent writes database tests that need existing records"
    },
    {
      "name": "disconnect-in-afterall",
      "rule": "prisma.$disconnect() is called in afterAll to properly close the connection pool after tests complete",
      "relevant_when": "Agent writes test lifecycle hooks for Prisma tests"
    },
    {
      "name": "test-isolation",
      "rule": "Each test is independent and does not depend on data created by another test",
      "relevant_when": "Agent writes multiple database tests"
    },
    {
      "name": "prisma-client-in-tests",
      "rule": "Tests use PrismaClient to interact with the database and verify state, not raw SQL or external tools",
      "relevant_when": "Agent writes assertions about database state"
    },
    {
      "name": "tests-verify-db-state",
      "rule": "Tests include assertions that verify the database state after operations (e.g., checking created records, counts, field values)",
      "relevant_when": "Agent writes test assertions for database operations"
    }
  ]
}

tile.json