python-backend-reviewer
БесплатноЗапускает вложенные скриптыНе проверенExpert Python backend code reviewer that identifies over-complexity, duplicates, bad optimizations, and violations of best practices. Use when asked to review…
Об этом скилле
Python Backend Code Reviewer
Expert analysis and refactoring of Python backend code to eliminate duplication, reduce complexity, and enforce best practices.
Overview
This skill helps identify and fix common issues in Python backend code, particularly problems introduced by AI code generation:
- Duplicate code across multiple files
- Recreated utilities instead of imports
- Over-engineered solutions
- High complexity functions and classes
- Anti-patterns and code smells
- Concurrency issues in async code (shared state mutation)
The skill provides automated analysis tools and comprehensive refactoring guidance.
⚠️ Architecture-Aware Prioritization
Static analysis finds issues, but architectural context determines priority.
Before prioritizing fixes, identify:
Critical paths: Which code runs on every request?
- WebSocket/HTTP handlers
- Main workflow orchestration
- Shared services/middleware
Secondary paths: Less critical code
- CLI tools
- Scripts
- Dev-only utilities
- One-time migrations
Concurrency model: How is state shared?
- Are handlers concurrent?
- Are instances shared across requests?
- Is there mutable singleton state?
Prioritization rule: Correctness in critical paths > Complexity in secondary paths
| Finding | Critical Path | Secondary Path |
|---|---|---|
| Shared state mutation | 🔴 Fix immediately | 🟡 Review |
| High complexity (>25) | 🟡 Refactor carefully | 🟢 Backlog |
| Duplicates | 🟡 Extract if >3 occurrences | 🟢 Nice to have |
| God class | 🟡 Migrate to façade | 🟢 Low priority |
Pragmatic Thresholds
For orchestration/workflow code, use realistic thresholds:
| Metric | Strict Threshold | Pragmatic Threshold | Notes |
|---|---|---|---|
| Cyclomatic complexity | 10 | 25 | Orchestrators naturally have decision points |
| Function length | 50 lines | 150 lines | Async flows can be longer |
| Nesting depth | 4 | 5 | Guard clauses help more than extracting |
| God class methods | 20 | N/A | OK if it's a façade that delegates |
Hard limits (always fix):
- No functions > 300 lines
- No nesting > 7 levels
- No shared-state mutation without synchronization guard
Quick Start
1. Run Automated Analysis
Start with automated tools to identify issues:
# Detect duplicate code blocks
uv run python scripts/detect_duplicates.py <path>
# Analyze imports and utility reimplementation
uv run python scripts/analyze_imports.py <path>
# Check code complexity
uv run python scripts/complexity_analyzer.py <path>
# Check for concurrency issues (shared state mutation)
uv run python scripts/concurrency_analyzer.py <path>
2. Review Analysis Results
Each tool outputs:
- Severity levels: Warnings (must fix) vs Info (should review)
- File locations: Exact line numbers for each issue
- Specific recommendations: What to change and why
3. Apply Fixes
Use the reference guides to refactor issues:
- See refactoring_patterns.md for step-by-step fixes
- See python_antipatterns.md for anti-pattern examples
- See best_practices.md for Python conventions
Main Workflows
Review a Python File
When a user asks to review a specific file:
Run all analysis tools on the file:
python scripts/detect_duplicates.py path/to/file.py python scripts/analyze_imports.py path/to/file.py python scripts/complexity_analyzer.py path/to/file.pyAnalyze results and categorize issues:
- Critical: Duplicates, high complexity, security issues
- Important: Utility reimplementation, deep nesting
- Minor: Style issues, minor inefficiencies
Provide specific fixes:
- Quote exact code locations with line numbers
- Show before/after examples
- Explain why the change improves the code
Offer to implement fixes if requested
Check Backend for Duplicates
When a user asks to check a project/module for duplicates:
Run duplicate detection on the entire directory:
python scripts/detect_duplicates.py src/Group duplicates by severity:
- High: 10+ lines duplicated, 3+ occurrences
- Medium: 5-10 lines, 2+ occurrences
- Low: Helper functions that could be extracted
Recommend consolidation strategy:
- Extract to shared utilities for cross-cutting concerns
- Create base classes for inherited behavi
Установить python-backend-reviewer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл python-backend-reviewer?
Expert Python backend code reviewer that identifies over-complexity, duplicates, bad optimizations, and violations of best practices. Use when asked to review Python code quality, check for duplicate code, analyze module complexity, optimize backend code, identify anti-patterns, or ensure adherence to best practices. Ideal for preventing AI-generated code from creating unnecessary files instead of imports, finding repeated validation logic, and catching over-engineered solutions.
Как установить скилл python-backend-reviewer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл python-backend-reviewer запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic