360 Secure SkillHub
360 安全技能中心

Pyright LSP

该 Skill 通过 Pyright 语言服务器为 Python 文件提供静态类型检查、自动补全、跳转定义、查找引用和实时错误诊断,支持 .py 与 .pyi;包含安装检查、单文件与整项目检查命令、pyrightconfig.json 配置说明,以及编辑后运行检查的集成流程。

bowen31337
bowen31337
热度 79.33
最近更新 2026-02-26 07:35:36
分类:开发依赖:代码执行 / 读写文件应用场景:代码审查 / 调试排错

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add pyright-lsp
Metadata
name
pyright-lsp
description
Python language server (Pyright) providing static type checking, code intelligence, and LSP diagnostics for .py and .pyi files. Use when working with Python code that needs type checking, autocomplete suggestions, error detection, or code navigation.

Pyright LSP

Python language server integration providing static type checking and code intelligence through Microsoft's Pyright.

Capabilities

  • Type checking: Static analysis of Python types
  • Code intelligence: Autocomplete, go-to-definition, find references
  • Error detection: Real-time diagnostics for type errors and issues
  • Supported extensions: .py, .pyi

Installation Check

Before using, verify Pyright is installed:

which pyright || npm install -g pyright

Alternative installation methods:

pip install pyright
# or
pipx install pyright  # recommended for CLI tools

Usage

Run type checking on Python files:

pyright path/to/file.py

Run on entire project:

cd project-root && pyright

Configuration

Create pyrightconfig.json in project root for custom settings:

{
  "include": ["src"],
  "exclude": ["**/node_modules", "**/__pycache__"],
  "typeCheckingMode": "basic",
  "pythonVersion": "3.10"
}

Integration Pattern

When editing Python code:

  1. Run pyright after significant changes
  2. Address type errors before committing
  3. Use diagnostics to improve code quality

More Information