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

Evaluation results

100%

17%

Bookstore Inventory Service

Criteria
Without context
With context

create_app factory

100%

100%

Blueprints in separate files

100%

100%

Extensions init_app pattern

100%

100%

Custom exception hierarchy

50%

100%

Consistent error envelope

20%

100%

Generic exception handler logs errors

87%

100%

DB teardown with teardown_appcontext

100%

100%

DB connection via flask.g

100%

100%

Config supports testing

62%

100%

Error handlers registered in factory

100%

100%

Test fixtures

100%

100%

95%

21%

Event Registration Platform

Criteria
Without context
With context

create_app factory

100%

100%

Blueprints for routes

100%

100%

before_request sets request ID on g

100%

100%

after_request returns response with request ID

100%

100%

Custom exception hierarchy

50%

100%

Consistent error envelope

25%

100%

Extensions init_app pattern

62%

37%

Error handlers in factory

100%

100%

Generic exception handler logs error

12%

100%

Config from environment

50%

100%

Per-request state on g not globals

91%

100%

100%

29%

Recipe Sharing API

Criteria
Without context
With context

create_app factory

100%

100%

Blueprints in separate files

100%

100%

Blueprints registered in factory

75%

100%

Custom exception hierarchy

50%

100%

Consistent error envelope

25%

100%

CLI command registered in factory

80%

100%

Extensions init_app pattern

100%

100%

Error handlers registered centrally

100%

100%

Generic exception handler

12%

100%

Config supports testing

100%

100%

Imports inside factory

12%

100%

97%

19%

Support Ticket System API

Criteria
Without context
With context

create_app factory

100%

100%

Config classes

100%

100%

Blueprints in separate files

100%

100%

Blueprints registered in factory

75%

100%

Custom exception hierarchy

50%

100%

Consistent error envelope

70%

100%

Extensions init_app pattern

25%

62%

Request logging with before/after hooks

100%

100%

Generic exception handler

25%

100%

Error handlers registered centrally

100%

100%

Test fixtures use factory with testing config

100%

100%

100%

23%

Task Management REST API

Criteria
Without context
With context

create_app factory

100%

100%

Blueprints for routes

100%

100%

Blueprints registered in factory

75%

100%

Custom exception classes

60%

100%

Consistent error envelope

70%

100%

register_error_handlers called in factory

100%

100%

Generic exception handler with logging

0%

100%

Extensions in extensions.py with init_app

100%

100%

Config from environment

25%

100%

Test fixtures use factory

100%

100%

Routes raise exceptions not return errors

100%

100%

Evaluated
Agent
Claude Code
Model
Claude Sonnet 4.6

Table of Contents