flask

A set of conventions for Flask, a lightweight Python framework for building web applications and APIs.

In plain words
What is it for?
Use it when building Flask web apps or APIs with organized routes, database models, authentication, forms, and migrations.
Why use it?
It provides an agreed structure for routes, databases, configuration, migrations, extensions, and error handling in Flask projects.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/wangtingyeye/llm-agent-study/flask
Clone the repo
git clone --depth 1 https://github.com/WangTingYeYe/llm-agent-study

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 166 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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 $0.00000 $0.00166
Opus 5 $0.00000 $0.00083
Sonnet 5 $0.00000 $0.00033
Haiku 4.5 $0.00000 $0.00017

Measured yesterday against content hash 870b3aa52a1e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

flask 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 yesterday.

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.

.cursor/rules/frameworks/flask.mdc · 21 lines

What it actually says


description: 该规则解释了 Flask 轻量级 Python Web 应用程序的约定和最佳实践。 globs: **/*.py alwaysApply: false

Flask 规则

  • 使用 Blueprints 按功能或资源组织路由
  • 使用 Flask-SQLAlchemy 处理数据库模型和 ORM
  • 使用应用工厂(application factories)实现灵活的应用初始化
  • 使用 Flask 扩展实现常见功能(Flask-Login、Flask-WTF 等)
  • 在环境变量中存储配置
  • 使用 Flask-Migrate 进行数据库迁移
  • 使用错误处理器实现适当的错误处理
  • 使用 Flask-RESTful 或类似工具构建 API
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. yesterday First seen · 21 lines · 0 tokens per session scan A 870b3aa52a1e

Subscribe to this mod's changes

flask is a cursor rule published in the GitHub repository WangTingYeYe/llm-agent-study (4 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 166 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.