check-comments
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "check-comments":https://skillpi.com/zh/skills/deepskill-5fe42e09e5987eeeb0f0cdec6906499f58219972be01d6f6b48d57aa9d78484d。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
分析 PHP 代码中的注释质量问题,检测缺失的 PHPDoc、过时的注释、被注释掉的代码以及可由自文档化代码替代的注释机会。
介绍来源: third_party · dykyi-roman · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 输入和输出
- 减记
- 实测状态
- 未测试
文件浏览
Frontmatter
name: check-comments
description: Analyzes PHP code for comment quality issues. Detects missing PHPDoc, outdated comments, commented-out code, opportunities for self-documenting code.Comment Quality Check
Analyze PHP code for documentation and comment issues.
Detection Patterns
1. Missing PHPDoc
// BAD: No documentation on public method
public function process(array $items, bool $force = false): Result
{
}
// GOOD: Documented public method
/**
* Process items with optional force flag.
*
* @param array<Item> $items Items to process
* @param bool $force Force processing even if already processed
* @return Result Processing result with status and errors
*
* @throws ProcessingException When processing fails
*/
public function process(array $items, bool $force = false): Result
{
}
2. Outdated Comments
// BAD: Comment doesn't match code
// Calculates the discount percentage
public function calculateTax(Money $amount): Money
{
return $amount->multiply(0.21);
}
// BAD: TODO that's been done or is stale
// TODO: Add validation (added 3 years ago)
$this->validate($data);
// BAD: Incorrect parameter documentation
/**
* @param string $userId The user ID // Actually int
*/
public function findUser(int $userId): User {}
3. Commented-Out Code
// BAD: Dead code cluttering the file
public function process(Order $order): void
{
// $this->legacyProcessor->process($order);
// if ($order->needsSpecialHandling()) {
// $this->specialHandler->handle($order);
// }
$this->newProcessor->process($order);
}
// Remove commented code - use version control instead
public function process(Order $order): void
{
$this->newProcessor->process($order);
}
4. Obvious Comments
// BAD: Comments stating the obvious
// Get the user
$user = $this->getUser();
// Increment counter
$counter++;
// Loop through items
foreach ($items as $item) {}
// GOOD: Comments explaining WHY
// Fetch fresh user to ensure permissions are current
$user = $this->getUser();
5. Self-Documenting Code Opportunities
// BAD: Comment needed due to unclear code
// Check if user can access premium features
if ($user->level >= 3 && $user->subscription !== null && $user->subscription->isActive()) {}
// GOOD: Self-documenting
if ($user->canAccessPremiumFeatures()) {}
// BAD: Magic number with comment
// 86400 seconds in a day
$expiry = time() + 86400;
// GOOD: Named constant
$expiry = time() + self::SECONDS_PER_DAY;
6. Missing Exception Documentation
// BAD: Throws not documented
public function divide(int $a, int $b): float
{
if ($b === 0) {
throw new DivisionByZeroException();
}
return $a / $b;
}
// GOOD: Throws documented
/**
* @throws DivisionByZeroException When divisor is zero
*/
public function divide(int $a, int $b): float {}
7. Noise Comments
// BAD: File header noise
/***********************************
* UserService.php
* Created: 2024-01-01
* Author: John Doe
* Last Modified: 2024-06-15
***********************************/
// BAD: Section dividers
//////////////////////////////////
// GETTERS AND SETTERS
//////////////////////////////////
// BAD: Closing brace comments
} // end if
} // end foreach
} // end class
8. Inline Comment Placement
// BAD: Comment on same line as code
$total = $price * $quantity; // Calculate total
// GOOD: Comment on line before
// Calculate order total including quantity discount
$total = $this->calculateTotal($price, $quantity);
PHPDoc Best Practices
Required Documentation
/**
* Classes: Brief description of purpose
*/
final class OrderProcessor
{
/**
* Public methods: What it does, params, returns, throws
*/
public function process(Order $order): Result {}
/**
* Complex private methods: When non-obvious
*/
private function calculateComplexDiscount(): Money {}
}
Type Annotations
/**
* @param array<string, mixed> $config Configuration options
* @param list<int> $ids List of integer IDs
* @param Collection<int, User> $users User collection
* @return array{success: bool, errors: list<string>}
*/
When NOT to Comment
- Getters and setters (self-explanatory)
- Simple private methods
- Code that is self-documenting
- Obvious logic
Grep Patterns
# Commented out code
Grep: "^\s*//\s*\\\$|^\s*//\s*if\s*\(|^\s*//\s*foreach" --glob "**/*.php"
# TODO/FIXME
Grep: "TODO|FIXME|HACK|XXX" --glob "**/*.php"
# Missing PHPDoc on public method
Grep: "^\s*public\s+function" --glob "**/*.php"
# Compare with lines having /** before them
# Old-style type hints in comments
Grep: "@param\s+\w+\s+\\\$\w+.*\bint\b|\bstring\b" --glob "**/*.php"
Severity Classification
| Pattern | Severity |
|---|---|
| Outdated/misleading comments | 🟠 Major |
| Commented-out code | 🟡 Minor |
| Missing PHPDoc on public API | 🟡 Minor |
| Obvious comments | 🟢 Suggestion |
| Missing @throws | 🟢 Suggestion |
Output Format
### Comment Issue: [Description]
**Severity:** 🟠/🟡/🟢
**Location:** `file.php:line`
**Type:** [Missing PHPDoc|Outdated|Commented Code|...]
**Issue:**
[Description of the comment problem]
**Current:**
```php
// Calculate discount
public function calculateTax(): Money {}
Suggested:
/**
* Calculate applicable tax for the order.
*
* @return Money Tax amount in order currency
*/
public function calculateTax(): Money {}
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 PHP 代码注释质量分析的完整指南,覆盖缺失 PHPDoc、过时注释、被注释代码等常见问题
- 包含详细的检测模式、最佳实践和 Grep 命令,实用性强
待提升项
-
description写错位置 原报告严重程度:轻微
顶层 frontmatter 中 description 字段为空,实际描述内容位于 skill_body 内部
改进建议:将 description 内容移至顶层 frontmatter 的 description 字段中,确保触发系统能正确识别
亮点
- 功能描述清晰完整,准确概括了 Skill 的核心能力(分析 PHP 注释质量问题)
- 触发边界明确,不易与其他 Skill 混淆
亮点
- 文档结构完整,包含检测模式、最佳实践、Grep 模式、严重性分类和输出格式
- 提供丰富的代码示例对比(BAD/GOOD),便于理解执行
- frontmatter 完整,单文件长度合理
亮点
- 提供可靠的 Grep 命令模式用于实际检测
- 严重性分类清晰,输出格式规范,便于集成到工作流
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。