Flask API Development Table of Contents - Overview - When to Use - Quick Start - Reference Guides - Best Practices Overview Create efficient Flask APIs with blueprints for modular organization, SQLAlchemy for ORM, JWT authentication, comprehensive error handling, and proper request validation following REST principles. When to Use - Building RESTful APIs with Flask - Creating microservices with minimal overhead - Implementing lightweight authentication systems - Designing API endpoints with proper validation - Integrating with relational databases - Building request/response handling systems…

\n return re.match(pattern, email) is not None\n\n# Usage\n@users_bp.route('', methods=['POST'])\n@validate_json('email', 'password', 'first_name')\ndef create_user():\n data = request.get_json()\n if not validate_email(data['email']):\n return jsonify({'error': 'Invalid email format'}), 400\n # ... rest of logic\n```\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":1205,"content_sha256":"c820ef443f0efd7e373bda5da3038f10f50a1cb90615c434c098ab6996fa753a"},{"filename":"scripts/validate-api.sh","content":"#!/bin/bash\n# validate-api.sh - Validate API specification\n# Usage: ./validate-api.sh \u003copenapi_spec>\n\nset -euo pipefail\n\nSPEC_FILE=\"${{1:?Usage: $0 \u003copenapi_spec>}}\"\n\necho \"Validating API spec: $SPEC_FILE\"\n\n# TODO: Add API validation\n# - Validate OpenAPI/Swagger syntax\n# - Check endpoint naming conventions\n# - Verify response schemas\n# - Check for required headers\n# - Validate authentication definitions\n\necho \"API validation complete.\"\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":440,"content_sha256":"853aaca990626c8d2499d41acddc0acf26114cc8c3f4110907a757fe582dfcf2"},{"filename":"templates/api-scaffold.yaml","content":"# API Endpoint Scaffold\n# TODO: Customize for your API framework\n\nopenapi: \"3.0.3\"\ninfo:\n title: \"API Service\"\n version: \"1.0.0\"\n\npaths:\n /api/v1/resource:\n get:\n summary: \"List resources\"\n # TODO: Define parameters and responses\n responses:\n \"200\":\n description: \"Success\"\n post:\n summary: \"Create resource\"\n # TODO: Define request body and responses\n responses:\n \"201\":\n description: \"Created\"\n","content_type":"application/yaml; charset=utf-8","language":"yaml","size":467,"content_sha256":"164b223f2d899b74ce576dc79f8dc38b2b1f9e0013f9a515931f48097961a17e"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Flask API Development","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Table of Contents","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Overview","type":"text","marks":[{"type":"link","attrs":{"href":"#overview","title":null}}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"When to Use","type":"text","marks":[{"type":"link","attrs":{"href":"#when-to-use","title":null}}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Quick Start","type":"text","marks":[{"type":"link","attrs":{"href":"#quick-start","title":null}}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Reference Guides","type":"text","marks":[{"type":"link","attrs":{"href":"#reference-guides","title":null}}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Best Practices","type":"text","marks":[{"type":"link","attrs":{"href":"#best-practices","title":null}}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Overview","type":"text"}]},{"type":"paragraph","content":[{"text":"Create efficient Flask APIs with blueprints for modular organization, SQLAlchemy for ORM, JWT authentication, comprehensive error handling, and proper request validation following REST principles.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"When to Use","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Building RESTful APIs with Flask","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Creating microservices with minimal overhead","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Implementing lightweight authentication systems","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Designing API endpoints with proper validation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Integrating with relational databases","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Building request/response handling systems","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Quick Start","type":"text"}]},{"type":"paragraph","content":[{"text":"Minimal working example:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"# app.py\nfrom flask import Flask, request, jsonify\nfrom flask_cors import CORS\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_jwt_extended import JWTManager\nimport os\n\napp = Flask(__name__)\napp.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL', 'sqlite:///app.db')\napp.config['JWT_SECRET_KEY'] = os.getenv('JWT_SECRET_KEY', 'dev-secret')\napp.config['JSON_SORT_KEYS'] = False\n\ndb = SQLAlchemy(app)\njwt = JWTManager(app)\nCORS(app)\n\n# Request ID middleware\[email protected]_request\ndef assign_request_id():\n import uuid\n request.request_id = str(uuid.uuid4())\n\n# Error handlers\[email protected](400)\ndef bad_request(error):\n// ... (see reference guides for full implementation)","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Reference Guides","type":"text"}]},{"type":"paragraph","content":[{"text":"Detailed implementations in the ","type":"text"},{"text":"references/","type":"text","marks":[{"type":"code_inline"}]},{"text":" directory:","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Guide","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Contents","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Flask Application Setup","type":"text","marks":[{"type":"link","attrs":{"href":"references/flask-application-setup.md","title":null}}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Flask Application Setup","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Database Models with SQLAlchemy","type":"text","marks":[{"type":"link","attrs":{"href":"references/database-models-with-sqlalchemy.md","title":null}}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Database Models with SQLAlchemy","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Authentication and JWT","type":"text","marks":[{"type":"link","attrs":{"href":"references/authentication-and-jwt.md","title":null}}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Authentication and JWT","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Blueprints for Modular API Design","type":"text","marks":[{"type":"link","attrs":{"href":"references/blueprints-for-modular-api-design.md","title":null}}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Blueprints for Modular API Design","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Request Validation","type":"text","marks":[{"type":"link","attrs":{"href":"references/request-validation.md","title":null}}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Request Validation","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Application Factory and Configuration","type":"text","marks":[{"type":"link","attrs":{"href":"references/application-factory-and-configuration.md","title":null}}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Application Factory and Configuration","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Best Practices","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"✅ DO","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use blueprints for modular organization","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Implement proper authentication with JWT","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Validate all user input","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use SQLAlchemy ORM for database operations","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Implement comprehensive error handling","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use pagination for collection endpoints","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Log errors and important events","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Return appropriate HTTP status codes","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Implement CORS properly","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use environment variables for configuration","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"❌ DON'T","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Store secrets in code","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use global variables for shared state","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Ignore database transactions","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Trust user input without validation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Return stack traces in production","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use mutable default arguments","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Forget to handle database connection errors","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Implement authentication in route handlers","type":"text"}]}]}]}]},"metadata":{"date":"2026-11-02","name":"flask-api-development","author":"@skillopedia","source":{"stars":375,"repo_name":"useful-ai-prompts","origin_url":"https://github.com/aj-geddes/useful-ai-prompts/blob/HEAD/skills/flask-api-development/SKILL.md","repo_owner":"aj-geddes","body_sha256":"956d96301276c63b142a7188539a8a09f734ea7458230ccd00a886a7e011282d","cluster_key":"08c2ae023ae699d51513f632c992e40bbc99f6a3fad9ad9439f19b36ad8f6385","clean_bundle":{"format":"clean-skill-bundle-v1","source":"aj-geddes/useful-ai-prompts/skills/flask-api-development/SKILL.md","text_bytes":11806,"source_commit":"3f5182cfd739fc113f4af5244a1cf342ad7f7911","skills_sh_rank":10274,"attachment_count":8,"text_attachments":8,"attachment_storage":"skill_attachments","binary_attachments":0},"cluster_size":1,"skill_md_path":"skills/flask-api-development/SKILL.md","import_metadata":{"date":"2026-11-02","author":"@skillopedia","version":"v1","category":"web-development","category_label":"Web"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"web-development","import_tag":"skills-sh-top20k-2026-11","description":"Develop lightweight Flask APIs with routing, blueprints, database integration, authentication, and request/response handling. Use when building RESTful APIs, microservices, or lightweight web services with Flask.\n"}},"renderedAt":1793671244266}

Flask API Development Table of Contents - Overview - When to Use - Quick Start - Reference Guides - Best Practices Overview Create efficient Flask APIs with blueprints for modular organization, SQLAlchemy for ORM, JWT authentication, comprehensive error handling, and proper request validation following REST principles. When to Use - Building RESTful APIs with Flask - Creating microservices with minimal overhead - Implementing lightweight authentication systems - Designing API endpoints with proper validation - Integrating with relational databases - Building request/response handling systems…