python

python is a cursor rule for Cursor from iloveitaly/llm-ide-rules. It costs 823 tokens per session, scanned A, original, MIT.

A set of coding rules for modern Python projects, covering file paths, documentation, data models, databases, command-line tools, logging, and typing.

In plain words
What is it for?
Use it when writing or reviewing Python code that handles packages, typed data, databases, command-line commands, logs, dates, or files.
Why use it?
It gives the coding agent consistent Python conventions and helps avoid common style and implementation mistakes.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when writing or reviewing Python code that handles packages, typed data, databases, command-line commands, logs, dates, or files.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/iloveitaly/llm-ide-rules/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/iloveitaly/llm-ide-rules

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 python

README.md
[![agentmods](https://agentmods.dev/badge/rules/iloveitaly/llm-ide-rules/python/github.svg)](https://agentmods.dev/rules/iloveitaly/llm-ide-rules/python)
Your own site
<a href="https://agentmods.dev/rules/iloveitaly/llm-ide-rules/python"><img src="https://agentmods.dev/badge/rules/iloveitaly/llm-ide-rules/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 python

Your own site · 80×15
<a href="https://agentmods.dev/rules/iloveitaly/llm-ide-rules/python"><img src="https://agentmods.dev/badge/rules/iloveitaly/llm-ide-rules/python.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 823 This file is loaded in full into every session.
When invoked 823 The same file — it is already loaded in full.
Security scan A 0 findings. 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.00823 $0.00823
Opus 5.5 $0.00329 $0.00329
Sonnet 5.5 $0.00165 $0.00165
Haiku 4.5 $0.00082 $0.00082

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

Security

Grade A, and why

python 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 21d 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/python.mdc · 76 lines

How it starts

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

Python

When writing Python:

  • Assume the latest python, version 3.13.
  • Prefer Pathlib methods (including read and write methods, like read_text) over os.path, open, write, etc.
  • docstrs and comments:
    • If a docstring needs formatting, use markdown. Use Google Style.
    • Prefer docstr to multi-line comments at the top of a function or file.
    • If a docstr does not span multiple lines, do not use triple-quoted strings.
    • If a comment or docstr is a single line, do not end it in a period.
    • Put multiline docstring delimiters on separate lines; leave a blank line after every docstring.
  • Do not create __init__ files unless specifically instructed
  • Use Pydantic models over dataclass or a typed dict.
  • Use SQLAlchemy for generating any SQL queries.
  • Use click for command line argument parsing.
  • Use log.info("the message", the_variable=the_variable) instead of log.info("The message: %s", the_variable) or print for logging. This object can be found at from app import log.
    • Log messages should be lowercase with no leading or trailing whitespace.
    • No variable interpolation in log messages.
    • Do not coerce database IDs, dates, or Path objects to str
  • Do not fix import ordering or other linting issues.
  • Never edit or create any files in migrations/versions/
  • Place all comments on dedicated lines immediately above the code statements they describe. Avoid inline comments appended to the end of code lines.
  • Do not try/catch raw Exceptions unless explicitly told to. Prefer to let exceptions raise and cause an explicit error.
  • Always make an explicit copy before mutating a dictionary that you did not create in the current narrow scope.
  • Never use from __future__
  • Always use re.compile(pattern, re.VERBOSE) and inline # comments to document the logic of each capture group or condition in any complex regular expression.
  • Prefix boolean-returning predicate functions with is_, has_, can_, or should_
  • Prefix validation functions that raise an exception or terminate execution on failure with assert_ rather than check_ or verify_.
  • IMPORTANT never edit app/generated/ files. These are autogenerated.

Read the full file on GitHub · 76 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. 21d ago Changed · +2 lines · +54 tokens per session e939b1ec3c17
  2. 27d ago Changed · +10 tokens per session 94135ed44479
  3. 2mo ago Changed · -1 lines 803e8bfe5de0
  4. 2mo ago Changed · -6 tokens per session f0e2b798ae59
  5. 3mo ago First seen · 75 lines · 765 tokens per session scan A d4fb2f1051fb

Subscribe to this mod's changes

python is a cursor rule published in the GitHub repository iloveitaly/llm-ide-rules (13 stars, last pushed today), licensed MIT. It adds 823 tokens to every session, about $0.0033 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-08-30.

Related

python compared with cursor rules from other repositories

python next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pythoniloveitaly/llm-ide-rulesCursor rule13todayMITA823Cursor
pyspark-etl-best-practices-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A3,275Cursor
python-llm-ml-workflow-cursorrules-prompt-filePatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A1,530Cursor
automl-hyperparameter-optimizationPatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A0Cursor
agent-model-choicecoddy-project/coddy-agentCursor rule215todayMITA0Cursor
11-prompt-maintainerMarcoPorcellato/matryca-plumberCursor rule104yesterdayApache-2.0A14Cursor
llm-integration-rulesholtwood/awesome-cursorrules-zhCursor rule2441mo agoMITA0Cursor