mcpField
P
python-expert-best-practices-code-review

python-expert-best-practices-code-review

github.com/wispbit-aiDevelopment8676 installsUpdated 37w ago
Repository

About python-expert-best-practices-code-review

A concise rule set for Python 3.14+ developers writing, reviewing, or refactoring production code. It groups practices by priority and links each rule to detailed explanations and examples.

Key features

  1. 01Prioritized rule categories
  2. 02Dictionary key error handling
  3. 03Mutable default prevention
  4. 04Exception and operator guidance
  5. 05Clarity and style practices
  6. 06Rule files with examples

Use cases

  1. 01Reviewing Python error handling
  2. 02Refactoring function defaults and operators
  3. 03Validating API boundary code
  4. 04Finding clarity issues in Python modules

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/wispbit-ai/skills --skill python-expert-best-practices-code-review

After installing, type/python-expert-best-practices-code-reviewin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

rules/
avoid-explanatory-comments.md
dict-required-keys.md
listcomp-no-side-effects.md
no-generic-except.md
no-inline-imports.md
no-mutable-defaults.md
operators-return-notimplemented.md
unnecessary-else-blocks.md

Details

From the project README

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

PriorityCategoryImpactPrefix
1Error HandlingCRITICALdict-, operators-
2Common BugsCRITICAL-HIGHno-mutable-, no-generic-
3Code ClarityHIGH-MEDIUMlistcomp-, no-inline-
4Code StyleLOWavoid-, 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

Comments

Markdown supported