Borrowing it
Nothing to install: this file belongs to Asheng008/unifiles-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/Asheng008/unifiles-mcp/main/.cursor/skills/code-quality-check/SKILL.mdgit clone --depth 1 https://github.com/Asheng008/unifiles-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/asheng008/unifiles-mcp/code-quality-check)<a href="https://agentmods.dev/skills/asheng008/unifiles-mcp/code-quality-check"><img src="https://agentmods.dev/badge/skills/asheng008/unifiles-mcp/code-quality-check/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/asheng008/unifiles-mcp/code-quality-check"><img src="https://agentmods.dev/badge/skills/asheng008/unifiles-mcp/code-quality-check.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00050 | $0.01115 |
| Opus 5 | $0.00025 | $0.00558 |
| Sonnet 5 | $0.00010 | $0.00223 |
| Haiku 4.5 | $0.00005 | $0.00112 |
Grade A, and why
code-quality-check scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 183 lines — stays where its author put it; the contents beside it link to each section on GitHub.
代码质量检查
运行代码质量检查工具,确保代码符合项目规范。
快速执行
完整检查流程
# 设置编码并激活环境
chcp 65001; [Console]::OutputEncoding = [System.Text.UTF8Encoding]::UTF8; .\.venv\Scripts\Activate.ps1
# 1. Black 格式化代码
black src/ tests/
# 2. Ruff 检查并自动修复
ruff check src/ tests/ --fix
# 3. Mypy 类型检查
mypy src/unifiles_mcp/
单独执行
Black 格式化
.\.venv\Scripts\Activate.ps1; black src/ tests/
检查但不修改:
.\.venv\Scripts\Activate.ps1; black src/ tests/ --check
Ruff 检查
.\.venv\Scripts\Activate.ps1; ruff check src/ tests/
自动修复:
.\.venv\Scripts\Activate.ps1; ruff check src/ tests/ --fix
Mypy 类型检查
.\.venv\Scripts\Activate.ps1; mypy src/unifiles_mcp/
工具配置
Black 配置
项目配置在 pyproject.toml:
[tool.black]
line-length = 100
target-version = ['py310', 'py311', 'py312']
Ruff 配置
项目配置在 pyproject.toml:
[tool.ruff]
line-length = 100
target-version = "py310"
select = ["E", "W", "F", "I", "B", "C4", "UP"]
ignore = ["E501"] # line too long (handled by black)
Mypy 配置
项目配置在 pyproject.toml:
[tool.mypy]
python_version = "3.10"
warn_return_any = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
常见问题修复
Ruff 错误
E501 - 行太长
- 通常由 Black 处理,如果出现,检查 Black 是否已运行
F401 - 未使用的导入
- 删除未使用的导入
- 或使用
# noqa: F401注释(谨慎使用)
I001 - 导入排序
- Ruff 会自动修复,运行
ruff check --fix
Mypy 错误
缺少类型注解
- 为函数参数和返回值添加类型注解
- 使用
typing模块的类型提示
类型不匹配
- 检查变量类型声明
- 使用
cast()或类型断言(谨慎使用)
未定义的类型
- 确保导入所有使用的类型
- 使用
from __future__ import annotations延迟评估
代码规范要点
必须遵循
-
类型注解
- 所有函数参数和返回值必须有类型注解
- 使用 Pydantic 模型定义复杂参数
-
异步优先
- 使用
async def定义异步函数 - 避免阻塞 I/O 操作
- 使用
-
异常处理
- 捕获具体异常类型
- 避免裸露的
except Exception
-
导入顺序
- 标准库
- 第三方库
- 本地模块
代码风格
- 行长度:100 字符
- 使用 4 个空格缩进
- 使用双引号字符串
- 函数和类之间空两行
检查清单
代码质量检查完成后,确认:
- 已激活虚拟环境
- Black 已格式化代码(无格式问题)
- Ruff 无报错或已修复所有问题
- Mypy 通过或仅剩预期忽略项
- 所有类型注解完整
- 无未使用的导入
- 代码符合项目规范
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 183 lines · 50 tokens per session scan A c89f9aabefab
code-quality-check is a skill published in the GitHub repository Asheng008/unifiles-mcp (0 stars, last pushed 5mo ago), licensed MIT. It adds 50 tokens to every session and 1,115 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
mcore-linting-and-formatting
Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.
plankton-code-quality
Write-time code quality enforcement using Plankton — auto-formatting, linting, and Claude-powered fixes on every file edit via hooks.
coding.make_function_private
Identify private / public functions in a file and rename them with an underscore or not.
code-review-python
Provides Python-specific code review rules for the dh code-reviewer agent. Activates on pyproject.toml or .py file detection — enforces uv, ruff, ty, pytest, type annotation, error handling, and Python 3.11+ idioms including pathlib, match statements, and modern union syntax.
coding_qa.review
Review Python files for bugs, suggest fixes, and provide test cases.
coding.fix_use_helpers
Identify and replace Python code with code in the helpers package.