awesome-cursor-rules-mdc is a generator that creates Cursor MDC rule files from structured library information, using semantic search and language models to gather and organize guidance. Developers use it to produce reusable rules for libraries in Cursor, and the catalogue includes 200 of those rules.
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/sanjeed5/awesome-cursor-rules-mdcWrote 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/sanjeed5/awesome-cursor-rules-mdc/pydantic)<a href="https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/pydantic"><img src="https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/pydantic.svg" alt="Measured on agentmods" 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.01590 | $0.01590 |
| Opus 5 | $0.00795 | $0.00795 |
| Sonnet 5 | $0.00318 | $0.00318 |
| Haiku 4.5 | $0.00159 | $0.00159 |
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 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.
How it starts
The opening of the file, as written. The whole thing — 218 lines — stays where its author put it; the contents beside it link to each section on GitHub.
pydantic Best Practices
Pydantic v2 is the standard for data validation in modern Python. Follow these rules to build type-safe, efficient, and maintainable data models.
1. Model Naming and Organization
Always use clear, singular nouns for models and group them in a dedicated models/ package. This improves discoverability and maintains a consistent project structure.
❌ BAD:
# In user_operations.py
class UserData(BaseModel):
name: str
email: EmailStr
# In users_api.py
class UserRequest(BaseModel):
name: str
email: EmailStr
✅ GOOD:
# In models/user.py
from pydantic import BaseModel, EmailStr
class User(BaseModel):
id: int
name: str
email: EmailStr
2. Strict Typing and Immutability
Prefer concrete types over Any. Use Strict* types when no coercion is acceptable. Enable validate_assignment=True for mutable models, or frozen=True for immutable models. Immutability is generally preferred for data models to prevent unexpected state changes.
❌ BAD:
from pydantic import BaseModel
from typing import Any
class Item(BaseModel):
quantity: Any # Allows "5" or 5
price: float # Allows "10.5" or 10.5
✅ GOOD:
from pydantic import BaseModel, StrictInt, StrictFloat, ConfigDict
class ImmutableItem(BaseModel):
model_config = ConfigDict(frozen=True) # Makes instances immutable
id: int
name: str
quantity: StrictInt # Only accepts int, "5" will fail
price: StrictFloat # Only accepts float, "10.5" will fail
class MutableUser(BaseModel):
model_config = ConfigDict(validate_assignment=True) # Validates on update
name: str
age: int
user = MutableUser(name="Alice", age=30)
user.age = "31" # This will raise a ValidationError
3. Safe Default Values
Never use mutable objects (lists, dicts, sets) as direct default values. This leads to shared state across instances. Always use default_factory or Field(default_factory=...).
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.
- 4d ago First seen · 218 lines · 1,590 tokens per session scan A 691b584684c3
pydantic is a cursor rule published in the GitHub repository sanjeed5/awesome-cursor-rules-mdc (3,571 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 1,590 tokens to every session, about $0.0080 per session on Opus 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-03.
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.
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.
django-python
Rules for writing Python services at PostHog (Python servers powered by the Django framework).
10-backend-python
Backend Python development rules for FastAPI, SQLAlchemy 2.x, async patterns, and Alembic migrations.