routers

routers is a cursor rule for Cursor from Promptly-Technologies-LLC/fastapi-jinja2-postgres-webapp. It costs 0 tokens per session (330 once invoked), scanned A, original, MIT.

Project rules for adding web application routers, which are code modules that handle incoming URLs and requests. They describe authentication, request validation, permissions, database sessions, and error handling.

In plain words
What is it for?
Use them when creating or changing API or web routes, especially routes that require logged-in users, permission checks, form data, or database access.
Why use it?
They help new routes follow the application’s existing security and data-handling conventions. This reduces inconsistent authentication checks, validation, and database transactions.

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/promptly-technologies-llc/fastapi-jinja2-postgres-webapp/routers
Clone the repo
git clone --depth 1 https://github.com/Promptly-Technologies-LLC/fastapi-jinja2-postgres-webapp

Made for: Cursor.

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 routers

README.md
[![agentmods](https://agentmods.dev/badge/rules/promptly-technologies-llc/fastapi-jinja2-postgres-webapp/routers.svg)](https://agentmods.dev/rules/promptly-technologies-llc/fastapi-jinja2-postgres-webapp/routers)
Your own site
<a href="https://agentmods.dev/rules/promptly-technologies-llc/fastapi-jinja2-postgres-webapp/routers"><img src="https://agentmods.dev/badge/rules/promptly-technologies-llc/fastapi-jinja2-postgres-webapp/routers.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 330 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.00330
Opus 5 $0.00000 $0.00165
Sonnet 5 $0.00000 $0.00066
Haiku 4.5 $0.00000 $0.00033

Measured 4d ago against content hash 74a30b037bad, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

routers 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 4d 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.

.cursor/rules/routers.mdc · 30 lines

What it actually says

Here are the five most critical patterns to maintain consistency when adding a new router:

  1. Authentication & Dependency Injection

    • Import get_authenticated_user from utils.core.dependencies and include user: User = Depends(get_authenticated_user) in the arguments of routes requiring authentication
    • Similarly, use the get_optional_user dependency for public routes with potential auth status
  2. Validation Patterns

    • Validate requests with type hints in the route signature
    • Use Annotated[str, Form()] for complex request validation cases involving form data
    • Perform business logic validation checks in the route body, raising a custom HTTPException defined in exceptions/http_exceptions.py
    • Note that all exceptions will be handled by middleware in main.py that renders an error template
  3. Permission System

    • Use user.has_permission(ValidPermissions.X, resource) for authorization
    • Validate organization membership through role relationships
    • Check permissions at both route and template levels via user_permissions
  4. Database & Transaction Patterns

    • Inject session via Depends(get_session) from utils/core/dependencies.py
    • Commit after writes and refresh objects where needed
    • Use selectinload for eager loading relationships
    • Follow PRG pattern with RedirectResponse after mutations
  5. Templating

    • Use Jinja templates from the /templates directory in GET routes, and always pass request and user objects as as context
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. 4d ago First seen · 30 lines · 0 tokens per session scan A 74a30b037bad

Subscribe to this mod's changes

routers is a cursor rule published in the GitHub repository Promptly-Technologies-LLC/fastapi-jinja2-postgres-webapp (10 stars, last pushed 28d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 330 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.