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

task.mdevals/scenario-5/

Task Management REST API

Problem/Feature Description

A small team wants a task management backend built with Flask. They need a REST API where users can create projects and add tasks to them. Each task has a title, description, status (todo/in_progress/done), and priority (low/medium/high). Each project has a name and description.

The team specifically wants:

  1. A clean, well-structured Flask project they can extend later with authentication and real database support.
  2. Proper error handling -- if a project or task doesn't exist, the API should return a clear JSON error. Validation errors (missing title, invalid status) should also return structured JSON.
  3. CORS enabled so their React frontend can call the API.
  4. For now, an in-memory data store is fine (dictionaries/lists), but the structure should make it easy to swap in a real database later.

Build the complete Flask application with endpoints for:

  • POST /api/projects -- create a project
  • GET /api/projects -- list all projects
  • GET /api/projects/<id> -- get a single project
  • POST /api/projects/<id>/tasks -- create a task in a project
  • GET /api/projects/<id>/tasks -- list tasks in a project
  • PATCH /api/tasks/<id> -- update a task's status or priority

Output Specification

Produce Python source files in a task-manager/ directory:

  • app/__init__.py -- application factory
  • app/extensions.py -- extension instances
  • app/errors.py -- custom exceptions and error handler registration
  • app/routes/projects.py -- project blueprint
  • app/routes/tasks.py -- task blueprint
  • app/db.py -- in-memory data store
  • tests/conftest.py -- test fixtures
  • run.py -- entry point
  • requirements.txt

Do not run pip install or start the server.

evals

tile.json