Skip to main content

adding-ty-diagnostics

Use when a user says "add a ty rule", "add a ty diagnostic", "write this new ty diagnostic", "change a ty error message", "review ty diagnostics", or asks to add, update, or review ty checks, diagnostic messages, subdiagnostics, or concise output behavior.

来源信息

仓库
astral-sh/ruff
最近来源活动
2026年9月28日 15:12
检测到的 SKILL.md 语言
英语
星标
50,277
Forks
2,547

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
adding-ty-diagnostics
description
Use when a user says "add a ty rule", "add a ty diagnostic", "write this new ty diagnostic", "change a ty error message", "review ty diagnostics", or asks to add, update, or review ty checks, diagnostic messages, subdiagnostics, or concise output behavior.
# Adding Ty Diagnostics Use this skill when adding a ty rule or adding, changing, or reviewing a ty diagnostic. **Keep error messages concise.** Think about how the diagnostic will look on a narrow terminal screen. Put extra detail in subdiagnostics or secondary annotations when that helps, but make sure the primary diagnostic is understandable on its own. Always check that the diagnostic still makes sense when the user passes `--output-format=concise`. If the error code is entirely new or if you have changed the documentation for the error code, you will need to run `cargo dev generate-all` after making your changes, to update the generated schema for ty and the generated `.md` documentation files. Diagnostics should usually be tested using mdtests. If you are changing behaviour for an existing diagnostic, you should usually add your tests to a pre-existing `.md` file; otherwise, it may be appropriate to add a new `.md` file for your tests. A new ty diagnostic should normally have at least one snapshot test showing how ty renders it. For changes to existing diagnostics, snapshot tests are only usually necessary for diagnostics that use secondary annotations or subdiagnostics. If you want to add a snapshot, inline `# snapshot` comments are preferred over the legacy `<!-- snapshot-annotations -->` directive. When adding a ty rule that is disabled by default, normally enable it at `warn` in `.github/ty-ecosystem.toml` so the ecosystem-analyzer workflows report its effects. When using the `declare_lint!` macro, the `status` field should be set to `LintStatus::stable(<next version of ty>)`. You should determine what the next version of ty will be by inspecting https://pypi.org/pypi/ty/json, finding what the latest release of ty is, and incrementing the patch version by one. For example, if the latest release of ty is `0.5.3`, the status should be `LintStatus::stable("0.5.4")`.
在 GitHub 查看