CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/fastapi-error-handling

Production error handling for FastAPI — exception handlers, structured error

96

6.12x
Quality

96%

Does it follow best practices?

Impact

98%

6.12x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

payment-api.jsonverifiers/

{
  "instruction": "Build a payment processing API with FastAPI",
  "relevant_when": "Agent builds a FastAPI API, payment service, or any Python web API with business logic",
  "context": "Proactively check that agents apply FastAPI error handling best practices when building any FastAPI application, even when not explicitly asked to add error handling.",
  "sources": [
    {
      "type": "file",
      "filename": "skills/fastapi-error-handling/SKILL.md",
      "tile": "tessl-labs/fastapi-error-handling"
    }
  ],
  "checklist": [
    {
      "name": "custom-exception-hierarchy",
      "rule": "Agent defines custom exception classes (a base class and specific subclasses like NotFoundError, ConflictError) rather than using bare HTTPException with string details everywhere",
      "relevant_when": "Agent builds a FastAPI application with multiple error conditions"
    },
    {
      "name": "exception-handler-registered",
      "rule": "Agent registers @app.exception_handler for custom exception types that returns a structured JSON response with a machine-readable code and human-readable message",
      "relevant_when": "Agent builds a FastAPI application"
    },
    {
      "name": "request-validation-handler",
      "rule": "Agent registers @app.exception_handler(RequestValidationError) to reformat Pydantic validation errors with field-level detail instead of relying on FastAPI's default 422",
      "relevant_when": "Agent builds a FastAPI application that accepts request bodies"
    },
    {
      "name": "generic-exception-handler",
      "rule": "Agent registers @app.exception_handler(Exception) that returns a safe generic error message without leaking stack traces or internal details",
      "relevant_when": "Agent builds a FastAPI application"
    },
    {
      "name": "consistent-error-format",
      "rule": "All error responses use the same JSON shape with at least a code/type field and a message field, consistent across all routes and error types",
      "relevant_when": "Agent returns error responses from FastAPI routes"
    }
  ]
}

tile.json