python-expert-best-practices-code-review
Python best practices for writing production-grade code. This skill should be used when writing, reviewing, or refactoring Python code. Triggers on tasks involving Python development, error handling patterns, dictionary operations, and code quality improvements.
Works with
--- name: python-expert-best-practices-code-review description: Python best practices for writing production-grade code. This skill should be used when writing, reviewing, or refactoring Python code. Triggers on tasks involving Python development, error handling patterns, dictionary operations, and code quality improvements. license: MIT --- # Python 3.14+ Expert Best Practices Simple, pragmatic, opinionated. Only what matters for writing production-grade python code. ## When to Apply Reference these guidelines when: - Writing Python functions, classes, or modules - Reviewing Python code for error handling issues - Refactoring existing Python codebases - Implementing data validation and API boundaries - Optimizing error detection and debugging patterns ## Rule Categories by Priority | Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Error Handling | CRITICAL | `dict-`, `operators-` | | 2 | Common Bugs | CRITICAL-HIGH | `no-mutable-`, `no-generic-` | | 3 | Code Clarity | HIGH-MEDIUM | `listcomp-`, `no-inline-` | | 4 | Code Style | LOW | `avoid-`, `unnecessary-` | ## Quick Reference - `dict-required-keys` - Use `d[key]` for required dictionary keys to fail fast with KeyError - `no-mutable-defaults` - No mutable defaults in function/method parameters - `operators-return-notimplemented` - Return NotImplemented for unsupported operand types and design + vs += intentionally - `no-generic-except` - Avoid generic except clauses to prevent hiding unexpected errors - `listcomp-no-side-effects` - List comprehensions must produce a value you use (no side-effect listcomps) - `no-inline-imports` - Place all import statements at the top of the file - `avoid-explanatory-comments` - Avoid unnecessary comments for self-documenting code - `unnecessary-else-blocks` - Avoid unnecessary else blocks after return/break/continue statements ## How to Use Read individual rule files for detailed explanations and code examples: ``` rules/dict-required-keys.md rules/no-mutable-defaults.md rules/operators-return-notimplemented.md rules/no-generic-except.md rules/listcomp-no-side-effects.md rules/no-inline-imports.md rules/avoid-explanatory-comments.md rules/unnecessary-else-blocks.md ``` Each rule file contains: - Brief explanation of why it matters - When to use and when not to use the pattern - Implementation requirements - Incorrect code example with explanation - Correct code example with explanation - Additional context and references
More Code Review skills
pr-to-video
heygen-com/hyperframes
Turn a GitHub pull request (a PR URL, owner/repo#N, or 'this PR' in a checked-out repo) into a code-change explainer video — changelog, feature reveal, fix, or refactor walkthrough built from the diff, commits, and files: the input is a code change, not a website. Not a product promo (/product-launch-video) or a no-PR topic explainer (/faceless-explainer). Unclear → /hyperframes.
receiving-code-review
obra/superpowers
Use when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation
public-relations
coreyhaines31/marketingskills
When the user wants help with public relations, earned media, press coverage, journalist outreach, or media strategy (not pull requests). Also use when the user mentions 'PR,' 'public relations,' 'press,' 'press release,' 'press coverage,' 'media outreach,' 'pitch a journalist,' 'get featured,' 'media list,' 'media kit,' 'press kit,' 'newsjacking,' 'news hijack,' 'HARO,' 'Qwoted,' 'Featured,' 'Help A Reporter,' 'reporter request,' 'tech press,' 'TechCrunch,' 'earned media,' 'thought leadership placement,' 'op-ed,' 'guest article,' 'press contacts,' 'podcast prep,' 'going on a podcast,' 'podcast guest,' 'prep me for this podcast,' or 'how do I get press.' Use this for earned media work — finding journalists, pitching stories, newsjacking, prepping podcast appearances, and responding to press requests. For startup/SaaS/AI directory submissions, see directory-submissions. For product launches, see launch. For social-media engagement, see social. For cold-email outreach to prospects, see cold-email.

