Review Python code for language and runtime conventions: type hints, exceptions, async/await, context managers, dependencies, and testability. Language-only atomic skill; output is a findings list.
Review code in Python for language and runtime conventions only. Do not define scope (diff vs codebase) or perform security/architecture analysis; those are handled by scope and cognitive skills. Emit a findings list in the standard format for aggregation. Focus on type hints, exception handling, async/await patterns, context managers, dependency management, and testability.
Core Objective
Primary goal: Produce a Python language/runtime findings list covering type hints, exception handling, async/await patterns, context managers, dependency management, naming conventions, and testability for the given code scope.
Success Criteria (ALL must be met):
✅ Python-only scope: Only Python language and runtime conventions are reviewed; no scope selection, security, or architecture analysis performed
✅ All eight Python dimensions covered: Type hints, exception handling, async/await, context managers, dependency management, mutable defaults, naming conventions (PEP8), and testability are assessed where relevant
✅ Findings format compliant: Each finding includes Location, Category (language-python), Severity, Title, Description, and optional Suggestion
✅ File:line references: All findings reference specific file locations with line numbers
✅ Non-Python code excluded: Non-Python files are not analyzed for Python-specific rules unless explicitly in scope
Acceptance Test: Does the output contain a Python-focused findings list with file:line references covering all relevant language/runtime dimensions without performing security, architecture, or scope analysis?
Scope Boundaries
This skill handles:
Type hints (typing module, Optional, Union, generics)
Exception handling (specific exceptions, raise ... from, no bare except:, try/finally)
async/await patterns (async functions, blocking calls in async context, asyncio.gather)
Testability (global state avoidance, DI, mock-friendly design)
This skill does NOT handle:
Scope selection — scope is provided by the caller
Security analysis — use review-security
Architecture analysis — use review-architecture
SQL-specific analysis — use review-sql
Full orchestrated review — use orchestrate-code-review
Handoff point: When all Python findings are emitted, hand off to orchestrate-code-review for aggregation. For security issues (injection, auth), note them and suggest review-security.
Use Cases
Orchestrated review: Used as the language step when orchestrate-code-review runs scope -> language -> framework -> library -> cognitive for Python projects.
Python-only review: When the user wants only language/runtime conventions checked (e.g. after adding a new Python file).
Pre-PR Python checklist: Ensure type hints, exception handling, and async patterns are correct.
When to use: When the code under review is Python and the task includes language/runtime quality. Scope (diff vs paths) is determined by the caller or user.
Behavior
Scope of this skill
Analyze: Python language and runtime conventions in the given code scope (files or diff provided by the caller). Do not decide scope; accept the code range as input.
Do not: Perform scope selection (diff vs codebase), security review, or architecture review; do not review non-Python files for Python-specific rules unless explicitly in scope.
Review checklist (Python dimension only)
Type hints: Use typing module for complex types, avoid Any where possible, use Optional[T] over T | None for Python <3.10, proper use of Union, List, Dict, Callable, and generic type hints.
Exception handling: Catch specific exceptions, avoid bare except:, use raise ... from for exception chaining, avoid swallowing exceptions without logging, proper use of try/finally.
Async/await: Proper use of async def and await, avoid blocking calls in async functions, proper exception handling in async context, use of asyncio.gather, asyncio.create_task for concurrency.
Context managers: Use with statement for resource management, implement __enter__/__exit__ or use @contextmanager, avoid manual open/close.
Dependency management: Pin dependencies in requirements.txt or pyproject.toml, avoid import *, use virtual environments, proper use of sys.path manipulation.
Mutable defaults: Avoid mutable default arguments (e.g. def foo(a=[]):), use None and initialize inside function.
Naming conventions: Follow PEP8 (snake_case for functions/variables, PascalCase for classes, SCREAMING_SNAKE_CASE for constants).
Testability: Avoid global state, use dependency injection, mock external services, avoid tight coupling.
Tone and references
Professional and technical: Reference specific locations (file:line). Emit findings with Location, Category, Severity, Title, Description, Suggestion.
Input & Output
Input
Code scope: Files or directories (or diff) already selected by the user or by the scope skill. This skill does not decide scope; it reviews the provided Python code for language conventions only.
Output
Emit zero or more findings in the format defined in specs/findings-list.md, with Categorylanguage-python.
Category for this skill is language-python.
Restrictions
Hard Boundaries
Do not perform security, architecture, or scope selection. Stay within Python language and runtime conventions.
Do not give conclusions without specific locations or actionable suggestions.
Do not review non-Python code for Python-specific rules unless the user explicitly includes it (e.g. embedded code snippets).
Skill Boundaries
Do NOT do these (other skills handle them):
Do NOT select or define the code scope — scope is determined by the caller or orchestrate-code-review
Do NOT perform security analysis — use review-security
Do NOT perform architecture analysis — use review-architecture
Do NOT perform comprehensive SQL analysis — use review-sql
When to stop and hand off:
When all Python findings are emitted, hand off to orchestrate-code-review for aggregation
When the user needs a full review (scope + language + cognitive), redirect to orchestrate-code-review
When security issues are found (e.g. SQL injection, command injection), note them and suggest review-security
Self-Check
Core Success Criteria
Python-only scope: Only Python language and runtime conventions are reviewed; no scope selection, security, or architecture analysis performed
All eight Python dimensions covered: Type hints, exception handling, async/await, context managers, dependency management, mutable defaults, naming conventions (PEP8), and testability are assessed where relevant
Findings format compliant: Each finding includes Location, Category (language-python), Severity, Title, Description, and optional Suggestion
File:line references: All findings reference specific file locations with line numbers
Non-Python code excluded: Non-Python files are not analyzed for Python-specific rules unless explicitly in scope
Process Quality Checks
Was only the Python language/runtime dimension reviewed (no scope/security/architecture)?
Are type hints, exception handling, async patterns, context managers, and testability covered where relevant?
Is each finding emitted with Location, Category=language-python, Severity, Title, Description, and optional Suggestion?
Are issues referenced with file:line?
Acceptance Test
Does the output contain a Python-focused findings list with file:line references covering all relevant language/runtime dimensions without performing security, architecture, or scope analysis?
Examples
Example 1: Mutable default argument
Input: def foo(items=[]):
Expected: Emit a finding for mutable default argument; suggest using None and initializing inside. Category = language-python.
Example 2: Bare except
Input: except: pass
Expected: Emit a finding to catch specific exceptions; reference the bare except clause. Category = language-python.
Example 3: Async blocking call
Input: async def fetch(): requests.get(url) inside an async function.
Expected: Emit a finding to use aiohttp or httpx; reference the blocking call. Category = language-python.
Edge case: Mixed Python and SQL
Input: Python file with embedded SQL strings for database queries.
Expected: Review only Python conventions (type hints, exception handling). Do not emit SQL-injection findings; that is for review-security or review-sql.
1---2name: review-python3description: Review Python code for language and runtime conventions: type hints, exceptions, async/await, context managers, dependencies, and testability. Language-only atomic skill; output is a findings list.4license: MIT5---67# Skill: Review Python89## Purpose1011Review code in **Python** for **language and runtime conventions** only. Do not define scope (diff vs codebase) or perform security/architecture analysis; those are handled by scope and cognitive skills. Emit a **findings list** in the standard format for aggregation. Focus on type hints, exception handling, async/await patterns, context managers, dependency management, and testability.1213---1415## Core Objective1617**Primary goal**: Produce a Python language/runtime findings list covering type hints, exception handling, async/await patterns, context managers, dependency management, naming conventions, and testability for the given code scope.1819**Success Criteria** (ALL must be met):20211. ✅ **Python-only scope**: Only Python language and runtime conventions are reviewed; no scope selection, security, or architecture analysis performed222. ✅ **All eight Python dimensions covered**: Type hints, exception handling, async/await, context managers, dependency management, mutable defaults, naming conventions (PEP8), and testability are assessed where relevant233. ✅ **Findings format compliant**: Each finding includes Location, Category (`language-python`), Severity, Title, Description, and optional Suggestion244. ✅ **File:line references**: All findings reference specific file locations with line numbers255. ✅ **Non-Python code excluded**: Non-Python files are not analyzed for Python-specific rules unless explicitly in scope2627**Acceptance Test**: Does the output contain a Python-focused findings list with file:line references covering all relevant language/runtime dimensions without performing security, architecture, or scope analysis?2829---3031## Scope Boundaries3233**This skill handles**:3435- Type hints (`typing` module, `Optional`, `Union`, generics)36- Exception handling (specific exceptions, `raise ... from`, no bare `except:`, `try/finally`)37- async/await patterns (async functions, blocking calls in async context, `asyncio.gather`)38- Context managers (`with` statement, `__enter__`/`__exit__`, `@contextmanager`)39- Dependency management (pinned deps, `import *` avoidance, virtual environments)40- Mutable default arguments (avoiding `def foo(a=[]):`)41- PEP8 naming conventions (snake_case, PascalCase, SCREAMING_SNAKE_CASE)42- Testability (global state avoidance, DI, mock-friendly design)4344**This skill does NOT handle**:4546- Scope selection — scope is provided by the caller47- Security analysis — use `review-security`48- Architecture analysis — use `review-architecture`49- SQL-specific analysis — use `review-sql`50- Full orchestrated review — use `orchestrate-code-review`5152**Handoff point**: When all Python findings are emitted, hand off to `orchestrate-code-review` for aggregation. For security issues (injection, auth), note them and suggest `review-security`.5354---5556## Use Cases5758- **Orchestrated review**: Used as the language step when [orchestrate-code-review](../orchestrate-code-review/SKILL.md) runs scope -> language -> framework -> library -> cognitive for Python projects.59- **Python-only review**: When the user wants only language/runtime conventions checked (e.g. after adding a new Python file).60- **Pre-PR Python checklist**: Ensure type hints, exception handling, and async patterns are correct.6162**When to use**: When the code under review is Python and the task includes language/runtime quality. Scope (diff vs paths) is determined by the caller or user.6364---6566## Behavior6768### Scope of this skill6970- **Analyze**: Python language and runtime conventions in the **given code scope** (files or diff provided by the caller). Do not decide scope; accept the code range as input.71- **Do not**: Perform scope selection (diff vs codebase), security review, or architecture review; do not review non-Python files for Python-specific rules unless explicitly in scope.7273### Review checklist (Python dimension only)74751. **Type hints**: Use `typing` module for complex types, avoid `Any` where possible, use `Optional[T]` over `T | None` for Python <3.10, proper use of `Union`, `List`, `Dict`, `Callable`, and generic type hints.762. **Exception handling**: Catch specific exceptions, avoid bare `except:`, use `raise ... from` for exception chaining, avoid swallowing exceptions without logging, proper use of `try/finally`.773. **Async/await**: Proper use of `async def` and `await`, avoid blocking calls in async functions, proper exception handling in async context, use of `asyncio.gather`, `asyncio.create_task` for concurrency.784. **Context managers**: Use `with` statement for resource management, implement `__enter__`/`__exit__` or use `@contextmanager`, avoid manual open/close.795. **Dependency management**: Pin dependencies in `requirements.txt` or `pyproject.toml`, avoid `import *`, use virtual environments, proper use of `sys.path` manipulation.806. **Mutable defaults**: Avoid mutable default arguments (e.g. `def foo(a=[]):`), use `None` and initialize inside function.817. **Naming conventions**: Follow PEP8 (snake_case for functions/variables, PascalCase for classes, SCREAMING_SNAKE_CASE for constants).828. **Testability**: Avoid global state, use dependency injection, mock external services, avoid tight coupling.8384### Tone and references8586- **Professional and technical**: Reference specific locations (file:line). Emit findings with Location, Category, Severity, Title, Description, Suggestion.8788---8990## Input & Output9192### Input9394- **Code scope**: Files or directories (or diff) already selected by the user or by the scope skill. This skill does not decide scope; it reviews the provided Python code for language conventions only.9596### Output9798- Emit zero or more **findings** in the format defined in [specs/findings-list.md](../../specs/findings-list.md), with **Category** `language-python`.99- Category for this skill is **language-python**.100101---102103## Restrictions104105### Hard Boundaries106107- **Do not** perform security, architecture, or scope selection. Stay within Python language and runtime conventions.108- **Do not** give conclusions without specific locations or actionable suggestions.109- **Do not** review non-Python code for Python-specific rules unless the user explicitly includes it (e.g. embedded code snippets).110111### Skill Boundaries112113**Do NOT do these** (other skills handle them):114115- Do NOT select or define the code scope — scope is determined by the caller or `orchestrate-code-review`116- Do NOT perform security analysis — use `review-security`117- Do NOT perform architecture analysis — use `review-architecture`118- Do NOT perform comprehensive SQL analysis — use `review-sql`119120**When to stop and hand off**:121122- When all Python findings are emitted, hand off to `orchestrate-code-review` for aggregation123- When the user needs a full review (scope + language + cognitive), redirect to `orchestrate-code-review`124- When security issues are found (e.g. SQL injection, command injection), note them and suggest `review-security`125126---127128## Self-Check129130### Core Success Criteria131132- [ ] **Python-only scope**: Only Python language and runtime conventions are reviewed; no scope selection, security, or architecture analysis performed133- [ ] **All eight Python dimensions covered**: Type hints, exception handling, async/await, context managers, dependency management, mutable defaults, naming conventions (PEP8), and testability are assessed where relevant134- [ ] **Findings format compliant**: Each finding includes Location, Category (`language-python`), Severity, Title, Description, and optional Suggestion135- [ ] **File:line references**: All findings reference specific file locations with line numbers136- [ ] **Non-Python code excluded**: Non-Python files are not analyzed for Python-specific rules unless explicitly in scope137138### Process Quality Checks139140- [ ] Was only the Python language/runtime dimension reviewed (no scope/security/architecture)?141- [ ] Are type hints, exception handling, async patterns, context managers, and testability covered where relevant?142- [ ] Is each finding emitted with Location, Category=language-python, Severity, Title, Description, and optional Suggestion?143- [ ] Are issues referenced with file:line?144145### Acceptance Test146147Does the output contain a Python-focused findings list with file:line references covering all relevant language/runtime dimensions without performing security, architecture, or scope analysis?148149---150151## Examples152153### Example 1: Mutable default argument154155- **Input**: `def foo(items=[]):`156- **Expected**: Emit a finding for mutable default argument; suggest using `None` and initializing inside. Category = language-python.157158### Example 2: Bare except159160- **Input**: `except: pass`161- **Expected**: Emit a finding to catch specific exceptions; reference the bare except clause. Category = language-python.162163### Example 3: Async blocking call164165- **Input**: `async def fetch(): requests.get(url)` inside an async function.166- **Expected**: Emit a finding to use `aiohttp` or `httpx`; reference the blocking call. Category = language-python.167168### Edge case: Mixed Python and SQL169170- **Input**: Python file with embedded SQL strings for database queries.171- **Expected**: Review only Python conventions (type hints, exception handling). Do not emit SQL-injection findings; that is for review-security or review-sql.
Run npx skillmds@latest add nesnilnehc/review-python in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Review Python code for language and runtime conventions: type hints, exceptions, async/await, context managers, dependencies, and testability. Language-only atomic skill; output is a findings list. It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free. This skill is licensed under MIT.
nesnilnehc (@nesnilnehc) published this skill. Their other Agent Skills are listed on their SkillMD profile.