Pièges connus d'Exa

VérifiéSûr

Identifiez et évitez les anti-patrons et erreurs d'intégration courantes avec Exa. Utilisé lors de la revue de code Exa, de l'embarquement ou de l'audit d'intégrations Exa.

Spar Skills Guide Bot
DeveloppementIntermédiaire
25/07/2026
Claude CodeCursorCodex
#exa#code-review#anti-patterns#api-integration#best-practices

Recommandé pour

Synthèse automatique

Ce skill passe en revue du code d'intégration Exa et signale les anti-patterns courants (appels synchrones, rate limits, fuites de clés, idempotence, webhooks non vérifiés, gestion d'erreurs absente).

Points forts

  • Chaque pitfall est présenté en binôme anti-pattern / bonne approche avec des extraits TypeScript directement comparables.
  • Couvre des problèmes concrets et fréquents : files d'attente asynchrones, limitation de concurrence, idempotency keys, vérification de signature de webhook.
  • Format court et scannable, adapté à une revue de code ou à un onboarding de nouveaux développeurs.
  • Outils restreints à Read et Grep, ce qui convient à un audit en lecture seule d'un dépôt existant.

Limites

  • Les exemples utilisent un client « ExaClient » générique avec des méthodes de paiement et d'e-mail, sans lien avec l'API de recherche Exa réelle : à transposer manuellement.
  • Le document fourni s'interrompt au pitfall #6, donc la couverture annoncée n'est pas garantie complète.
  • Aucune procédure de correction automatisée : le skill identifie les problèmes mais ne propose pas de refactoring outillé.
Quand l'utiliser

À utiliser lors d'une revue de code ou d'un audit d'une intégration Exa existante, ou pour sensibiliser une équipe aux erreurs d'intégration classiques.

Quand l'éviter

À éviter si vous cherchez la documentation de référence de l'API Exa ou des exemples fonctionnels prêts à copier pour la recherche.

Analyse de sécurité

Sûr
Score qualité92/100

The skill only provides educational content about Exa API integration best practices. It uses Read and Grep tools, which are non-destructive. No shell commands, network exfiltration, or dangerous actions are instructed. Code examples are illustrative and not executed.

Aucun point d'attention détecté

Comment cette analyse est faite

Exemples

Audit an Exa integration
Review our Exa integration for anti-patterns — check rate limiting, API key handling, idempotency and webhook validation, and list the pitfalls we're hitting.
Onboarding walkthrough
I'm new to this codebase. Walk me through the Exa integration mistakes we should avoid before I start contributing.
Focused webhook check
Look at our Exa webhook handler and tell me what not to do — is the signature verification and error handling correct?

name: exa-known-pitfalls description: | Identify and avoid Exa anti-patterns and common integration mistakes. Use when reviewing Exa code for issues, onboarding new developers, or auditing existing Exa integrations for best practices violations. Trigger with phrases like "exa mistakes", "exa anti-patterns", "exa pitfalls", "exa what not to do", "exa code review". allowed-tools: Read, Grep version: 1.0.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io

Exa Known Pitfalls

Overview

Common mistakes and anti-patterns when integrating with Exa.

Prerequisites

  • Access to Exa 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

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

✅ Better Approach

// 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 exaClient.processPayment(data);
  await exaClient.sendEmail(payment);
}

Pitfall #2: Not Handling Rate Limits

❌ Anti-Pattern

// Blast requests, crash on 429
for (const item of items) {
  await exaClient.process(item);  // Will hit rate limit
}

✅ Better Approach

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(() => exaClient.process(item));
}

Pitfall #3: Leaking API Keys

❌ Anti-Pattern

// In frontend code (visible to users!)
const client = new ExaClient({
  apiKey: 'sk_live_ACTUAL_KEY_HERE',  // Anyone can see this
});

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

✅ Better Approach

// Backend only, environment variable
const client = new ExaClient({
  apiKey: process.env.EXA_API_KEY,
});

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

Pitfall #4: Ignoring Idempotency

