Przejdź do treści
Biblioteka skilli
Programowanie · Przegląd i audyt

perplexity-known-pitfalls

/perplexity-known-pitfalls

Wskazuje antywzorce i typowe błędy integracji z Perplexity przy przeglądzie kodu, wdrażaniu nowych programistów i audycie istniejących integracji.

Repozytorium
agent ↗
Licencja
MIT
Ostatnia zmiana repozytorium
14.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
4
Przestarzałość

Brak sygnałów. Repozytorium zmienione 14.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Wskazuje antywzorce i typowe błędy integracji z Perplexity przy przeglądzie kodu, wdrażaniu nowych programistów i audycie istniejących integracji.

Wyzwalacze z opisu

perplexity mistakesperplexity anti-patternsperplexity pitfallsperplexity what not to doperplexity code review
Oryginalny opis (EN)

Identify and avoid Perplexity anti-patterns and common integration mistakes. Use when reviewing Perplexity code for issues, onboarding new developers, or auditing existing Perplexity integrations for best practices violations. Trigger with phrases like "perplexity mistakes", "perplexity anti-patterns", "perplexity pitfalls", "perplexity what not to do", "perplexity code review".

Jak działa

  1. Overview
  2. Prerequisites
  3. Pitfall 1: Synchronous API Calls in Request Path
  4. Pitfall 2: Not Handling Rate Limits
  5. Pitfall 3: Leaking API Keys
  6. Pitfall 4: Ignoring Idempotency
  7. Pitfall 5: Not Validating Webhooks
  8. Pitfall 6: Missing Error Handling
  9. Pitfall 7: Hardcoding Configuration
  10. Pitfall 8: Not Implementing Circuit Breaker
Sekcje z nagłówków SKILL.md, w oryginale · 321 linii, 994 słów
Podgląd SKILL.md
---
name: perplexity-known-pitfalls
description: |
  Identify and avoid Perplexity anti-patterns and common integration mistakes.
  Use when reviewing Perplexity code for issues, onboarding new developers,
  or auditing existing Perplexity integrations for best practices violations.
  Trigger with phrases like "perplexity mistakes", "perplexity anti-patterns",
  "perplexity pitfalls", "perplexity what not to do", "perplexity code review".
allowed-tools: Read, Grep
version: 1.0.0
license: MIT
author: Jeremy Longshore <jeremy@intentsolutions.io>
---

# Perplexity Known Pitfalls

## Overview
Common mistakes and anti-patterns when integrating with Perplexity.

## Prerequisites
- Access to Perplexity codebase for review
- Understanding of async/await patterns
- Knowledge of security best practices
- Familiarity with rate limiting concepts

## Pitfall #1: Synchronous API Calls in Request Path

### ❌ Anti-Pattern
```typescript
// User waits for Perplexity API call
app.post('/checkout', async (req, res) => {
  const payment = await perplexityClient.processPayment(req.body);  // 2-5s latency
  const notification = await perplexityClient.sendEmail(payment);   // Another 1-2s
  res.json({ success: true });  // User waited 3-7s
});
```

### ✅ Better Approach
```typescript
// Return immediately, process async
app.post('/checkout', async (req, res) => {
  const jobId = await queue.enqueue('process-checkout', req.body);
  res.json({ jobId, status: 'processing' });  // 50ms response
});

// Background job
async function processCheckout(data) {
  const payment = await perplexityClient.processPayment(data);
  await perplexityClient.sendEmail(payment);
}
```

---

## Pitfall #2: Not Handling Rate Limits

### ❌ Anti-Pattern
```typescript
// Blast requests, crash on 429
for (const item of items) {
  await perplexityClient.process(item);  // Will hit rate limit
}
```

### ✅ Better Approach
```typescript
import pLimit from 'p-limit';

const limit = pLimit(5);  // Max 5 concurrent
const rateLimiter = new RateLimiter({ tokensPerSecond: 10 });

for (const item of items) {
  await rateLimiter.acquire();
  await limit(() => perplexityClient.process(item));
}
```

