check-naming
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "check-naming":https://skillpi.com/zh/skills/deepskill-561e5757bd25bf2a6090ddea41ce01b28d70a3483a1f8a415bb83d4f8cdfe914。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
分析 PHP 代码中的命名规范问题。检测无描述性的名称、缩写、大小写不一致以及具有误导性的名称。
介绍来源: third_party · dykyi-roman · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 输入和输出
- 减记
- 实测状态
- 未测试
文件浏览
Frontmatter
name: check-naming
description: Analyzes PHP code for naming convention issues. Detects non-descriptive names, abbreviations, inconsistent casing, misleading names.Naming Convention Check
Analyze PHP code for naming quality and consistency.
Detection Patterns
1. Non-Descriptive Names
// BAD: Single letter variables (except loop counters)
$x = $user->getAge();
$d = new DateTime();
$r = $repository->find($id);
// GOOD: Descriptive names
$userAge = $user->getAge();
$currentDate = new DateTime();
$foundUser = $repository->find($id);
// BAD: Generic names
$data = $service->process();
$result = $handler->handle();
$temp = $this->calculate();
// GOOD: Specific names
$orderSummary = $service->generateSummary();
$validationResult = $handler->validate();
$discountAmount = $this->calculateDiscount();
2. Abbreviations and Acronyms
// BAD: Unclear abbreviations
$usrMgr = new UserManager();
$prodRepo = new ProductRepository();
$txnSvc = new TransactionService();
// GOOD: Full words
$userManager = new UserManager();
$productRepository = new ProductRepository();
$transactionService = new TransactionService();
// ACCEPTABLE: Common acronyms
$userId = $user->getId(); // ID is universally understood
$htmlContent = $this->render(); // HTML is common
$apiResponse = $client->get(); // API is common
3. Inconsistent Casing
// BAD: Mixed casing styles
$user_name = 'John'; // snake_case
$userAge = 25; // camelCase
$UserEmail = 'x@y'; // PascalCase
// GOOD: Consistent camelCase for variables
$userName = 'John';
$userAge = 25;
$userEmail = 'x@y';
// Constants should be UPPER_SNAKE_CASE
const MAX_RETRIES = 3;
const DEFAULT_TIMEOUT = 30;
4. Misleading Names
// BAD: Name doesn't match behavior
function getUser(): void // "get" implies return value
{
$this->user = $this->repository->find($id);
}
// BAD: Boolean without is/has/can prefix
$active = $user->active; // Unclear if boolean
// GOOD: Clear boolean naming
$isActive = $user->isActive();
$hasOrders = $user->hasOrders();
$canEdit = $user->canEditProfile();
// BAD: Negated boolean names
$isNotValid = false; // Double negative confusion
$isInactive = true;
// GOOD: Positive boolean names
$isValid = true;
$isActive = false;
5. Class Naming
// BAD: Generic class names
class Manager {} // Manager of what?
class Processor {} // Processes what?
class Handler {} // Handles what?
class Helper {} // Helps with what?
// GOOD: Specific class names
class OrderManager {}
class PaymentProcessor {}
class WebhookHandler {}
class DateTimeHelper {}
// BAD: Missing suffix for pattern
class User implements RepositoryInterface {}
// GOOD: Pattern-indicating suffix
class UserRepository implements RepositoryInterface {}
class OrderFactory {}
class PaymentService {}
6. Method Naming
// BAD: Vague method names
function process() {}
function handle() {}
function execute() {}
function run() {}
// GOOD: Action-specific names
function processPayment() {}
function handleWebhook() {}
function executeQuery() {}
function runMigrations() {}
// BAD: Doesn't describe what it returns
function user(): User {}
// GOOD: Describes intent
function findUserById(int $id): User {}
function getCurrentUser(): User {}
function createGuestUser(): User {}
7. Parameter Naming
// BAD: Type as name
function process(array $array, string $string): void {}
// GOOD: Descriptive parameter names
function processOrder(array $orderItems, string $currency): void {}
// BAD: Numbered parameters
function calculate(int $value1, int $value2): int {}
// GOOD: Meaningful parameter names
function calculateDiscount(int $originalPrice, int $discountPercent): int {}
8. Constant Naming
// BAD: Lowercase or camelCase constants
const maxRetries = 3;
const defaultTimeout = 30;
// GOOD: UPPER_SNAKE_CASE
const MAX_RETRIES = 3;
const DEFAULT_TIMEOUT = 30;
const API_VERSION = 'v1';
// BAD: Non-descriptive
const VALUE = 100;
const LIMIT = 50;
// GOOD: Contextual
const PAGINATION_LIMIT = 50;
const MAX_UPLOAD_SIZE_MB = 100;
Grep Patterns
# Single letter variables
Grep: "\\\$[a-z]\s*=" --glob "**/*.php"
# Common abbreviations
Grep: "\\\$(mgr|svc|repo|impl|util)\w*\s*=" -i --glob "**/*.php"
# Generic class names
Grep: "class\s+(Manager|Processor|Handler|Helper)\s" --glob "**/*.php"
# Boolean without prefix
Grep: "private\s+(bool|\?bool)\s+\\\$[^is|has|can|should|was|will]" --glob "**/*.php"
Naming Conventions Summary
| Element | Convention | Example |
|---|---|---|
| Variables | camelCase | $userName |
| Constants | UPPER_SNAKE_CASE | MAX_RETRIES |
| Functions | camelCase | getUserById() |
| Classes | PascalCase | UserService |
| Interfaces | PascalCase + Interface | UserRepositoryInterface |
| Traits | PascalCase + Trait | TimestampableTrait |
Severity Classification
| Pattern | Severity |
|---|---|
| Misleading names | 🟠 Major |
| Single letter (non-loop) | 🟡 Minor |
| Inconsistent casing | 🟡 Minor |
| Abbreviations | 🟢 Suggestion |
Output Format
### Naming Issue: [Description]
**Severity:** 🟠/🟡/🟢
**Location:** `file.php:line`
**Issue:**
[Description of the naming problem]
**Current:**
```php
$x = $service->getData();
Suggested:
$orderData = $service->getOrderData();
Rationale: Descriptive names reduce cognitive load and improve maintainability.
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 PHP 命名规范检测能力,覆盖变量、类、方法、常量等命名问题
- 具有明确的技术实用价值,适用于开发者日常代码质量检查
亮点
- description 明确描述功能为分析 PHP 代码命名规范问题
- 涵盖非描述性名称、缩写、大小写不一致、误导性名称等具体场景,触发词精准且边界清晰
亮点
- 文档结构完整,包含检测模式、grep 模式、命名规范总结、严重性分类和输出格式
- 步骤清晰,有具体示例,frontmatter 完整,单文件未超限
亮点
- 提供具体的 grep 模式用于检测命名问题,工具来源明确(grep),参数正确
- 覆盖主要异常场景,输出格式规范,具备良好执行可靠性
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。