serpapi-sdk-patterns

Featured

Production-ready SerpApi client patterns with caching, typing, and multi-engine support. Use when building search services, implementing result caching, or wrapping SerpApi with typed responses. Trigger: "serpapi patterns", "serpapi best practices", "serpapi client wrapper".

AI & Automation 2,274 stars 319 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# SerpApi SDK Patterns ## Overview Production patterns for SerpApi: typed result interfaces, response caching (critical since each search costs credits), multi-engine abstraction, and async search with the Searches Archive API. ## Instructions ### Step 1: Typed Result Interfaces ```typescript interface SerpApiOrganicResult { position: number; title: string; link: string; snippet: string; displayed_link: string; source?: string; } interface SerpApiSearchResult { search_metadata: { id: string; status: string; created_at: string }; search_parameters: Record<string, string>; organic_results: SerpApiOrganicResult[]; answer_box?: { answer?: string; snippet?: string; title?: string }; knowledge_graph?: { title: string; description?: string; type?: string }; related_questions?: Array<{ question: string; snippet: string }>; pagination?: { next: string }; } ``` ### Step 2: Cached Search Client ```typescript import { getJson } from 'serpapi'; import { LRUCache } from 'lru-cache'; const cache = new LRUCache<string, SerpApiSearchResult>({ max: 500, ttl: 3600_000, // 1 hour -- search results are relatively stable }); async function cachedSearch(params: Record<string, any>): Promise<SerpApiSearchResult> { const key = JSON.stringify(params); const cached = cache.get(key); if (cached) return cached; const result = await getJson({ ...params, api_key: process.env.SERPAPI_API_KEY, }) as SerpApiSearchResult; cache.set(key, result); r...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

serpapi-performance-tuning

Optimize SerpApi performance with caching, async searches, and result filtering. Use when reducing latency, minimizing credit consumption, or optimizing search throughput. Trigger: "serpapi performance", "optimize serpapi", "serpapi caching", "serpapi slow".

2,274 Updated today
jeremylongshore
AI & Automation Featured

serpapi-reference-architecture

Production architecture for SerpApi search services with caching, monitoring, and multi-engine support. Use when designing search features, building SERP tracking systems, or architecting search-powered applications. Trigger: "serpapi architecture", "serpapi project structure", "serpapi design".

2,274 Updated today
jeremylongshore
AI & Automation Featured

algolia-sdk-patterns

Apply production-ready algoliasearch v5 patterns: singleton client, typed search, error handling, and batch operations. Use when implementing Algolia integrations, refactoring SDK usage, or establishing team coding standards. Trigger: "algolia SDK patterns", "algolia best practices", "algolia code patterns", "idiomatic algolia".

2,274 Updated today
jeremylongshore
AI & Automation Featured

serpapi-cost-tuning

Optimize SerpApi costs by reducing credit consumption and choosing the right plan. Use when analyzing search usage, reducing monthly costs, or implementing credit-saving strategies. Trigger: "serpapi cost", "serpapi pricing", "reduce serpapi costs", "serpapi credits".

2,274 Updated today
jeremylongshore
AI & Automation Featured

serpapi-security-basics

Secure SerpApi API keys and prevent credit abuse. Use when storing API keys, implementing backend proxies, or auditing SerpApi access patterns. Trigger: "serpapi security", "serpapi API key security", "secure serpapi".

2,274 Updated today
jeremylongshore