---

## Pitfall #3: Leaking API Keys

### ❌ Anti-Pattern
```typescript
// In frontend code (visible to users!)
const client = new PerplexityClient({
  apiKey: 'sk_live_ACTUAL_KEY_HERE',  // Anyone can see this
});

// In git history
git commit -m "add API key"  // Exposed forever
```

### ✅ Better Approach
```typescript
// Backend only, environment variable
const client = new PerplexityClient({
  apiKey: process.env.PERPLEXITY_API_KEY,
});

// Use .gitignore
.env
.env.local
.env.*.local
```

---

## Pitfall #4: Ignoring Idempotency

### ❌ Anti-Pattern
```typescript
// Network error on response = duplicate charge!
try {
  await perplexityClient.charge(order);
} catch (error) {
  if (error.code === 'NETWORK_ERROR') {
    await perplexityClient.charge(order);  // Charged twice!
  }
}
```

### ✅ Better Approach
```typescript
const idempotencyKey = `order-${order.id}-${Date.now()}`;

await perplexityClient.charge(order, {
  idempotencyKey,  // Safe to retry
});
```

---

## Pitfall #5: Not Validating Webhooks

### ❌ Anti-Pattern
```typescript
// Trust any incoming request
app.post('/webhook', (req, res) => {
  processWebhook(req.body);  // Attacker can send fake events
  res.sendStatus(200);
});
```

### ✅ Better Approach
```typescript
app.post('/webhook',
  express.raw({ type: 'application/json' }),
  (req, res) => {
    const signature = req.headers['x-perplexity-signature'];
    if (!verifyPerplexitySignature(req.body, signature)) {
      return res.sendStatus(401);
    }
    processWebhook(JSON.parse(req.body));
    res.sendStatus(200);
  }
);
```

---

## Pitfall #6: Missing Error Handling

### ❌ Anti-Pattern
```typescript
// Crashes on any error
const result = await perplexityClient.get(id);
console.log(result.data.nested.value);  // TypeError if missing
```

### ✅ Better Approach
```typescript
try {
  const result = await perplexityClient.get(id);
  console.log(result?.data?.nested?.value ?? 'default');
} catch (error) {
  if (error instanceof PerplexityNotFoundError) {
    return null;
  }
  if (error instanceof PerplexityRateLimitError) {
    await sleep(error.retryAfter);
    return this.get(id);  // Retry
  }
  throw error;  // Rethrow unknown errors
}
```

---

## Pitfall #7: Hardcoding Configuration

### ❌ Anti-Pattern
```typescript
const client = new PerplexityClient({
  timeout: 5000,  // Too short for some operations
  baseUrl: 'https://api.perplexity.com',  // Can't change for staging
});
```

### ✅ Better Approach
```typescript
const client = new PerplexityClient({
  timeout: parseInt(process.env.PERPLEXITY_TIMEOUT || '30000'),
  baseUrl: process.env.PERPLEXITY_BASE_URL || 'https://api.perplexity.com',
});
```

---

## Pitfall #8: Not Implementing Circuit Breaker

### ❌ Anti-Pattern
```typescript
// When Perplexity is down, every request hangs
for (const user of users) {
  await perplexityClient.sync(user);  // All timeout sequentially
}
```

### ✅ Better Approach
```typescript
import CircuitBreaker from 'opossum';

const breaker = new CircuitBreaker(perplexityClient.sync, {
  timeout: 10000,
  errorThresholdPercentage: 50,
  resetTimeout: 30000,
});

// Fails fast when circuit is open
for (const user of users) {
  await breaker.fire(user).catch(handleFailure);
}
```

---

## Pitfall #9: Logging Sensitive Data

