CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/flask-best-practices

Flask patterns -- application factory, blueprints, error handlers, extensions, request lifecycle, configuration, logging, CLI commands

98

1.28x
Quality

98%

Does it follow best practices?

Impact

98%

1.28x

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 follows Flask best practices including application factory, blueprints, error handling, CLI commands, and extensions when building a recipe sharing API.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "create_app factory",
      "description": "app/__init__.py defines a create_app() function that creates and returns a Flask app -- not a module-level app",
      "max_score": 12
    },
    {
      "name": "Blueprints in separate files",
      "description": "Recipes and ratings routes use separate Blueprint objects in separate files under app/routes/",
      "max_score": 10
    },
    {
      "name": "Blueprints registered in factory",
      "description": "Blueprints are imported and registered inside create_app() with url_prefix",
      "max_score": 8
    },
    {
      "name": "Custom exception hierarchy",
      "description": "Agent defines AppError base class with subclasses (NotFoundError, ValidationError) and routes raise these exceptions instead of manually returning error dicts",
      "max_score": 10
    },
    {
      "name": "Consistent error envelope",
      "description": "All error responses use {\"error\": {\"code\": \"...\", \"message\": \"...\"}} shape consistently",
      "max_score": 8
    },
    {
      "name": "CLI command registered in factory",
      "description": "A CLI command (e.g., flask seed-recipes) is registered using @app.cli.command() inside create_app() and uses click.echo() for output",
      "max_score": 10
    },
    {
      "name": "Extensions init_app pattern",
      "description": "Extensions are instantiated in extensions.py without app and bound via init_app() in the factory",
      "max_score": 10
    },
    {
      "name": "Error handlers registered centrally",
      "description": "Error handlers are registered via register_error_handlers(app) called in create_app()",
      "max_score": 8
    },
    {
      "name": "Generic exception handler",
      "description": "A catch-all Exception handler logs with app.logger.exception() and returns 500 without leaking details",
      "max_score": 8
    },
    {
      "name": "Config supports testing",
      "description": "create_app() accepts a config parameter for testing and test fixtures use it to create app instances",
      "max_score": 8
    },
    {
      "name": "Imports inside factory",
      "description": "Blueprints and extensions are imported inside create_app(), not at the top of app/__init__.py",
      "max_score": 8
    }
  ]
}

evals

tile.json