flask-route

flask-route is a command for Claude Code from swesmith/davila7__claude-code-templates.734b8a50. It costs 0 tokens per session (1,357 once invoked), scanned A, a copy of flask-route, MIT.

A Flask command that creates web routes, which are the code handling URLs and HTTP requests. Flask is a Python web framework.

In plain words
What is it for?
Use it to scaffold API or web endpoints, including optional authentication and pagination.
Why use it?
It avoids repeatedly setting up request validation, error handling, JSON responses, and status codes for each route.

Command for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it to scaffold API or web endpoints, including optional authentication and pagination.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/swesmith/davila7__claude-code-templates.734b8a50/flask-route
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/swesmith/davila7__claude-code-templates.734b8a50

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for flask-route

README.md
[![agentmods](https://agentmods.dev/badge/commands/swesmith/davila7__claude-code-templates.734b8a50/flask-route/github.svg)](https://agentmods.dev/commands/swesmith/davila7__claude-code-templates.734b8a50/flask-route)
Your own site
<a href="https://agentmods.dev/commands/swesmith/davila7__claude-code-templates.734b8a50/flask-route"><img src="https://agentmods.dev/badge/commands/swesmith/davila7__claude-code-templates.734b8a50/flask-route/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for flask-route

Your own site · 80×15
<a href="https://agentmods.dev/commands/swesmith/davila7__claude-code-templates.734b8a50/flask-route"><img src="https://agentmods.dev/badge/commands/swesmith/davila7__claude-code-templates.734b8a50/flask-route.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,357 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01357
Opus 5 $0.00000 $0.00678
Sonnet 5 $0.00000 $0.00271
Haiku 4.5 $0.00000 $0.00136

Measured 7d ago against content hash 475aaf0eb90d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

flask-route scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to flask-route — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

cli-tool/templates/python/examples/flask-app/.claude/commands/flask-route.md · 217 lines

How it starts

The opening of the file, as written. The whole thing — 217 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Flask Route Generator

Create Flask routes with proper structure and error handling.

Purpose

This command helps you quickly create Flask routes with validation, error handling, and best practices.

Usage

/flask-route

What this command does

  1. Creates route functions with proper decorators
  2. Adds request validation and error handling
  3. Includes JSON responses and status codes
  4. Implements authentication if needed
  5. Follows Flask conventions and best practices

Example Output

# routes.py or app.py
from flask import Flask, request, jsonify, abort
from flask_sqlalchemy import SQLAlchemy
from werkzeug.exceptions import BadRequest

app = Flask(__name__)

@app.route('/users', methods=['GET'])
def get_users():
    """Get all users with optional pagination."""
    try:
        page = request.args.get('page', 1, type=int)
        per_page = request.args.get('per_page', 10, type=int)
        
        users = User.query.paginate(
            page=page, 
            per_page=per_page, 
            error_out=False
        )
        
        return jsonify({
            'users': [user.to_dict() for user in users.items],
            'total': users.total,
            'pages': users.pages,
            'current_page': page
        }), 200
        
    except Exception as e:
        return jsonify({'error': 'Failed to fetch users'}), 500

@app.route('/users/<int:user_id>', methods=['GET'])
def get_user(user_id):
    """Get a specific user by ID."""
    try:
        user = User.query.get_or_404(user_id)
        return jsonify(user.to_dict()), 200
        
    except Exception as e:
        return jsonify({'error': 'User not found'}), 404

@app.route('/users', methods=['POST'])
def create_user():
    """Create a new user."""
    try:
        data = request.get_json()
        
        if not data:
            return jsonify({'error': 'No data provided'}), 400
        
        # Validate required fields
        required_fields = ['name', 'email']
        for field in required_fields:
            if field not in data:
                return jsonify({'error': f'{field} is required'}), 400
        
        # Check if email already exists
        if User.query.filter_by(email=data['email']).first():
            return jsonify({'error': 'Email already exists'}), 409
        
        # Create new user
        user = User(
            name=data['name'],
            email=data['email'],
            phone=data.get('phone'),
            address=data.get('address')
        )
        
        db.session.add(user)
        db.session.commit()
        
        return jsonify(user.to_dict()), 201
        
    except BadRequest:
        return jsonify({'error': 'Invalid JSON data'}), 400
    except Exception as e:
        db.session.rollback()
        return jsonify({'error': 'Failed to create user'}), 500

@app.route('/users/<int:user_id>', methods=['PUT'])
def update_user(user_id):
    """Update an existing user."""
    try:
        user = User.query.get_or_404(user_id)
        data = request.get_json()
        
        if not data:
            return jsonify({'error': 'No data provided'}), 400
        
        # Update fields
        if 'name' in data:
            user.name = data['name']
        if 'email' in data:
            # Check if new email already exists
            existing_user = User.query.filter_by(email=data['email']).first()
            if existing_user and existing_user.id != user_id:
                return jsonify({'error': 'Email already exists'}), 409
            user.email = data['email']
        if 'phone' in data:
            user.phone = data['phone']
        if 'address' in data:
            user.address = data['address']
        
        db.session.commit()
        
        return jsonify(user.to_dict()), 200
        
    except BadRequest:
        return jsonify({'error': 'Invalid JSON data'}), 400
    except Exception as e:
        db.session.rollback()
        return jsonify({'error': 'Failed to update user'}), 500

@app.route('/users/<int:user_id>', methods=['DELETE'])
def delete_user(user_id):
    """Delete a user."""
    try:
        user = User.query.get_or_404(user_id)
        
        db.session.delete(user)
        db.session.commit()
        
        return jsonify({'message': 'User deleted successfully'}), 200
        
    except Exception as e:
        db.session.rollback()
        return jsonify({'error': 'Failed to delete user'}), 500

# Error handlers
@app.errorhandler(404)
def not_found(error):
    return jsonify({'error': 'Resource not found'}), 404

@app.errorhandler(400)
def bad_request(error):
    return jsonify({'error': 'Bad request'}), 400

@app.errorhandler(500)
def internal_error(error):
    return jsonify({'error': 'Internal server error'}), 500

Read the full file on GitHub · 217 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 217 lines · 0 tokens per session scan A 475aaf0eb90d

Subscribe to this mod's changes

flask-route is a command published in the GitHub repository swesmith/davila7__claude-code-templates.734b8a50 (2 stars, last pushed 8mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,357 tokens. A static security scan graded it A with 0 findings. It is 100% identical to flask-route, differing in 0 lines, and is treated as a copy.