code-style-and-zen-of-python

code-style-and-zen-of-python is a cursor rule for Cursor from TechNickAI/ai-coding-config. It costs 3 tokens per session (879 once invoked), scanned A, a copy of code-style-and-zen-of-python, MIT.

A set of Python coding rules covering file explanations, useful function documentation, and an 88-character line limit.

In plain words
What is it for?
It guides file-level comments, function docstrings, and formatting in Python projects, including code that connects to services such as OAuth providers or Redis.
Why use it?
It gives people and coding agents enough context to understand why files and functions exist, while keeping code formatting consistent.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It guides file-level comments, function docstrings, and formatting in Python projects, including code that connects to services such as OAuth providers or Redis.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/technickai/ai-coding-config/code-style-and-zen-of-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/TechNickAI/ai-coding-config

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 code-style-and-zen-of-python

README.md
[![agentmods](https://agentmods.dev/badge/rules/technickai/ai-coding-config/code-style-and-zen-of-python/github.svg)](https://agentmods.dev/rules/technickai/ai-coding-config/code-style-and-zen-of-python)
Your own site
<a href="https://agentmods.dev/rules/technickai/ai-coding-config/code-style-and-zen-of-python"><img src="https://agentmods.dev/badge/rules/technickai/ai-coding-config/code-style-and-zen-of-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 code-style-and-zen-of-python

Your own site · 80×15
<a href="https://agentmods.dev/rules/technickai/ai-coding-config/code-style-and-zen-of-python"><img src="https://agentmods.dev/badge/rules/technickai/ai-coding-config/code-style-and-zen-of-python.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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 879 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 92% copy Near-identical to another mod 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.00003 $0.00879
Opus 5.5 $0.00001 $0.00352
Sonnet 5.5 $0.00001 $0.00176
Haiku 4.5 $0.00000 $0.00088

Measured 1mo ago against content hash 80d3126da4e1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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

This is a copy

92% identical to code-style-and-zen-of-python — 1 line differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

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

How it starts

The opening of the file, as written. The whole thing — 120 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 · 120 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. 1mo ago First seen · 120 lines · 3 tokens per session scan A 80d3126da4e1

Subscribe to this mod's changes

code-style-and-zen-of-python is a cursor rule published in the GitHub repository TechNickAI/ai-coding-config (24 stars, last pushed 27d ago), licensed MIT. It adds 3 tokens to every session and 879 once invoked, about $0.0000 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 92% identical to code-style-and-zen-of-python, differing in 1 line, and is treated as a copy.