/superclaude-plusplus:python-best-practicesfrom superclaude-plusplus
Validates Python code quality across type hints, testing, linting, security, and dependency management. Enforces uv for packaging and PEP 621 standards.
Ships in superclaude-plusplus. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Comprehensively analyze Python code quality, type safety, test coverage, and linting compliance.
.py filesCheck Items:
# ❌ Bad
def get_user(id):
return db.query(id)
# ✅ Good
def get_user(id: int) -> User | None:
return db.query(id)
Verification Tool: mypy --strict
Check Items:
# ❌ Bad
def f(x,y,z): return x+y+z
# ✅ Good
def calculate_sum(a: int, b: int, c: int) -> int:
"""Calculate the sum of three integers."""
return a + b + c
Verification Tool: ruff check, ruff format --check
Check Items:
tests/, *_test.py)# ✅ Good test structure
def test_get_user_returns_user(db_session: Session):
user = create_user(db_session, name="test")
result = get_user(user.id)
assert result.name == "test"
def test_get_user_returns_none_for_invalid_id():
result = get_user(999999)
assert result is None
Verification Tool: pytest --cov
Check Items:
# ❌ Bad
query = f"SELECT * FROM users WHERE id = {user_id}"
# ✅ Good
query = "SELECT * FROM users WHERE id = :id"
result = db.execute(query, {"id": user_id})
Verification Tool: bandit
Required Rule: Use uv (pip, poetry, pipenv prohibited)
Check Items:
pyproject.toml (PEP 621 standard) existsuv.lock exists and committed^, ~)# ✅ Good pyproject.toml (PEP 621 / uv)
[project]
name = "my-project"
version = "0.1.0"
requires-python = ">=3.11"
dependencies = []
[dependency-groups]
dev = [
"pytest>=8.0",
"mypy>=1.8",
"ruff>=0.1",
]
# ❌ Bad - Using requirements.txt or Poetry format
[tool.poetry]
dependencies = {python = "^3.11"}
# ❌ Bad - Using poetry.lock
Verification Tool: uv lock --check, uv sync --frozen
Docker Pattern:
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev
📋 Python Best Practices Check:
✅ Type Hints: 95% coverage (mypy strict pass)
✅ Code Quality: A (ruff 0 errors)
✅ Testing: 87% coverage (42 tests)
✅ Security: No issues (bandit clean)
✅ Dependencies: All pinned, no vulnerabilities
📊 Score: 0.94 (94%)
✅ Production Ready
📋 Python Best Practices Check:
✅ Type Hints: 78% coverage
⚠️ Code Quality: B (12 ruff warnings)
✅ Testing: 72% coverage
⚠️ Security: 2 low-severity issues
✅ Dependencies: OK
📊 Score: 0.76 (76%)
⚠️ Review Recommended
💡 Improvements Needed:
1. src/utils.py:45 - Missing type hints
2. src/api.py:120 - High complexity (refactor recommended)
3. src/db.py:67 - Caution with SQL string formatting
📋 Python Best Practices Check:
❌ Type Hints: 32% coverage
❌ Code Quality: D (47 errors)
❌ Testing: 15% coverage (3 tests)
⚠️ Security: 5 issues
❌ Dependencies: Unpinned versions
📊 Score: 0.42 (42%)
❌ Not Ready for Review
🚨 Critical Issues:
1. Insufficient type safety - mypy cannot run
2. Test coverage critically low
3. requirements.txt versions not pinned
# Run in uv environment
# Type checking
uv run mypy --strict src/
# Linting & formatting
uv run ruff check src/
uv run ruff format --check src/
# Testing
uv run pytest --cov=src --cov-report=term-missing
# Security
uv run bandit -r src/
# Dependencies
uv lock --check # Check lock file sync
uv sync --frozen # Verify install from lock
uv pip list --outdated # List updatable packages
# Virtual environment management
uv venv # Show/create environment info
uv sync # Install dependencies
uv lock --upgrade # Upgrade dependencies
# ✅ Good patterns
from fastapi import Depends, HTTPException, status
from pydantic import BaseModel
class UserCreate(BaseModel):
name: str
email: EmailStr
@app.post("/users", response_model=UserResponse)
async def create_user(
user: UserCreate,
db: Session = Depends(get_db)
) -> UserResponse:
...
Additional Checks:
# ✅ Good patterns
from django.db import models
from django.core.validators import MinLengthValidator
class User(models.Model):
name = models.CharField(max_length=100, validators=[MinLengthValidator(2)])
email = models.EmailField(unique=True)
class Meta:
indexes = [models.Index(fields=['email'])]
Additional Checks:
/confidence-check → Verify Python project architecture
│
▼
/python-best-practices → Analyze code quality
│
▼
/verify → Verify build/tests
│
▼
/learn → Save patterns
| Command | Description |
|---|---|
/python-best-practices | Full analysis |
/python-best-practices --quick | Type/lint only |
/python-best-practices --security | Security focus |
/python-best-practices --deps | Dependencies focus |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub excatt/superclaude-plusplus --plugin superclaude-plusplus44 skills in this plugin
/adaptAdapt designs to work across different screen sizes, devices, contexts, or platforms. Implements breakpoints, fluid layouts, and touch targets. Use when the user mentions responsive design, mobile layouts, breakpoints, viewport adaptation, or cross-device compatibility./animateReview a feature and enhance it with purposeful animations, micro-interactions, and motion effects that improve usability and delight. Use when the user mentions adding animation, transitions, micro-interactions, motion design, hover effects, or making the UI feel more alive./auditRun project-specific verification rules (business logic, architecture patterns, naming) that linters cannot catch; bootstraps rules if none exist. Not for build/lint/test (/verify)./bolderAmplify safe or boring designs to make them more visually interesting and stimulating. Increases impact while maintaining usability. Use when the user says the design looks bland, generic, too safe, lacks personality, or wants more visual impact and character./brainstormInteractive requirements discovery through Socratic dialogue and systematic exploration/build-fixExpert skill for resolving build errors with minimal change principle. Use for build failures, type errors, compile errors. Keywords: build, fix, error, compile, typescript, type, resolve.Other plugins' skills for the same job