❌ Anti-Pattern

// Network error on response = duplicate charge!
try {
  await exaClient.charge(order);
} catch (error) {
  if (error.code === 'NETWORK_ERROR') {
    await exaClient.charge(order);  // Charged twice!
  }
}

✅ Better Approach

const idempotencyKey = `order-${order.id}-${Date.now()}`;

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

Pitfall #5: Not Validating Webhooks

❌ Anti-Pattern

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

✅ Better Approach

app.post('/webhook',
  express.raw({ type: 'application/json' }),
  (req, res) => {
    const signature = req.headers['x-exa-signature'];
    if (!verifyExaSignature(req.body, signature)) {
      return res.sendStatus(401);
    }
    processWebhook(JSON.parse(req.body));
    res.sendStatus(200);
  }
);

Pitfall #6: Missing Error Handling

❌ Anti-Pattern

// Crashes on any error
const result = await exaClient.get(id);
console.log(result.data.nested.value);  // TypeError if missing

✅ Better Approach

try {
  const result = await exaClient.get(id);
  console.log(result?.data?.nested?.value ?? 'default');
} catch (error) {
  if (error instanceof ExaNotFoundError) {
    return null;
  }
  if (error instanceof ExaRateLimitError) {
    await sleep(error.retryAfter);
    return this.get(id);  // Retry
  }
  throw error;  // Rethrow unknown errors
}

Pitfall #7: Hardcoding Configuration

❌ Anti-Pattern

const client = new ExaClient({
  timeout: 5000,  // Too short for some operations
  baseUrl: 'https://api.exa.com',  // Can't change for staging
});

✅ Better Approach

const client = new ExaClient({
  timeout: parseInt(process.env.EXA_TIMEOUT || '30000'),
  baseUrl: process.env.EXA_BASE_URL || 'https://api.exa.com',
});

Pitfall #8: Not Implementing Circuit Breaker

❌ Anti-Pattern

// When Exa is down, every request hangs
for (const user of users) {
  await exaClient.sync(user);  // All timeout sequentially
}

✅ Better Approach

import CircuitBreaker from 'opossum';

const breaker = new CircuitBreaker(exaClient.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

console.log('Request:', JSON.stringify(request));  // Logs API key, PII
console.log('User:', user);  // Logs email, phone

✅ Better Approach

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

// Entire feature broken if Exa is down
const recommendations = await exaClient.getRecommendations(userId);
return renderPage({ recommendations });  // Page crashes

✅ Better Approach

let recommendations;
try {
  recommendations = await exaClient.getRecommendations(userId);
} catch (error) {
  recommendations = await getFallbackRecommendations(userId);
  reportDegradedService('exa', 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

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

Resources

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 |

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/exa-known-pitfalls-mrzxur4c' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/exa-known-pitfalls-mrzxur4c/download' --output '.skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md.part' && mv '.skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md.part' '.skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Outils déclarés par l’auteur (à vérifier dans votre agent) : Read, Grep

Extrait original : Prerequisites
  • Access to Exa codebase for review
  • Understanding of async/await patterns
  • Knowledge of security best practices
  • Familiarity with rate limiting concepts

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md' && test -s '.skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/exa-known-pitfalls' && cp -R '.skill-downloads/exa-known-pitfalls-mrzxur4c' '.claude/skills/exa-known-pitfalls'

Cursor
test -f '.skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md' && test -s '.skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/exa-known-pitfalls' && cp -R '.skill-downloads/exa-known-pitfalls-mrzxur4c' '.cursor/skills/exa-known-pitfalls'

Codex
test -f '.skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md' && test -s '.skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/exa-known-pitfalls' && cp -R '.skill-downloads/exa-known-pitfalls-mrzxur4c' '.agents/skills/exa-known-pitfalls'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/exa-known-pitfalls-mrzxur4c'

openskills read 'exa-known-pitfalls-mrzxur4c'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/exa-known-pitfalls-mrzxur4c/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires