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.
git clone --depth 1 https://github.com/batpool/upstox-totpWrote 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.
[](https://agentmods.dev/rules/batpool/upstox-totp/pydantic)<a href="https://agentmods.dev/rules/batpool/upstox-totp/pydantic"><img src="https://agentmods.dev/badge/rules/batpool/upstox-totp/pydantic/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.
<a href="https://agentmods.dev/rules/batpool/upstox-totp/pydantic"><img src="https://agentmods.dev/badge/rules/batpool/upstox-totp/pydantic.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02096 | $0.02096 |
| Opus 5.5 | $0.00838 | $0.00838 |
| Sonnet 5.5 | $0.00419 | $0.00419 |
| Haiku 4.5 | $0.00210 | $0.00210 |
Grade A, and why
pydantic 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 23d 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.
How it starts
The opening of the file, as written. The whole thing — 357 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Cursor Rules for Pydantic Python (Strict Mode)
====================
Core Principles
====================
- Always use Pydantic v2 (latest version)
- Enable strict mode by default for type safety
- Prefer explicit over implicit type definitions
- Use type hints for all fields
- Validate data at boundaries (API, database, external services)
====================
Model Definition Rules
====================
from pydantic import BaseModel, Field, ConfigDict, field_validator, model_validator from typing import Optional, List, Dict, Any, Union, Literal from datetime import datetime, date from decimal import Decimal from enum import Enum
Always use ConfigDict for configuration (Pydantic v2)
class StrictModel(BaseModel): model_config = ConfigDict( # Strict mode - no type coercion strict=True,
# Validate on assignment
validate_assignment=True,
# Use enum values instead of names
use_enum_values=True,
# Forbid extra fields
extra='forbid',
# Validate default values
validate_default=True,
# Enable arbitrary types if needed
arbitrary_types_allowed=False,
# Freeze model after creation (immutable)
frozen=False, # Set to True for immutable models
# JSON schema extras
json_schema_extra={
"example": {
"field1": "value1",
"field2": 123
}
}
)
====================
Field Definition Rules
====================
class UserModel(BaseModel): model_config = ConfigDict(strict=True, extra='forbid')
# Required fields with no default
id: int
username: str
# Optional fields with explicit None default
email: Optional[str] = None
# Fields with defaults
is_active: bool = True
# Fields with Field() for additional validation
age: int = Field(gt=0, le=150, description="User's age")
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.
- 23d ago First seen · 357 lines · 2,096 tokens per session scan A 53d372ccea5b
pydantic is a cursor rule published in the GitHub repository batpool/upstox-totp (15 stars, last pushed 8mo ago), licensed MIT. It adds 2,096 tokens to every session, about $0.0084 per session on Opus 5.5. 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-09-25.
Other cursor rules, from other repositories
python_tests
We use the unit tests to cover internal behavior that can work without the web / backend counterpart. We aim for 95%+ unit test coverage of our Python code in lib/streamlit.
django-python
Rules for writing Python services at PostHog (Python servers powered by the Django framework).
py-fast-api
Cursor rules for Python FastAPI backend development and best practices.
python
Python best practices and patterns for modern software development with Flask and SQLite.
python--typescript-guide-cursorrules-prompt-file
Cursor rules for Python development with TypeScript guide integration.
aiohttp
This guide defines definitive best practices for using aiohttp, focusing on efficient, robust, and maintainable asynchronous HTTP client code.