python-review
БесплатноБез исполняемых скриптовНе проверенReviewing Python code - what to flag, and what ruff, mypy and the interpreter already flag for you USE WHEN: you are reviewing, critiquing or auditing…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Reviewing Python
A reviewer's leverage is what the toolchain cannot say. Every check below
describes a defect that survives the interpreter and ruff's default rule
set, which is narrower than most people assume: E4, E7, E9 and F.
That default is the crux. Most of the famous Python footguns live in rule
families that are opt-in — B (bugbear), ASYNC, DTZ, S (bandit). Read
pyproject.toml before deciding whether a finding is yours or the linter's.
The snippets are fragments cut down to the defect, not runnable programs.
Already covered - do not spend review on it
| Defect | Reported by |
|---|---|
| Unused import, unused local | ruff F401 / F841 (default) |
Bare except: |
ruff E722 (default) |
is compared against a literal |
ruff F632 (default) |
| Undefined or redefined name | ruff F821 / F811 (default) |
| f-string with no placeholders | ruff F541 (default) |
| Duplicate dict key | ruff F601-family (default) |
| Mutable default argument | ruff B006 - opt-in, not in the default set |
Naive datetime.now() |
ruff DTZ005 - opt-in |
Blocking call inside async def |
ruff ASYNC family - opt-in |
subprocess with shell=True |
ruff S602 / bandit - opt-in |
| Missing or wrong type annotation | mypy - only if the project runs it, and only where annotations exist |
If a project pins ruff to the default set, the four opt-in rows above are your job. Establish which it is by reading the config, once, rather than guessing per file.
The table above dates; the tools do not. Verify a default set with
mcp__documentation__fetch_docson technologyruff— topicsrules,settings(whereselectis decided). Those entries point at the indexes the tool authors maintain, so they follow the version the project actually pins rather than the one this skill was written against.
The checks that earn their place
A coroutine created and never awaited
async def handler():
save_to_db(record) # returns a coroutine; nothing runs
return "ok"
When you see it: a call to an async def without await, inside another
async def.
Ask: did this actually execute? Python emits a RuntimeWarning at garbage
collection - to stderr, at an unrelated moment, and routinely swallowed by a
logging config. mypy catches it only when the callee is annotated and the result
is unused in a checked context. In practice this ships.
A task created with no reference held
asyncio.create_task(background_work()) # nothing holds the result
When you see it: create_task whose return value is discarded.
Ask: what keeps this alive? The event loop holds only a weak reference, so
a task can be garbage-collected mid-flight and simply stop - intermittently,
under load, which is the worst way to find out. The fix is keeping the task in a
set until it completes, or TaskGroup on 3.11+.
A blocking call inside async code
async def fetch_all(urls):
for u in urls:
r = requests.get(u) # blocks the entire event loop
time.sleep(0.1) # so does this
When you see it: requests, time.sleep, a synchronous DB driver, or file
I/O inside async def.
Ask: what else is on this loop? One blocking call stalls every other
coroutine in the process, so the symptom appears in unrelated endpoints. The
ASYNC rules find these but are opt-in.
An exception caught and its cause discarded
try:
parse(payload)
except ValueError:
raise ApiError("bad request") # original traceback context is implicit
When you see it: a raise inside an except block with no from.
Ask: will the person debugging this see what actually failed? Python does
chain implicitly ("During handling of the above exception..."), but raise ... from err states the causal link deliberately, and from None is how you say
the original genuinely does not matter. Silence leaves the reader unsure which
was meant.
except Exception with nothing distinguishing
try:
do_work()
except Exception:
logger.warning("failed") # a typo in do_work reads the same as a timeout
When you see it: a broad except whose handler does not re-raise and does
not branch on the exception.
Ask: which failures is this meant to absorb? E722 only covers bare
except: - except Exception passes the linter while catching AttributeError
from a refactor exactly as it catches the network error it was written for.
A mutable default argument
def add(item, target=[]): # one list, shared by every call
target.append(item)
return target
When you see it: [], {}, set() or a call expression as a default.
Ask: is the default meant to be per-call? The default is evaluated once at
function definition. B006 reports it but is not in ruff's default set, so
in most repos this is a review f
Установить python-review в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobFAQ
Что делает скилл python-review?
Reviewing Python code - what to flag, and what ruff, mypy and the interpreter already flag for you USE WHEN: you are reviewing, critiquing or auditing existing Python code - a "code review", a "review" of a .py file, a diff, a PR or a pull request; deciding what to comment on in Python; avoiding false positives on Python code DO NOT USE FOR: writing, explaining or learning Python - use `languages/python`; anything ruff's default rules or a configured mypy already reports (this skill lists those so you can stay silent about them); Django/FastAPI specifics - use the framework skills; test review - use the pytest skills
Как установить скилл python-review?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл python-review запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic