code-style-and-zen-of-python

Python coding rules focused on clear file documentation, useful comments, and an 88-character line limit.

In plain words
What is it for?
Use them when writing or reviewing Python files, especially when adding module descriptions, function docstrings, comments for complex logic, or formatting and lint checks.
Why use it?
They make unfamiliar code easier for people and AI assistants to understand while keeping formatting consistent with Ruff.

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/technickai/claude_telemetry/code-style-and-zen-of-python
Clone the repo
git clone --depth 1 https://github.com/TechNickAI/claude_telemetry

Made for: Cursor.

Per session 3 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 870 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.00003 $0.00870
Opus 5 $0.00002 $0.00435
Sonnet 5 $0.00001 $0.00174
Haiku 4.5 $0.00000 $0.00087

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

Security

Grade A, and why

code-style-and-zen-of-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 3d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/code-style-and-zen-of-python.mdc · 119 lines

How it starts

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

Code Style and Zen of Python

Line Length

  • Max 88 chars (per Ruff config)

Comments

File-Level Comments

Be THOROUGH at the top of files. Explain what the file does, why it exists, and how it fits into the larger system. This helps both humans and AI understand context quickly.

"""User authentication and session management.

Handles user login, logout, token generation, and session validation.
Integrates with external OAuth providers (Google, GitHub) and maintains
local session state in Redis for performance. Session tokens expire after
24 hours but can be refreshed up to 7 days from initial login.
"""

Function Comments

Keep function docstrings USEFUL without redundant fluff. Type hints already document parameters and return types, so focus the docstring on what the function does and why.

# Standard pattern for complex functions - explain the what and why
def create_agent_from_task(self, task_id: str) -> dict:
    """Create a new agent from a ClickUp task description.

    Parses task description for agent requirements, generates the .agent
    file with system/user prompts, creates PR with the new file, and
    returns PR URL for review.
    """

# Simple functions need just one clear line
def validate_email(email: str) -> bool:
    """Check if email format is valid and domain is not blacklisted."""

def process_payment(order_id: str, amount: Decimal) -> Payment:
    """Charge the customer via Stripe and update order status to paid."""

def send_welcome_email(user: User) -> None:
    """Send onboarding email with account setup instructions."""

def calculate_shipping_cost(weight: Decimal, destination: str) -> Decimal:
    """Calculate shipping based on weight and zone rates from ShipStation."""

Avoid restating type hints in Args/Returns sections - they add no value since types are already declared.

Inline Comments

Be SPARSE with inline comments. Only add them when the code is doing something non-obvious or when explaining business logic that isn't clear from the code itself.

Read the full file on GitHub · 119 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. 3d ago First seen · 119 lines · 3 tokens per session scan A c8c6e3f8bdd4

Subscribe to this mod's changes

code-style-and-zen-of-python is a cursor rule published in the GitHub repository TechNickAI/claude_telemetry (30 stars, last pushed 10mo ago), licensed MIT. It adds 3 tokens to every session and 870 once invoked, about $0.0000 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-08-30.