check-connection-pool

分析 PHP 代码中的连接池问题:检测连接泄漏、连接池大小配置不当、未释放连接和超时问题等,以评估连接池的健康状况。

仓库最近推送
GitHub Stars
109
Forks
26
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "check-connection-pool":https://skillpi.com/zh/skills/deepskill-0aa93b738b5778ad30515edb8db9013049330d7453bc9bd45d0892ddd46017e4。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

分析 PHP 代码中的连接池问题:检测连接泄漏、连接池大小配置不当、未释放连接和超时问题等,以评估连接池的健康状况。

0 下载

介绍来源: third_party · dykyi-roman · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
输入和输出
减记
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: check-connection-pool
description: Analyzes PHP code for connection pool issues. Detects connection leaks, improper pool sizing, missing connection release, timeout issues.

Connection Pool Performance Analysis

Analyze PHP code for connection pool issues and database connection management problems.

When to Use

  • Reviewing database-heavy PHP applications
  • Investigating connection exhaustion or memory leaks
  • Auditing long-running workers (queue consumers, daemons)
  • Checking Doctrine EntityManager lifecycle issues
  • Reviewing HTTP client usage patterns

Analysis Approach

  1. Scan for connection creation patterns (PDO, Redis, Guzzle)
  2. Check loop bodies for repeated connection instantiation
  3. Verify try/finally cleanup on pool acquire/release
  4. Check timeout configuration on all connection types
  5. Review persistent connection usage and state reset
  6. Audit worker processes for connection refresh logic

Detection Rules

ID Pattern What to Look For
CP-01 Connection leak new PDO without cleanup in exception/early-return paths
CP-02 Connection in loop new PDO/new Redis/new Client inside foreach/while
CP-03 Missing timeout PDO without ATTR_TIMEOUT, Redis without connect timeout
CP-04 Persistent misuse ATTR_PERSISTENT => true without shutdown cleanup
CP-05 Pool exhaustion Multiple connections opened without reuse
CP-06 Missing finally $pool->release() not in finally block
CP-07 State not reset Connection returned to pool with modified session state
CP-08 Doctrine issues EntityManager not cleared, long-held transactions
CP-09 Worker stale conn Long-running worker without connection refresh
CP-10 HTTP no pooling file_get_contents in loop, no keep-alive headers

Grep Patterns

# New connection in loops
Grep: "foreach.*\{[^}]*new PDO|while.*\{[^}]*new PDO" --glob "**/*.php" --multiline

# Missing connection close
Grep: "new Redis\(\)" --glob "**/*.php"

# Persistent connections
Grep: "ATTR_PERSISTENT" --glob "**/*.php"

# Connection without timeout
Grep: "new PDO\s*\([^)]+\)\s*;" --glob "**/*.php"

# Static connection storage
Grep: "static.*PDO|static.*connection" --glob "**/*.php"

Severity Classification

Pattern Severity
Connection in loop Critical
Connection leak (no finally) Critical
No connection timeout Major
Pool exhaustion risk Major
Missing connection health check Major
Persistent connection misuse Minor
Static connection storage Minor

Output Format

### Connection Pool: [Description]

**Severity:** Critical/Major/Minor
**Location:** `file.php:line`
**Impact:** [Database overload, connection exhaustion, memory leak]

**Issue:**
[Description of the connection management problem]

**Code:**
[Problematic code snippet]

**Fix:**
[Proper connection management code]

**Expected Improvement:**
- Connection count: 100 -> 10 (pooled)
- Memory usage: -50% (connections reused)
- DB load: -80% (connection overhead eliminated)

References

  • references/patterns.md — detailed detection patterns with code examples, secure pool implementations, health check and worker refresh patterns

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值75/100

亮点

  • 针对 PHP 数据库连接池性能问题,提供系统化的检测规则和 grep 模式
  • 覆盖连接泄漏、池大小配置、超时设置等关键运维痛点
触发精准85/100

亮点

  • description 清晰明确,触发词精准,边界清晰
结构规范75/100

待提升项

  • 文档过长 原报告严重程度:轻微

    Skill 文档内容超过 500 行,影响可读性

    改进建议:考虑将详细检测模式、代码示例等移至引用文件中,主文档保持简洁

亮点

  • 结构完整,包含使用场景、分析步骤、检测规则、严重性分类和输出格式
  • 提供了具体的 grep 命令用于实际检测
执行可靠70/100

待提升项

  • 未覆盖所有 PHP 数据库扩展 原报告严重程度:轻微

    检测规则主要针对 PDO、Redis、Guzzle,未覆盖 mysqli 等其他常见 PHP 数据库连接方式

    改进建议:补充 mysqli 相关的连接池检测规则和 grep 模式

亮点

  • 提供了具体的 grep 模式,工具来源明确,参数合理
  • 输出格式清晰,包含严重性、位置、影响、修复建议等完整信息
证据可验 (前四项均值)76/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。