01-backend-python

01-backend-python is a cursor rule for Cursor from juandoroteoflesiauni-lang/Market-options-stocks-Scanner. It costs 29 tokens per session (1,208 once invoked), scanned A, original, Apache-2.0.

A set of rules for Python backend code, written in Spanish, covering strict typing, asynchronous programming, structured logging, naming, formatting, linting, and security checks.

In plain words
What is it for?
It is for writing and reviewing Python server code, including type annotations, decimal financial values, logging, imports, naming, and CI checks.
Why use it?
It gives backend code a consistent standard and requires automated checks for style, types, security issues, and vulnerable dependencies.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It is for writing and reviewing Python server code, including type annotations, decimal financial values, logging, imports, naming, and CI checks.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/01-backend-python
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/juandoroteoflesiauni-lang/Market-options-stocks-Scanner

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 01-backend-python

README.md
[![agentmods](https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/01-backend-python/github.svg)](https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/01-backend-python)
Your own site
<a href="https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/01-backend-python"><img src="https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/01-backend-python/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 01-backend-python

Your own site · 80×15
<a href="https://agentmods.dev/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/01-backend-python"><img src="https://agentmods.dev/badge/rules/juandoroteoflesiauni-lang/market-options-stocks-scanner/01-backend-python.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 29 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,208 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00029 $0.01208
Opus 5 $0.00015 $0.00604
Sonnet 5 $0.00006 $0.00242
Haiku 4.5 $0.00003 $0.00121

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

Security

Grade A, and why

01-backend-python scanned grade A with 1 finding 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 10d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

requests.get(url) # → await httpx.AsyncClient().get(url)
.cursor/rules/01-backend-python.mdc · 166 lines

How it starts

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

🐍 BACKEND PYTHON — ESTÁNDARES DE CALIDAD v3.0

TOOLCHAIN (Gates de CI — código debe pasar todos antes de presentarlo)

  • black → formato (línea máx. 100 chars)
  • isort → orden de imports (perfil black-compatible)
  • ruff → lint exhaustivo
  • mypy --strict → tipos estrictos
  • bandit → SAST seguridad
  • pip-audit → CVEs en dependencias

TIPADO — OBLIGATORIO EN TODO

# ✅ CORRECTO
async def calculate_vpin(
    snapshot: MarketSnapshot,
    bucket_size: int,
) -> float: ...

# ❌ PROHIBIDO — sin tipos
def calculate_vpin(snapshot, bucket_size): ...

# ❌ PROHIBIDO — Any
from typing import Any
def process(data: Any) -> Any: ...

# ✅ CORRECTO — Decimal para precios (nunca float)
price: Decimal = Decimal("100.05")
# ❌ PROHIBIDO
price: float = 100.05

NOMENCLATURA

Tipo Convención Ejemplo
Clases PascalCase MarketDataHub
Funciones/vars snake_case fetch_snapshot
Constantes UPPER_CASE MAX_CANDIDATES = 300
Privados _single_underscore _circuit_breaker
Variables de 1 letra PROHIBIDO Usar ticker, no t
Nombres genéricos PROHIBIDO Nunca data, val, obj

FUNCIONES — REGLAS DE DISEÑO

# Máximo 30 líneas. Si supera → refactorizar en subfunciones.

# Google-Style docstring OBLIGATORIO en funciones complejas:
async def fetch_option_chain(
    ticker: str,
    expiration_date: date,
) -> Result[list[OptionContract]]:
    """Descarga y valida la cadena completa de opciones.

    Args:
        ticker         : Símbolo en mayúsculas (e.g., "AAPL").
        expiration_date: Fecha de expiración a descargar.

    Returns:
        Result con lista de OptionContract, o failure si la API no responde.

    Raises:
        ValidationError: Si la respuesta falla validación de esquema.
    """

LOGGING — NO PRINT

import logging
logger = logging.getLogger(__name__)

# ✅ CORRECTO
logger.info("Fase A completa", extra={"count": len(candidates)})
logger.error("Fallo en Hub", extra={"ticker": ticker}, exc_info=True)

# ❌ PROHIBIDO
print(f"Fase A: {len(candidates)}")

Read the full file on GitHub · 166 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. 10d ago First seen · 166 lines · 1,208 tokens per session scan A 94febf6c8ad1

Subscribe to this mod's changes

01-backend-python is a cursor rule published in the GitHub repository juandoroteoflesiauni-lang/Market-options-stocks-Scanner (11 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 29 tokens to every session and 1,208 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.