toolchains/python/quality/code-quality/SKILL.md
Python code-quality anti-patterns and review checks: exception-hierarchy correctness, singleton identity comparison, narrow exception handling, wildcard-import avoidance, magic-number naming, and dead-local removal. Use when reviewing or self-reviewing Python code for correctness and readability defects that linters and reviewers should catch.
npx skillsauth add bobmatnyc/claude-mpm-skills code-qualityInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
High-value Python code-quality anti-patterns to check during review or self-review.
This skill is review-focused: it covers correctness and readability defects that a
reviewer (or a linter) should flag, separate from testing mechanics (pytest) and
whole-codebase health scoring (code-quality-scoring).
Source note: These anti-patterns are derived from CAST Highlight's Python code quality indicators (https://doc.casthighlight.com/), which reference PEP 8 and the Python data model as primary sources. Where a rule mirrors PEP 8, the PEP is the authoritative source. All examples are original.
Use it when the task is "is this Python code clean and correct?" — for example:
ruff/pylint/mypy rules so CI catches these automatically.Do not use it for testing mechanics (use the pytest skill) or for scoring a whole
codebase's health and technical debt (use the code-quality-scoring skill).
Six highest-value Python anti-patterns. Each has a non-compliant/compliant example and a "how to test" note in the reference doc:
Exception — a class meant to be raised that
inherits from object fails at runtime and breaks every except clause.is, not == — use is/is not for None/True/False
(PEP 8); use is only for singletons, never for value comparison.except — catch the narrowest type you can handle; a
generic except Exception only as a last-position fallback that logs or re-raises.from x import *) — they hide dependencies, risk silent
name collisions, and defeat static analysis.ruff (F403/F405 wildcard,
F841 unused locals, E711/E712 singleton comparison), pylint, and mypy. Put the
lint step in CI so review effort focuses on judgment, not mechanics.except Exception for a logging/re-raising last resort.object or directly from BaseException.== None, == True, or is "some literal".except: or except BaseException: that swallows control-flow signals.from module import * outside a curated __init__.py with explicit __all__.toolchains/python/testing/pytest): testing mechanics — fixtures,
parametrization, mocking. Several anti-patterns here (broad except, malformed
exception classes) directly cause flaky tests.universal/process/code-review-standards): the
project-wide, severity-tagged review checklist that incorporates equivalents of these.universal/quality/code-quality-scoring): whole-codebase
health and technical-debt scoring, rather than individual findings.tools
Xquik X data automation API - Use REST or MCP for tweet search, user lookup, follower exports, media downloads, monitors, webhooks, giveaway draws, and confirmation-gated X actions.
tools
LinkedIn automation via the Linked API CLI - fetch profiles, search people and companies, send messages, manage connections, create posts, react, comment, and run Sales Navigator and custom workflows. Use when the user wants to interact with LinkedIn.
tools
MCP (Model Context Protocol) server build and evaluation guide, including local conventions for tool surfaces, config, and testing
tools
MCP (Model Context Protocol) - Build AI-native servers with tools, resources, and prompts. TypeScript/Python SDKs for Claude Desktop integration.