跳到正文
cccskills
免费在 GitHub 公开中文介绍

compare-python-typecheckers

使用多个 Python 类型检查器比较代码片段或文件的类型推断和报错判断,并汇总各工具的结论、耗时与诊断信息,可保存为 Markdown 报告。

原文查看原文说明

Compare Python type inference with ty, pyrefly, and basedpyright.

JetBrains/intellij-community星标 20,684(GitHub 20,684 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • 比较不同检查器的类型推断
  • 确认代码是否会被判为类型错误
  • 查看多个工具的诊断差异
  • 将结果保存为 Markdown 报告

中文介绍

功能

本技能会用多个 Python 类型检查器运行代码片段或文件,并生成对比报告。可用工具包括 ty、pyrefly、basedpyright、mypy 和 zuban。报告汇总各工具的退出代码、判断结果、运行时间及诊断输出。你可以运行全部工具,也可以选择其中一部分,还可以把结果保存到 Markdown 文件。

适用场景

当你想了解不同检查器如何推断 Python 类型,或想确认某段写法是否会被判为类型错误时,可以使用本技能。各检查器的诊断格式不同,因此除了汇总表,你也能逐项查看它们的原始输出。

使用示例

  • “请用多个类型检查器比较这段 Python 代码。”
  • “请用 ty 和 mypy 检查这个文件,并将结果保存为 Markdown 报告。”

注意事项

脚本通过 uv 和 uvx 运行。首次运行时会通过网络获取类型检查器。由于使用各工具的最新版本,检查结果可能随时间变化。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

文档检查

AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。

安全性发送数据、删除文件、执行命令等是否有说明
B部分不足脚本会运行且首次联网获取工具,但未说明执行前确认步骤。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足需要 uv、uvx 和首次联网,但未提供安装步骤。

不计入评分。 由 AI(OpenAI Codex)于 2026年10月28日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(2)

  • SKILL.md2.5 KB
  • scripts/compare_typecheckers.py6.1 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

<!-- Generated by community/.ai/render-guides.mjs; edit community/.agents/skills/compare-python-typecheckers/SKILL.md -->

Compare Python type checkers

When reasoning about how PyCharm should infer a type or whether something ought to be a type error, cross-checking against the real third-party checkers is the fastest way to gain insight — and to see where they disagree. This skill runs them all on a scratch file or snippet and collates the output into a single report.

Run it

${CLAUDE_SKILL_DIR}/scripts/compare_typecheckers.py invokes each checker through uvx (fetched on demand — no install; the network is used on first run) and prints a Markdown report: a summary table (exit code / verdict / timing per tool) followed by each tool's raw output.

# Inline snippet:
uv run ${CLAUDE_SKILL_DIR}/scripts/compare_typecheckers.py -c 'def f(x: int) -> int:
    return x

f("a")'

# An existing file:
uv run ${CLAUDE_SKILL_DIR}/scripts/compare_typecheckers.py path/to/test.py

# A subset, written to a file:
uv run ${CLAUDE_SKILL_DIR}/scripts/compare_typecheckers.py test.py --tools ty,mypy -o /tmp/report.md

Flags: -c/--code (inline snippet), -t/--tools ty,mypy,… (subset), -o/--output (write to file), --timeout (per-checker seconds, default 180). The script exits 0 whenever it produced a report — findings live in the report, not the exit code.

Reading the result

  • The summary table shows each tool's exit code (0 = nothing flagged, non-zero = the checker reported an issue or failed to run), a verdict, and time.
  • Output formats differ per tool, so read each section, not just the table:
    • ty (Astral) and pyrefly (Meta) each have their own diagnostic style.
    • basedpyright is pyright-based and also emits extra diagnostics such as reportUnusedCallResult.
    • mypy and zuban share the same message format (zuban is mypy-compatible).
  • The checkers track their latest releases through uvx, so behaviour can shift over time — record the date when capturing results in a YouTrack issue or test.

Manual one-offs

The exact per-tool invocations, if you want to run just one by hand (note basedpyright takes the file positionally — no check subcommand):

ToolCommand
tyuvx ty check test.py
pyreflyuvx pyrefly check test.py
basedpyrightuvx basedpyright test.py
mypyuvx mypy test.py
zubanuvx zuban check test.py

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

actions

免费有简介

实现或修改 IntelliJ `AnAction`,并在 `plugin.xml` 中注册。将显示名称和说明写入消息资源文件,按需设置图标,并通过事件协程作用域启动挂起任务,避免同步处理阻塞 IDE。

  • 为 IDE 菜单添加操作
  • 修改操作注册或图标
  • 整理操作名称和说明
JetBrains/intellij-community2.1万2026年10月29日 更新

bazel-test-migration

免费有简介

将 IntelliJ JPS 测试模块迁移到 Bazel,并排查仅在 Bazel 中出现的失败。根据症状检查依赖、插件、测试数据和 runfiles,重新生成并验证目标。

  • 将 JPS 测试模块迁移到 Bazel
  • 排查仅在 Bazel 中失败的测试
  • 检查测试依赖和数据配置
JetBrains/intellij-community2.1万2026年10月29日 更新

code-style

免费有简介

按 IntelliJ 项目规范编写或审查 Kotlin 和 Java 代码,涵盖语言选择、格式、密封类型、线程注解及控制流异常处理。

  • 按 IntelliJ 规范编写 Kotlin
  • 审查 Java 代码
  • 检查异常处理和密封类型分支
JetBrains/intellij-community2.1万2026年10月29日 更新

commits

免费有简介

本指南帮助您按 IntelliJ 项目规则拆分更改并撰写提交信息:有工单时使用编号和变更说明,无工单时使用标签与子系统名,并在需要时说明原因和决定。

  • 按项目格式编写带工单号的提交信息
  • 整理测试或文档提交并选择合适标签
  • 按规则修改已有提交信息
JetBrains/intellij-community2.1万2026年10月29日 更新

整理 Compose Desktop 界面中的状态和副作用,让可组合函数负责绘制,由展示器或协调器处理应用决策。了解状态归属、Effect、可复用组件接口、延迟列表键、动画和性能,适用于单项界面修改。

  • 分离界面绘制与展示器决策
  • 整理界面状态的归属
  • 检查 Effect 键和协程用法
JetBrains/intellij-community2.1万2026年10月29日 更新

compose-ui-audit

免费有简介

审查 Compose Desktop 界面代码的架构和运行时问题,检查状态管理、副作用、协程、延迟列表、动画与重组,并按优先级列出发现。

  • 审查 Compose 界面的状态管理
  • 检查副作用和协程用法
  • 调查延迟列表或重组性能
JetBrains/intellij-community2.1万2026年10月29日 更新

查看 JetBrains 的全部技能

报告此技能的问题