Api integration guide
Skill The-AI-Directory-Company/agents-and-skills/skills/api-integration-guide
70+ AI agent templates and 55+ skill definitions for Claude Code, Cursor, Windsurf, and other AI coding tools. Community-maintained, MIT licensed. Follows the Agent Skills specification.
npx -y skills add The-AI-Directory-Company/agents-and-skills --skill api-integration-guideAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Create REST and GraphQL integration guides covering authentication flows, pagination strategies, rate limiting, error handling, retry logic, and SDK wrapper patterns. Produces implementation-ready reference documents with code examples.
SKILL.md
6.2 KB, as published. Nobody here has run it
API Integration Guide
Before you start
Gather the following from the user:
- Which API? (Service name, base URL, documentation link)
- REST or GraphQL? (Or both)
- Authentication method? (API key, OAuth 2.0, JWT, mTLS)
- Which operations? (List the endpoints or queries/mutations needed)
- Client environment? (Server-side, browser, mobile, CLI)
- Error budget? (Acceptable failure rate, timeout thresholds)
If the user says "integrate with X API," push back: "Which specific operations do you need? I need the endpoints, auth method, and where this runs to write a useful guide."
Procedure
Step 1: Document the authentication flow
For each auth method, produce the exact sequence:
API Key: Document header name (Authorization: Bearer <key> or X-API-Key), storage (environment variable, never committed), and rotation procedure.
OAuth 2.0 (Authorization Code): Document the full redirect-exchange-refresh cycle: authorize URL with state param, code exchange at token endpoint, refresh_token storage (encrypted), and proactive refresh before expires_in.
OAuth 2.0 (Client Credentials): Document token endpoint call, cache duration (expires_in minus 60s buffer), and re-fetch on 401.
Step 2: Map each operation
For every endpoint or query, document:
Operation: [Human-readable name]
Method: [GET/POST/PUT/PATCH/DELETE] or [Query/Mutation]
Path: [/resource/:id] or [GraphQL operation name]
Request:
Headers: [Required headers beyond auth]
Params: [Path, query, or body params with types and constraints]
Body example: [JSON]
Response:
Success (2xx): [Shape with field types]
Error codes: [4xx/5xx with meaning and action]
Rate limit: [Requests per window, header names for remaining/reset]
Step 3: Design pagination handling
Document the pagination pattern the API uses and how to consume it:
- Offset-based:
GET /items?limit=100&offset=0. Stop when response count < limit or offset >= total_count. - Cursor-based:
GET /items?limit=100&cursor=<next_cursor>. Stop when next_cursor is null. - GraphQL relay: Use
pageInfo { hasNextPage endCursor }. Stop whenhasNextPageis false.
For all patterns: state the maximum page size, recommend a default, and note whether the API supports parallel page fetching safely.
Step 4: Implement rate limiting
Document the API's rate limit response and the client-side strategy:
Rate limit signal:
HTTP 429 Too Many Requests
Headers: X-RateLimit-Remaining, X-RateLimit-Reset (Unix timestamp)
Client strategy:
1. Before each request: check remaining count from last response headers.
2. If remaining < 5: sleep until reset timestamp + 1 second jitter.
3. On 429 response: read Retry-After header. Sleep for that duration.
4. If no Retry-After: exponential backoff starting at 1s, max 60s.
5. For batch operations: use a token bucket or leaky bucket limiter.
Step 5: Design error handling and retries
Classify errors and define behavior for each:
| Status | Category | Retryable | Action |
|---|---|---|---|
| 400 | Client error | No | Log payload, fix request, do not retry |
| 401 | Auth expired | Once | Refresh token, retry once |
| 403 | Forbidden | No | Log, alert, check permissions |
| 404 | Not found | No | Handle as missing resource |
| 409 | Conflict | Maybe | Re-fetch resource, resolve, retry |
| 429 | Rate limited | Yes | Backoff per rate limit strategy |
| 500 | Server error | Yes | Exponential backoff, max 3 retries |
| 502/503 | Unavailable | Yes | Exponential backoff, max 5 retries |
| Timeout | Network | Yes | Retry with same backoff as 5xx |
Retry formula: delay = min(base * 2^attempt + random_jitter_ms, max_delay)
Step 6: Write the SDK wrapper pattern
The client wrapper should encapsulate: rate limiter wait before each request, retry loop with exponential backoff, automatic token refresh on 401 (once), error classification (retryable vs terminal), and a paginate method that loops cursor-based requests until exhausted. Constructor validates base_url, credentials, timeout, and max_retries.
Quality checklist
Before delivering the integration guide, verify:
- Auth flow documents every step from credential acquisition to token refresh
- Every operation lists request shape, success response, error codes, and rate limit
- Pagination strategy handles the last page correctly and avoids infinite loops
- Rate limiting covers both proactive throttling and reactive 429 handling
- Error classification covers all common status codes with retry/no-retry decisions
- Retry logic uses exponential backoff with jitter, not fixed delays
- Credentials are never hardcoded; storage and rotation are documented
Common mistakes
- Ignoring token expiry. Caching an access token without monitoring
expires_inleads to cascading 401s. Always refresh proactively. - Retrying 400 errors. A malformed request will fail every time. Retrying wastes quota and delays error detection.
- Fixed retry delays.
sleep(5)between retries causes thundering herd when multiple clients hit rate limits simultaneously. Use exponential backoff with random jitter. - Pagination off-by-one. Forgetting to check the last page condition causes either an infinite loop or a missed final page. Test with 0, 1, and exactly-one-page result sets.
- No timeout on HTTP calls. A missing timeout means a hung connection blocks the caller indefinitely. Set connect and read timeouts explicitly.
- Swallowing error response bodies. The API often returns structured error details in the body. Log the full response, not just the status code.