ericrisco/rsc-harness/api-connector-builder
Claude Code and agent skill by ericrisco/rsc-harness
- community
Checking that the SKILL.md file is still in the repository.
Use when writing a client for someone else's REST or GraphQL API: auth flow choice and token refresh, pagination to exhaustion, retry-with-jitter on transient failures only, rate-limit-aware throttling. NOT inbound callbacks (that is `webhooks`), NOT chaining services (that is `automation-flows`), NOT designing your own API (that is `api-design`).
Install
npx vskill@latest install ericrisco/rsc-harness/api-connector-builderSKILL.md
The same SKILL.md was published earlier as ericrisco/rsc-harness/api-connector-builder.
API connector builder — auth, pagination, retries, rate limits
You are writing a client for someone else's HTTP API. You do not own the contract; you obey it. The deliverable is one typed connector module per vendor that authenticates, walks the whole result set, retries only transient failures with backoff, and stays under the rate limit without getting the key banned. One connector = one vendor: mixed clients tangle two auth schemes and two rate-limit budgets into something no one can reason about.
Four pillars, every time: auth, pagination, retries, rate limits. If your connector skips any one of them it works in the demo and breaks in production — on page 2, on token expiry, on the first 429, or on a flaky network.
Step 0 — read the contract
Read the vendor docs before writing a line — invented endpoints and guessed field names 404 in prod. Extract these first; each one changes what you write, so missing one means a rewrite.
| Find in their docs | Why it changes your code | |
|---|---|---|
| Auth scheme + token TTL | Picks the flow below; TTL decides if you need refresh | |
| Base URL and version | Wrong version = silent 404s or deprecated field shapes | |
| Rate-limit header names | You cannot throttle to a budget you cannot read | |
| Pagination style | Cursor vs offset vs Link vs Relay = different loop | |
| Error envelope shape | Where the real error code lives (body, not always status) | |
| Idempotency support | Decides whether POST is safe to retry (key header?) |
If a fact is not in the docs, probe one real call and read the response headers and body — do not assume.
Auth — pick the flow, then store the secret right
OAuth 2.1 is the current baseline. Three deltas you must honor: PKCE is mandatory for every authorization-code client, the Implicit and Resource-Owner-Password grants are removed, and bearer tokens may not travel in query strings (header only) — query strings end up in logs and referrers. (oauth.net/2.1, accessed 2026-06-02.)
| Flow | Pick it when | Secret lives | Refresh strategy | |
|---|---|---|---|---|
| API key in header | Simple server-to-server, vendor issues key | env / secret store | none; rotate manually | |
| Bearer static token | Personal access token, long-lived | env / secret store | none; treat as a key | |
| OAuth2 Client Credentials | Machine-to-machine, no end user | client_id + secret | re-mint on 401; cache until expiry | |
| OAuth2 Auth-Code + PKCE | Acting on behalf of a user | refresh token | rotate on every refresh (see below) | |
| Device flow | CLI / TV / input-constrained device | refresh token | poll then rotate as auth-code |
Refresh-token rule (public clients): refresh tokens must be sender- constrained or one-time-use — rotated on every refresh, with the old one invalidated. Keep access tokens short-lived. Never log a raw token; log a partial or hash if you must correlate. (OAuth 2.0 Security BCP / RFC 9700, accessed 2026-06-02.) Full per-flow walkthroughs, token storage, and a DPoP note are in references/auth-flows.md.
Retries + backoff
Retry only transient failures, and only when the operation is safe to repeat.
| Status / error | Retry? | Note | |
|---|---|---|---|
| 429 Too Many Requests | yes | honor Retry-After (see rate limits) | |
| 502 / 503 / 504 | yes | server-side transient | |
| Connection reset / timeout / DNS | yes | network transient | |
| 400 / 401 / 403 / 404 / 409 / 422 | no | replay returns the same error — fix the call | |
| 2xx | n/a | success |
Idempotency gate. GET/PUT/DELETE are idempotent by semantics and safe to retry. POST is not — only retry it if you send a stable idempotency key so the server dedupes the duplicate. (AWS Builders' Library, accessed 2026-06-02.)
Backoff with jitter. Use delay = min(cap, base * 2^attempt) + random_jitter. The jitter is not optional: without it, every client that failed at the same instant retries at the same instant — a synchronized thundering herd that DDoSes the recovering server. Full or decorrelated jitter is preferred. Always set stop conditions: max attempts 3–5, a total deadline, and a per-attempt timeout. (AWS Builders' Library, accessed 2026-06-02.)
In Python prefer tenacity 9.1.4 (@retry with wait_exponential_jitter, stop_after_attempt, retry_if_exception_type) over a hand loop; in Node/TS use undici (the engine behind global fetch() since Node 18) with its retry interceptor. (PyPI/tenacity, nodejs/undici, accessed 2026-06-02.)
Rate limits
Do not guess the wait — the server tells you. Precedence:
- `Retry-After` present (on a 429 or 503) → wait exactly that. It is either
a number of seconds or an HTTP-date; handle both.
- No `Retry-After` → compute the wait from
X-RateLimit-Reset(a Unix epoch
or a delta-seconds, per vendor docs).
- Proactively throttle on
X-RateLimit-Remaining— slow down before you
hit zero rather than absorbing a wall of 429s. (iotools.cloud rate-limiting guidance, accessed 2026-06-02.)
For sustained pulls, gate every request through a token-bucket sized to the documented budget (e.g. 60 req/min → refill 1 token/sec, capacity 60) so bursts smooth out instead of slamming the wall.
Pagination — loop to exhaustion
There is no single best strategy; the vendor chose one and you follow it. The universal rule: loop until the API says there is no next page — never a fixed page count. A hardcoded for page in range(10) silently drops everything after page 10.
| Style | Signal of "next" | Trade-off | |
|---|---|---|---|
| Offset / page number | ?offset= / ?page= until empty page | simple; drifts on inserts, slow at depth | |
| Cursor / keyset | opaque next_cursor in body | stable under writes, fixed cost — prefer it | |
| Link header (REST) | Link: <...>; rel="next" | parse the header, follow until no next | |
| Relay (GraphQL) | pageInfo.hasNextPage + endCursor | pass endCursor as after next query |
(graphql.org/learn/pagination + pagination pattern guides, accessed 2026-06-02.)
Expose results as a generator / async-iterator so callers stream instead of buffering everything:
Full code for every style — offset, keyset, Link-header parsing, GraphQL Relay connection walking, in Python and TS, plus dedup-on-overlap notes — is in references/pagination.md.
Putting it together
A minimal connector wires all four pillars plus env config and structured logging.
Anti-patterns
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/api-connector-builder/SKILL.md
Popularity
- Repository stars
- 141
- Repository forks
- 11
- 7-day trend score
- 30
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Grok Build (Cursor)
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/ericrisco/rsc-harness/api-connector-builder)