### ❌ Anti-Pattern
```typescript
console.log('Request:', JSON.stringify(request));  // Logs API key, PII
console.log('User:', user);  // Logs email, phone
```

### ✅ Better Approach
```typescript
const redacted = {
  ...request,
  apiKey: '[REDACTED]',
  user: { id: user.id },  // Only non-sensitive fields
};
console.log('Request:', JSON.stringify(redacted));
```

---

## Pitfall #10: No Graceful Degradation

### ❌ Anti-Pattern
```typescript
// Entire feature broken if Perplexity is down
const recommendations = await perplexityClient.getRecommendations(userId);
return renderPage({ recommendations });  // Page crashes
```

### ✅ Better Approach
```typescript
let recommendations;
try {
  recommendations = await perplexityClient.getRecommendations(userId);
} catch (error) {
  recommendations = await getFallbackRecommendations(userId);
  reportDegradedService('perplexity', error);
}
return renderPage({ recommendations, degraded: !recommendations });
```

---

## Instructions

### Step 1: Review for Anti-Patterns
Scan codebase for each pitfall pattern.

### Step 2: Prioritize Fixes
Address security issues first, then performance.

### Step 3: Implement Better Approach
Replace anti-patterns with recommended patterns.

### Step 4: Add Prevention
Set up linting and CI checks to prevent recurrence.

## Output
- Anti-patterns identified
- Fixes prioritized and implemented
- Prevention measures in place
- Code quality improved

## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| Too many findings | Legacy codebase | Prioritize security first |
| Pattern not detected | Complex code | Manual review |
| False positive | Similar code | Whitelist exceptions |
| Fix breaks tests | Behavior change | Update tests |

## Examples

### Quick Pitfall Scan
```bash
# Check for common pitfalls
grep -r "sk_live_" --include="*.ts" src/        # Key leakage
grep -r "console.log" --include="*.ts" src/     # Potential PII logging
```

## Resources
- [Perplexity Security Guide](https://docs.perplexity.com/security)
- [Perplexity Best Practices](https://docs.perplexity.com/best-practices)

## Quick Reference Card

| Pitfall | Detection | Prevention |
|---------|-----------|------------|
| Sync in request | High latency | Use queues |
| Rate limit ignore | 429 errors | Implement backoff |
| Key leakage | Git history scan | Env vars, .gitignore |
| No idempotency | Duplicate records | Idempotency keys |
| Unverified webhooks | Security audit | Signature verification |
| Missing error handling | Crashes | Try-catch, types |
| Hardcoded config | Code review | Environment variables |
| No circuit breaker | Cascading failures | opossum, resilience4j |
| Logging PII | Log audit | Redaction middleware |
| No degradation | Total outages | Fallback systems |

Wersje

W bazie nie ma innych skilli o nazwie perplexity-known-pitfalls.

Migawka bazy z 13.11.2026 · wersja paczki 2359b2f398e0 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 1 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100firecrawl-known-pitfalls
    Wskazuje antywzorce i typowe błędy integracji FireCrawl, pomocne przy przeglądzie kodu, wdrażaniu nowych programistów i audycie istniejących integracji.
  • 100retellai-known-pitfalls
    Wskazuje antywzorce i typowe błędy integracji z Retell AI przy przeglądzie kodu, wdrażaniu nowych programistów i audycie istniejących integracji.
  • 100vercel-known-pitfalls
    Wskazuje antywzorce i typowe błędy integracji Vercel, przydatne przy przeglądzie kodu, wdrażaniu nowych deweloperów i audycie wdrożeń.
  • 100customerio-known-pitfalls
    Wskazuje antywzorce i pułapki Customer.io przy przeglądzie integracji, wdrażaniu programistów i audycie istniejącego kodu.
  • 100python-anti-patterns
    Służy jako lista kontrolna antywzorców Pythona przy przeglądzie kodu, przed finalizacją implementacji i przy debugowaniu błędów po złych praktykach.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.