Agent skill · software engineering · jeremylongshore
apify-sdk-patterns
Production-ready patterns for Apify SDK and apify-client in TypeScript.
Why this skill is useful
Provides specific patterns and best practices for using the Apify SDK and Crawlee, which the AI wouldn't reliably generate on its own.
What it needs
Requires apify, apify-client, crawlee installed locally. Requires apify account access. About 3k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
Apify SDK Patterns Overview Production patterns for both the apify SDK (building Actors) and apify-client (calling Actors remotely). Covers Crawlee crawler selection, data storage, proxy configuration, and typed client wrappers. This skill gives you the essential skeletons inline; the full eight-pattern catalog and two worked scenarios live in references/ for progressive drill-down. Prerequisites Install what you need: apify-client for calling Actors remotely, or apify + crawlee for building Actors. Both can coexist in one project. Set APIFYTOKEN in the environment — read it via process.env.APIFYTOKEN, never hard-code it. This is the only credential these patterns require (Apify uses a personal API token, not OAuth). TypeScript is recommended; every snippet here is typed and runs under ts-node or a compiled build. Instructions Use the two skeletons below to start, then reach into the reference catalog for the pattern that matches your task. Pattern 1: Typed Client Singleton Create one lazily-initialized, token-validated ApifyClient and reuse it everywhere. A resetClient() hook keeps it testable. Pattern 2: Crawlee Crawler Selection Choose the crawler that matches the page, not the other way around: Patterns 3–8: Full catalog The remaining six patterns are moved verbatim into patterns.md so this file stays scannable. Pick the one you need: Pattern 3 — Actor lifecycle with error handling: Actor.main() wrapping input validation, conditional proxy, and a failedRequestHandler. Pattern 4 — Dataset operations: push from inside an Actor; list/create/download from an external app. Pattern 5 — Key-value store operations: JSON config and binary artifacts by content type. Pattern 6 — Proxy configuration: datacenter vs residential vs SERP tiers. Pattern 7 — Router for multi-page Actors: labeled listing/detail handlers. Pattern 8 — Safe result wrapper: discriminated-union Result<T> around remote calls. See patterns.md for the complete code of all six. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/apify-sdk-patterns