Implement Perplexity reliability patterns including circuit breakers, idempotency, and graceful degradation. Use when building fault-tolerant Perplexity integrations, implementing retry strategies, or adding resilience to production Perplexity services. Trigger with phrases like "perplexity reliability", "perplexity circuit breaker", "perplexity idempotent", "perplexity resilience", "perplexity fallback", "perplexity bulkhead".
View on GitHubjeremylongshore/claude-code-plugins-plus-skills
perplexity-pack
plugins/saas-packs/perplexity-pack/skills/perplexity-reliability-patterns/SKILL.md
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/main/plugins/saas-packs/perplexity-pack/skills/perplexity-reliability-patterns/SKILL.md -a claude-code --skill perplexity-reliability-patternsInstallation paths:
.claude/skills/perplexity-reliability-patterns/# Perplexity Reliability Patterns
## Overview
Production-grade reliability patterns for Perplexity integrations.
## Prerequisites
- Understanding of circuit breaker pattern
- opossum or similar library installed
- Queue infrastructure for DLQ
- Caching layer for fallbacks
## Circuit Breaker
```typescript
import CircuitBreaker from 'opossum';
const perplexityBreaker = new CircuitBreaker(
async (operation: () => Promise<any>) => operation(),
{
timeout: 30000,
errorThresholdPercentage: 50,
resetTimeout: 30000,
volumeThreshold: 10,
}
);
// Events
perplexityBreaker.on('open', () => {
console.warn('Perplexity circuit OPEN - requests failing fast');
alertOps('Perplexity circuit breaker opened');
});
perplexityBreaker.on('halfOpen', () => {
console.info('Perplexity circuit HALF-OPEN - testing recovery');
});
perplexityBreaker.on('close', () => {
console.info('Perplexity circuit CLOSED - normal operation');
});
// Usage
async function safePerplexityCall<T>(fn: () => Promise<T>): Promise<T> {
return perplexityBreaker.fire(fn);
}
```
## Idempotency Keys
```typescript
import { v4 as uuidv4 } from 'uuid';
import crypto from 'crypto';
// Generate deterministic idempotency key from input
function generateIdempotencyKey(
operation: string,
params: Record<string, any>
): string {
const data = JSON.stringify({ operation, params });
return crypto.createHash('sha256').update(data).digest('hex');
}
// Or use random key with storage
class IdempotencyManager {
private store: Map<string, { key: string; expiresAt: Date }> = new Map();
getOrCreate(operationId: string): string {
const existing = this.store.get(operationId);
if (existing && existing.expiresAt > new Date()) {
return existing.key;
}
const key = uuidv4();
this.store.set(operationId, {
key,
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000),
});
return key;
}
}
```
## Bulkhead Pattern
```typescript
import PQueue from 'p-