Task Router Skill
Task Router
Python code quality checking and LSP integration using pylsp. Provides code diagnostics, completion, hover tips, and style analysis. Use when: checking Python errors/warnings, getting code completions, viewing function signatures, analyzing code quality, or fixing style issues.
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
SkillHub CLI
skillhub install genify/lsp-python打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。
将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。
使用 Python Language Server Protocol (LSP) 进行代码质量检查和智能分析。
# 单个文件
python3 scripts/lsp-service.py check <文件路径>
# 批量检查 (推荐)
python3 scripts/check_python.py <文件或目录>
# 批量检查并自动修复
python3 scripts/check_python.py --auto-fix <文件或目录>
示例:
python3 scripts/lsp-service.py check my_script.py
python3 scripts/check_python.py src/
python3 scripts/check_python.py --auto-fix src/
python3 scripts/lsp-service.py complete <文件> <行号> <字符位置>
python3 scripts/lsp-service.py info <文件> <行号> <字符位置>
pip install python-lsp-server
pip install python-lsp-server[all] - 完整插件集pip install pylsp-mypy - 类型检查pip install pylsp-black - black 格式化检查 Python 文件中的错误和警告:
输出示例:
⚠️ 第 3 行 [pyflakes]: 'os' imported but unused
⚠️ 第 6 行 [pycodestyle]: E302 expected 2 blank lines, found 1
✅ 没有发现问题
获取指定位置的代码补全建议:
python3 scripts/lsp-service.py complete script.py 5 10
输出:
补全建议:
• json (模块)
• jsonpatch (模块)
• requests (模块)
查看函数签名、文档字符串等信息:
python3 scripts/lsp-service.py info script.py 10 5
查找符号的定义位置:
python3 scripts/lsp-service.py goto script.py 15 10
pip install autoflake
autoflake --remove-all-unused-imports --in-place --recursive .
pip install black
black .
# 1. 备份
cp -r project/ project.backup
# 2. 清理导入
autoflake --remove-all-unused-imports --in-place --r...
这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。
# LSP Python 技能 使用 Python Language Server Protocol (LSP) 进行代码质量检查和智能分析。 ## 快速开始 ### 1. 检查代码问题 ```bash # 单个文件 python3 scripts/lsp-service.py check <文件路径> # 批量检查 (推荐) python3 scripts/check_python.py <文件或目录> # 批量检查并自动修复 python3 scripts/check_python.py --auto-fix <文件或目录> ``` 示例: ```bash python3 scripts/lsp-service.py check my_script.py python3 scripts/check_python.py src/ python3 scripts/check_python.py --auto-fix src/ ``` ### 2. 获取代码补全 ```bash python3 scripts/lsp-service.py complete <文件> <行号> <字符位置> ``` ### 3. 查看符号信息 ```bash python3 scripts/lsp-service.py info <文件> <行号> <字符位置> ``` ## 依赖 - **Python 3.x** - **pylsp**: `pip install python-lsp-server` - **可选插件**: - `pip install python-lsp-server[all]` - 完整插件集 - `pip install pylsp-mypy` - 类型检查 - `pip install pylsp-black` - black 格式化 ## 核心功能 ### 代码诊断 (check) 检查 Python 文件中的错误和警告: - **pyflakes** - 代码错误检测 (未使用导入、未定义变量等) - **pycodestyle** - PEP8 风格检查 (格式、行长、空白等) 输出示例: ``` ⚠️ 第 3 行 [pyflakes]: 'os' imported but unused ⚠️ 第 6 行 [pycodestyle]: E302 expected 2 blank lines, found 1 ✅ 没有发现问题 ``` ### 代码补全 (complete) 获取指定位置的代码补全建议: ```bash python3 scripts/lsp-service.py complete script.py 5 10 ``` 输出: ``` 补全建议: • json (模块) • jsonpatch (模块) • requests (模块) ``` ### 悬停提示 (info) 查看函数签名、文档字符串等信息: ```bash python3 scripts/lsp-service.py info script.py 10 5 ``` ### 跳转定义 (goto) 查找符号的定义位置: ```bash python3 scripts/lsp-service.py goto script.py 15 10 ``` ## 自动修复代码问题 ### 清理未使用的导入 ```bash pip install autoflake autoflake --remove-all-unused-imports --in-place --recursive . ``` ### 格式化代码 ```bash pip install black black . ``` ### 完整修复流程 ```bash # 1. 备份 cp -r project/ project.backup # 2. 清理导入 autoflake --remove-all-unused-imports --in-place --r...
Task Router
Register, communicate, and earn on the x402hub AI agent marketplace. Use when an agent needs to register on x402hub, browse or claim bounties, submit deliverables, send messages to other agents via x402 Relay,...
Real-time event bus for AI agents. Publish, subscribe, and share live signals across a network of agents with Unix-style simplicity.
OpenClaw integration guidance for CAPTCHAS Agent API, including OpenResponses tool schemas and plugin tool registration.