Cursor rule
.cursor/rules/code-style-and-zen-of-python.mdcWhen writing code
Cursor rules
Quality
62/100
Scores the file, not the repository.Length
609 words
18 headings · 3 code blocksRepository
0
— · pushed 9 days agoLast changed
3 days ago
First indexed 3 days ago.1234567# Code Style and Zen of Python89## Line Length1011- Max 88 chars (per Ruff config)1213## Comments1415### File-Level Comments1617Be THOROUGH at the top of files. Explain what the file does, why it exists, and how it18fits into the larger system. This helps both humans and AI understand context quickly.1920```python21"""User authentication and session management.2223Handles user login, logout, token generation, and session validation.24Integrates with external OAuth providers (Google, GitHub) and maintains25local session state in Redis for performance. Session tokens expire after2624 hours but can be refreshed up to 7 days from initial login.27"""28```2930### Function Comments3132Keep function docstrings USEFUL without redundant fluff. Type hints already document33parameters and return types, so focus the docstring on what the function does and why.3435```python36# Standard pattern for complex functions - explain the what and why37def create_agent_from_task(self, task_id: str) -> dict:38 """Create a new agent from a ClickUp task description.3940 Parses task description for agent requirements, generates the .agent41 file with system/user prompts, creates PR with the new file, and42 returns PR URL for review.43 """4445# Simple functions need just one clear line46def validate_email(email: str) -> bool:47 """Check if email format is valid and domain is not blacklisted."""4849def process_payment(order_id: str, amount: Decimal) -> Payment:50 """Charge the customer via Stripe and update order status to paid."""5152def send_welcome_email(user: User) -> None:53 """Send onboarding email with account setup instructions."""5455def calculate_shipping_cost(weight: Decimal, destination: str) -> Decimal:56 """Calculate shipping based on weight and zone rates from ShipStation."""57```5859Avoid restating type hints in Args/Returns sections - they add no value since types are60already declared.6162### Inline Comments6364Be SPARSE with inline comments. Only add them when the code is doing something65non-obvious or when explaining business logic that isn't clear from the code itself.6667```python68# When to use inline comments - explains non-obvious business rule69user = User.objects.get(id=user_id)70if user.last_login < cutoff_date:71 # Inactive users over 90 days require re-verification per security policy72 send_verification_email(user)7374# Section dividers for organization75# ============================================================================76# Order Processing77# ============================================================================7879# Explaining why something unusual is done80cache_timeout = 300 # 5 minutes - balance between freshness and API rate limits8182# Complex calculations benefit from step comments83total = base_price84total += base_price * tax_rate # Add sales tax85total -= discount_amount # Apply promotional discount86total += shipping_cost # Shipping calculated by weight and zone87```8889Skip obvious comments (like "Get the user" on a line that gets a user). Let the code90speak for itself.9192### General Guidelines9394We explain the "why", not the "what". We don't state the obvious - we prefer95self-documenting code. Emojis when they add clarity; tasteful humor welcome! We write96for humans AND AI - good comments help both understand context.9798## Zen of Python991001. Readability is the number 1 code quality metric1012. Beautiful is better than ugly1023. Explicit is better than implicit1034. Simple is better than complex1045. Complex is better than complicated1056. Flat is better than nested1067. Sparse is better than dense1078. Special cases aren't special enough to break the rules108 - Although practicality beats purity1099. Errors should never pass silently110 - Unless explicitly silenced11110. In the face of ambiguity, refuse the temptation to guess11211. There should be one -- and preferably only one -- obvious way to do it11312. Now is better than never114115## Language116117We avoid hyperbolic language like "CRITICAL" unless something genuinely dies without it.118We use the appropriate level of language for what's needed. (Yes, AIs, this means you -119dial back the drama!)120
Also in Light-Brands/planetary-party-html
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Light-Brands/planetary-party-html.cursor/rules/ruff-linting.mdc · 0 | Cursor rules | lint-format | 43/100 | 3 days ago | |
| Light-Brands/planetary-party-html.claude/agents/CLAUDE.md · 0 | CLAUDE.md | testlint-formatagent-behaviour | 53/100 | 3 days ago | |
| Light-Brands/planetary-party-html.claude/skills/CLAUDE.md · 0 | CLAUDE.md | lint-formatagent-behaviour | 49/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/git-commit-message.mdc · 0 | Cursor rules | archgitdeployment | 58/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/autonomous-development-workflow.mdc · 0 | Cursor rules | testlint-formatgitagent-behaviour | 73/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/code-review-standards.mdc · 0 | Cursor rules | testtypestesting-strategygit+2 | 48/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/external-apis.mdc · 0 | Cursor rules | testtesting-strategyapi | 54/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/fixing-github-actions-builds.mdc · 0 | Cursor rules | setupbuilddo-notagent-behaviour | 81/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/git-interaction.mdc · 0 | Cursor rules | testlint-formatstylearch+4 | 88/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/git-worktree-task.mdc · 0 | Cursor rules | lint-formatgitagent-behaviour | 38/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/heart-centered-ai-philosophy.mdc · 0 | Cursor rules | no sections | 30/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/naming-stuff.mdc · 0 | Cursor rules | style | 43/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/prompt-engineering.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 57/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/trust-and-decision-making.mdc · 0 | Cursor rules | no sections | 48/100 | 3 days ago | |
| Light-Brands/planetary-party-html.cursor/rules/user-facing-language.mdc · 0 | Cursor rules | lint-formatstylearch | 66/100 | 3 days ago | |
| Light-Brands/planetary-party-htmlAGENTS.md · 0 | AGENTS.md | buildteststylearch+4 | 99/100 | 3 days ago |
Diff against .cursor/rules/ruff-linting.mdc Diff against .claude/agents/CLAUDE.md Diff against .claude/skills/CLAUDE.md Diff against .cursor/rules/git-commit-message.mdc Diff against .cursor/rules/autonomous-development-workflow.mdc Diff against .cursor/rules/code-review-standards.mdc Diff against .cursor/rules/external-apis.mdc Diff against .cursor/rules/fixing-github-actions-builds.mdc Diff against .cursor/rules/git-interaction.mdc Diff against .cursor/rules/git-worktree-task.mdc Diff against .cursor/rules/heart-centered-ai-philosophy.mdc Diff against .cursor/rules/naming-stuff.mdc Diff against .cursor/rules/prompt-engineering.mdc Diff against .cursor/rules/trust-and-decision-making.mdc Diff against .cursor/rules/user-facing-language.mdc Diff against AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| skillrecordings/egghead-next.cursor/rules/project-update-rules.mdc · 1.4k | Cursor rules | buildtestlint-formatstyle+7 | 96/100 | 3 days ago |
