check-cascading-failures
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "check-cascading-failures":https://skillpi.com/zh/skills/deepskill-aacc887080fb1a6c14bf219d7c052f913e976fffe5cd18cbe082360a4108d8d1。安装前核对上游来源和版本: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-cascading-failures
description: Detects cascading failure risks in PHP systems. Identifies shared resources, unbounded queues, missing backpressure, thread pool exhaustion, and failure propagation paths.Cascading Failure Detection
Analyze PHP code for patterns that can cause cascading failures across services and components.
Detection Patterns
1. Shared Resource Without Isolation
// CRITICAL: Single connection pool shared by all services
final class DatabasePool
{
private static array $connections = [];
public static function getConnection(): PDO
{
// All services compete for same pool
// If one service hogs connections, all others starve
return self::$connections[array_rand(self::$connections)];
}
}
// CORRECT: Isolated pools per service (Bulkhead pattern)
final readonly class IsolatedDatabasePool
{
public function __construct(
private string $serviceName,
private int $maxConnections,
) {}
}
2. Unbounded Queue Growth
// CRITICAL: No size limit on in-memory queue
class EventQueue
{
private array $events = []; // Grows without bound
public function push(Event $event): void
{
$this->events[] = $event; // Memory exhaustion risk
}
}
// CRITICAL: No consumer backpressure
while (true) {
$message = $producer->produce($data);
// No check if consumer is keeping up
// Queue grows → memory fills → OOM → crash
}
// CORRECT: Bounded queue with backpressure
final class BoundedEventQueue
{
private SplQueue $events;
public function __construct(
private readonly int $maxSize = 10000,
) {
$this->events = new SplQueue();
}
public function push(Event $event): void
{
if ($this->events->count() >= $this->maxSize) {
throw new QueueFullException('Backpressure: queue at capacity');
}
$this->events->enqueue($event);
}
}
3. Synchronous Chain Without Circuit Breaker
// CRITICAL: Cascading synchronous calls
class OrderService
{
public function createOrder(OrderData $data): Order
{
$inventory = $this->inventoryService->reserve($data->items()); // If this hangs...
$payment = $this->paymentService->charge($data->total()); // ...this waits...
$shipping = $this->shippingService->schedule($data->address()); // ...everything stops
$notification = $this->notificationService->send($data->email()); // ...cascade!
}
}
// CORRECT: Each call protected with circuit breaker + timeout
class OrderService
{
public function createOrder(OrderData $data): Order
{
$inventory = $this->circuitBreaker->call(
fn () => $this->inventoryService->reserve($data->items()),
fallback: fn () => $this->reserveLater($data->items()),
);
}
}
4. Retry Storm (Thundering Herd)
// CRITICAL: All instances retry at same time
class ApiClient
{
public function call(string $endpoint): Response
{
for ($i = 0; $i < 3; $i++) {
try {
return $this->http->get($endpoint);
} catch (Exception $e) {
sleep(1); // Fixed delay — all instances retry simultaneously!
}
}
throw new ApiException('Failed after 3 retries');
}
}
// CORRECT: Exponential backoff with jitter
$delay = min($baseDelay * (2 ** $attempt) + random_int(0, 1000), $maxDelay);
5. Missing Health Checks
// CRITICAL: Serving traffic while dependencies are down
class ApiController
{
public function handle(Request $request): Response
{
// No check if database/cache/external services are available
// Returns 500 errors, load balancer keeps sending traffic
return $this->service->process($request);
}
}
// CORRECT: Health check endpoint
class HealthController
{
public function check(): Response
{
$checks = [
'database' => $this->checkDatabase(),
'redis' => $this->checkRedis(),
'queue' => $this->checkQueue(),
];
$healthy = !in_array(false, $checks, true);
return new Response(
json_encode($checks),
$healthy ? 200 : 503,
);
}
}
6. Resource Leak Under Failure
// CRITICAL: Connection not released on exception
class MessageProcessor
{
public function process(): void
{
$connection = $this->pool->acquire();
$this->doWork($connection); // If this throws...
$this->pool->release($connection); // ...connection is leaked!
}
}
// CORRECT: Always release in finally
class MessageProcessor
{
public function process(): void
{
$connection = $this->pool->acquire();
try {
$this->doWork($connection);
} finally {
$this->pool->release($connection);
}
}
}
Grep Patterns
# Shared static resources
Grep: "private static.*\$.*=.*\[\]|protected static.*pool|static.*\$connections" --glob "**/*.php"
# Unbounded collections
Grep: "\$this->.*\[\].*=|\[\].*events|array_push" --glob "**/Infrastructure/**/*.php"
# Synchronous chains (multiple service calls in one method)
Grep: "\$this->.*Service->.*\n.*\$this->.*Service->" --glob "**/Application/**/*.php"
# Fixed retry delays (no jitter)
Grep: "sleep\([0-9]+\)|usleep\([0-9]+\)" --glob "**/*.php"
# Missing finally blocks
Grep: "->acquire\(\)|->lock\(" --glob "**/*.php"
Grep: "finally" --glob "**/*.php"
# Missing health checks
Grep: "class.*HealthCheck|function.*health|/health" --glob "**/*.php"
Severity Classification
| Pattern | Severity |
|---|---|
| Shared pool without isolation | 🔴 Critical |
| Unbounded queue in memory | 🔴 Critical |
| Synchronous chain without breaker | 🔴 Critical |
| Retry storm (no jitter) | 🟠 Major |
| Missing health checks | 🟠 Major |
| Resource leak on failure | 🟠 Major |
| No backpressure mechanism | 🟡 Minor |
Output Format
### Cascading Failure Risk: [Description]
**Severity:** 🔴/🟠/🟡
**Location:** `file.php:line`
**Failure Path:** ServiceA → ServiceB → ServiceC
**Issue:**
[Description of the cascading failure risk]
**Blast Radius:**
- Direct: [immediately affected components]
- Indirect: [downstream components that will fail]
**Code:**
```php
// Vulnerable pattern
Fix:
// With isolation/circuit breaker/backpressure
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- PHP系统级联故障检测是生产环境稳定性保障的核心需求
- 直接解决分布式系统架构中的关键痛点
- 具有广泛实用价值
亮点
- 触发词精准完整,覆盖多种变体
- 边界清晰
- 明确描述了检测PHP系统中的级联故障风险
亮点
- Phase/步骤清晰,有出口条件
- 含端到端示例
- frontmatter完整
亮点
- 工具来源明确,参数正确
- 覆盖主要异常
- 提供了具体的grep命令和代码模式
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。