CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/django-best-practices

Django patterns -- custom user model, project structure, models, views, URL routing, select_related/prefetch_related, signals vs save(), middleware, settings splitting, custom managers, management commands

92

1.63x
Quality

87%

Does it follow best practices?

Impact

100%

1.63x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

criteria.jsonevals/scenario-1/

{
  "context": "Tests whether the agent proactively applies Django best practices when building a blog: custom user model, select_related/prefetch_related for the homepage query, app_name for URL namespacing, get_object_or_404, settings.AUTH_USER_MODEL for FK references, TextChoices for post status, and related_name on ForeignKeys. The task does NOT ask for any of these -- it just describes a blog to build.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Custom user model",
      "description": "The project defines a custom user model inheriting from AbstractUser (or AbstractBaseUser) and sets AUTH_USER_MODEL in settings. The agent was NOT asked to create a custom user model.",
      "max_score": 14
    },
    {
      "name": "select_related on homepage query",
      "description": "The queryset for the homepage post list uses select_related('author') or equivalent to avoid N+1 queries when displaying author names. The agent was NOT asked about query optimization.",
      "max_score": 14
    },
    {
      "name": "prefetch_related for tags or comments",
      "description": "The queryset for post lists or detail views uses prefetch_related for tags and/or comments to avoid N+1 queries. The agent was NOT asked about prefetch_related.",
      "max_score": 12
    },
    {
      "name": "app_name in blog urls.py",
      "description": "The blog app's urls.py sets app_name = 'blog' (or equivalent) for URL namespacing. The agent was NOT asked about URL namespacing.",
      "max_score": 10
    },
    {
      "name": "get_object_or_404 in detail view",
      "description": "The post detail view uses get_object_or_404 (or a CBV that does equivalent) rather than a bare Model.objects.get() with manual exception handling. The agent was NOT asked about 404 handling.",
      "max_score": 8
    },
    {
      "name": "settings.AUTH_USER_MODEL for ForeignKey",
      "description": "ForeignKey fields pointing to the user model use settings.AUTH_USER_MODEL (or get_user_model()), NOT a direct import of django.contrib.auth.models.User. The agent was NOT told how to reference the user model.",
      "max_score": 10
    },
    {
      "name": "TextChoices for post status",
      "description": "The post status field uses TextChoices (or IntegerChoices) class rather than raw string tuples for choices. The agent was NOT asked about TextChoices.",
      "max_score": 8
    },
    {
      "name": "related_name on ForeignKey fields",
      "description": "ForeignKey fields (e.g., post author, comment post, comment author) include related_name for explicit reverse access.",
      "max_score": 8
    },
    {
      "name": "get_absolute_url on Post model",
      "description": "The Post model defines a get_absolute_url() method using reverse() with a namespaced URL.",
      "max_score": 8
    },
    {
      "name": "auto_now_add/auto_now timestamps",
      "description": "Models use auto_now_add for created_at and auto_now for updated_at timestamps, not manual datetime assignment.",
      "max_score": 8
    }
  ]
}

evals

scenario-1

criteria.json

task.md

tile.json