skills/review-python/SKILL.md
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.
npx skillsauth add nesnilnehc/ai-cortex review-pythonInstall 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.
仅查看 Python 中的代码的 语言和运行时约定。不要定义范围(差异与代码库)或执行安全/架构分析;这些是通过范围和cognitive技能来处理的。以标准格式发出结果列表以进行聚合。重点关注类型提示、异常处理、异步/等待模式、上下文管理器、依赖管理和可测试性。
首要目标:生成 Python 语言/运行时结果列表,涵盖类型提示、异常处理、异步/等待模式、上下文管理器、依赖项管理、命名约定和给定代码范围的可测试性。
成功标准(必须满足所有要求):
language-python)、严重性、标题、描述和可选建议验收测试:输出是否包含以 Python 为中心的结果列表,其中包含 file:line 引用,涵盖所有相关语言/运行时维度,而无需执行安全性、架构或范围分析?
本技能负责:
typing 模块、Optional、Union、泛型)asyncio.gather)with语句、__enter__/__exit__、@contextmanager)def foo(a=[]):)本技能不负责:
review-sql转交点:当所有 Python 发现结果发布后,将其交给 orchestrate-code-review 进行聚合。对于安全问题(注入、身份验证),请记下它们并建议“审查安全性”。
何时使用:当正在审查的代码是Python并且任务包括语言/运行时质量时。范围(差异与路径)由调用者或用户确定。
typing 模块,尽可能避免使用 Any,使用 Optional[T] 而不是 T |对于 Python <3.10,无,正确使用 Union、List、Dict、Callable 和泛型类型提示。 except:,使用raise ... from进行异常链接,避免在没有日志记录的情况下吞噬异常,正确使用try/finally。async def和await,避免异步函数中的阻塞调用,异步上下文中正确的异常处理,使用asyncio.gather,asyncio.create_task实现并发。with语句进行资源管理,实现__enter__/__exit__或使用@contextmanager,避免手动打开/关闭。需求.txt或pyproject.toml中,避免import *,使用虚拟环境,正确使用sys.path操作。def foo(a=[]):),使用 None 并在函数内部初始化。不要做这些(其他技能可以处理它们):
review-sql何时停止并交接:
review-securitylanguage-python)、严重性、标题、描述和可选建议输出是否包含以 Python 为中心的结果列表,其中包含涵盖所有相关语言/运行时维度的 file:line 引用,而无需执行安全性、体系结构或范围分析?
def foo(items=[]):除了:通过async def fetch(): requests.get(url)。development
Generate an LLM agent test suite (golden cases, mock-LLM unit tests, evaluator harness) from an agent implementation and its agent-test contract. Use when an agent has no tests, or a contract exists but the test code is missing.
development
After code changes, auto-detect the project's build system and local deployment method for a given directory, then build the project and restart its locally-deployed environment (Docker Compose / systemd / process manager). Never assumes — asks only when detection is ambiguous. Caches detected commands per project in .cortex/redeploy-local.yaml; re-invocations on the same project skip re-scanning until signal files change, the cache expires (30 days), or the skill version bumps.
tools
Publish a NATS message conforming to a cross-team contract, using NATS MCP tools. Authors the contract on first use if missing. Reads project-level cache (.cortex/nats.yaml) to avoid re-prompting basics across sessions.
tools
Drain pending NATS messages from a producer contract via NATS MCP tools (default batch / drain-style). Applies Tolerant Reader semantics and per-message ack/nak/term, returning aggregated stats. Reads project-level cache (.cortex/nats.yaml) to avoid re-prompting.