Agent skill · software engineering · jeremylongshore
serpapi-sdk-patterns
Wrap the official SerpAPI Python or JavaScript client behind typed, testable boundaries with safe errors, pagination, and output selection. Use when production code needs a stable search adapter. Trigger with "design a SerpAPI client wrapper".
Why this skill is useful
Adds production-ready client patterns for SerpApi, including caching, typing, and multi-engine support that aren't in public docs.
What it needs
Requires lru-cache, serpapi installed locally. Requires serpapi account access. About 2k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
SerpAPI Production Client Patterns Overview Create a narrow application-owned gateway instead of spreading vendor parameters, credentials, and variable result schemas through business code. Prerequisites A selected official client and pinned dependency version Supported engines, required output fields, latency objective, and failure policy Sanitized fixtures for each supported response shape Tool Discipline Use Read, Glob, and Grep to map current call sites and types, WebFetch to verify official client interfaces, and Write or Edit for the gateway, schemas, fixtures, and tests. Current Contract The Python client returns a SerpResults mapping and provides nextpage() and yieldpages(). The JavaScript client exposes promise and callback forms including getJson, getJsonBySearchId, and getAccount, but does not provide built-in pagination. Search output can be JSON, HTML, or Markdown; jsonrestrictor can reduce JSON payload fields. Authentication Inject SERPAPIKEY at the outer server-side composition root. Do not include it in domain types, cache keys, error objects, telemetry, or serialized request parameters. Instructions 1. Define a request type that admits only supported engines and application-controlled locale, safety, pagination, and output options. 2. Define a normalized response type with explicit optional sections and vendor metadata isolated from domain data. 3. Inject the official client behind a small interface so fixtures can replace it without network interception. 4. Centralize timeouts, bounded retry for transient failures, 429 classification, redaction, and search-ID logging. 5. For Python, use yieldpages() only with a page/search budget; for JavaScript, implement engine-specific manual pagination from documented tokens or offsets. 6. Select JSON for structured parsing, Markdown for token-efficient agent consumption, HTML only for approved debugging, and jsonrestrictor when supported fields are known. 7. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/serpapi-sdk-patterns