find-logic-errors
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "find-logic-errors":https://skillpi.com/zh/skills/deepskill-eedc2be86001a7ab3a98789a33482a8beb7c68c698b110a66a3c1d60495b1adf。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
检测 PHP 代码中的逻辑错误。用于发现错误的条件、错误的运算符、缺失的 switch 分支、逻辑颠倒与短路求值问题。
介绍来源: third_party · dykyi-roman · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 输入和输出
- 减记
- 实测状态
- 未测试
文件浏览
Frontmatter
name: find-logic-errors
description: Detects logic errors in PHP code. Finds incorrect conditions, wrong operators, missing switch cases, inverted logic, short-circuit evaluation issues.Logic Error Detection
Analyze PHP code for logic errors that cause incorrect behavior.
Detection Patterns
1. Incorrect Comparison Operators
// BUG: Assignment instead of comparison
if ($status = 'active') { } // Should be ===
// BUG: Wrong comparison type
if ($count == '0') { } // 0, 0.0, '', null and false all match — use === '0'
// BUG: Yoda condition error
if ('active' = $status) { } // Assignment error
2. Inverted Logic
// BUG: Double negation confusion
if (!$user->isNotActive()) { } // Hard to reason about
// BUG: Wrong negation placement
if (!$a && $b) { } // vs if (!($a && $b))
// BUG: DeMorgan's law violation
if (!$a || !$b) { } // When meaning !($a && $b)
3. Missing Switch/Match Cases
// BUG: Missing enum case
match ($status) {
Status::Active => 'active',
Status::Inactive => 'inactive',
// Missing: Status::Pending, Status::Deleted
};
// BUG: Missing default
switch ($type) {
case 'A': return 1;
case 'B': return 2;
// No default - undefined behavior for other values
}
4. Short-Circuit Evaluation Issues
// BUG: Side effect in short-circuit
if ($valid && $this->save()) { } // save() not called if !$valid
// BUG: Order matters
if ($obj->method() && $obj !== null) { } // Null check too late
5. Off-by-One in Comparisons
// BUG: Fence post error
if ($index < count($array)) { } // vs <=
// BUG: Wrong boundary
for ($i = 0; $i <= $length; $i++) { } // Off by one
6. Boolean Expression Errors
// BUG: Always true/false
if ($age > 0 || $age <= 0) { } // Always true
// BUG: Unreachable condition
if ($x > 10 && $x < 5) { } // Always false
// BUG: Redundant condition
if ($status === 'active' && $status !== 'inactive') { } // Second part redundant
7. Return Value Ignorance
// BUG: Ignoring important return
array_push($items, $new); // Returns count, not array
$result = trim($string); // trim() returns a new string; calling it without
// assigning discards the result
// (note: $string->trim() is a fatal error — PHP strings
// are not objects and have no methods)
Grep Patterns
# Assignment in condition
Grep: "if\s*\([^=]*[^!=<>]=[^=][^)]*\)" --glob "**/*.php"
# Double negation
Grep: "!\$\w+->isNot|!!\$" --glob "**/*.php"
# Empty switch without default
Grep: "switch\s*\([^)]+\)\s*\{[^}]*\}" --glob "**/*.php"
Output Format
### Logic Error: [Description]
**Severity:** 🔴/🟠/🟡
**Location:** `file.php:line`
**Type:** [Incorrect Operator|Inverted Logic|Missing Case|...]
**Issue:**
[Description]
**Code:**
```php
// Current code
Fix:
// Corrected code
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 针对 PHP 开发者高频刚需场景,解决代码逻辑错误检测核心痛点
- 覆盖 7 类常见逻辑错误类型,具备强工程实用价值
亮点
- 触发词精准完整,明确限定 PHP 代码逻辑错误检测范围
- 边界清晰,无与其他 Skill 重叠风险
待提升项
-
缺少 When to Use 章节 原报告严重程度:轻微
文档未明确说明适用场景和使用时机
改进建议:建议补充 When to Use 章节,说明何时调用此 Skill
亮点
- Detection Patterns 分类型说明,结构清晰
- 每种错误类型均提供代码示例,便于理解执行
亮点
- grep 命令参数正确,正则表达式合理可用
- 输出格式标准化,便于后续处理集成
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。