api-integration
Skill1 starsChanged 5 months agoMITView on GitHub
Integrates with external APIs including REST, GraphQL, and webhooks. Covers authentication patterns, error handling, rate limiting, and type-safe clients.
- Reads credentials
- Sends data out
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Before integrating, use package-search MCP to ground your implementation in real source code:
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Integration
Patterns for integrating with external APIs.
Research First
Before integrating, use package-search MCP to ground your implementation in real source code:
# Find auth patterns in popular HTTP clients
package_search_hybrid("authentication headers bearer token", package="axios", registry="npm")
# See how retries are implemented
package_search_grep("retry|backoff", package="ky", registry="npm")This reduces hallucinations and ensures you're using current API patterns.
REST API Client
Basic Fetch with Types
interface ApiResponse<T> {
data: T;
error?: string;
}
async function apiClient<T>(
endpoint: string,
options: RequestInit = {}
): Promise<ApiResponse<T>> {
const baseUrl = process.env.API_BASE_URL;
try {
const response = await fetch(`${baseUrl}${endpoint}`, {
...options,
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.API_KEY}`,
...options.headers,
},
});
if (!response.ok) {
const error = await response.text();
return { data: null as T, error };
}
const data = await response.json();
return { data };
} catch (error) {
return { data: null as T, error: String(error) };
}
}Usage
interface User {
id: string;
email: string;
name: string;
}
const { data, error } = await apiClient<User>('/users/123');
if (error) {
console.error('Failed to fetch user:', error);
} else {
console.log('User:', data);
}Authentication Patterns
API Key (Header)
headers: {
'X-API-Key': process.env.API_KEY,
}Bearer Token
headers: {
'Authorization': `Bearer ${token}`,
}OAuth 2.0 Client Credentials
async function getAccessToken(): Promise<string> {
const response = await fetch('https://auth.example.com/oauth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: process.env.CLIENT_ID!,
client_secret: process.env.CLIENT_SECRET!,
}),
});
const { access_token } = await response.json();
return access_token;
}Error Handling
class ApiError extends Error {
constructor(
public status: number,
public statusText: string,
public body: unknown
) {
super(`API Error: ${status} ${statusText}`);
}
}
async function fetchWithErrorHandling<T>(url: string): Promise<T> {
const response = await fetch(url);
if (!response.ok) {
const body = await response.json().catch(() => response.text());
throw new ApiError(response.status, response.statusText, body);
}
return response.json();
}Rate Limiting
Simple Rate Limiter
class RateLimiter {
private queue: (() => Promise<void>)[] = [];
private processing = false;
private lastRequest = 0;
constructor(private minInterval: number) {}
async execute<T>(fn: () => Promise<T>): Promise<T> {
return new Promise((resolve, reject) => {
this.queue.push(async () => {
const now = Date.now();
const wait = Math.max(0, this.minInterval - (now - this.lastRequest));
await new Promise(r => setTimeout(r, wait));
this.lastRequest = Date.now();
try {
resolve(await fn());
} catch (e) {
reject(e);
}
});
this.process();
});
}
private async process() {
if (this.processing) return;
this.processing = true;
while (this.queue.length > 0) {
const fn = this.queue.shift()!;
await fn();
}
this.processing = false;
}
}
// Usage: max 2 requests per second
const limiter = new RateLimiter(500);
const data = await limiter.execute(() => fetch('/api/data'));Retry with Exponential Backoff
async function fetchWithRetry<T>(
url: string,
maxRetries = 3,
baseDelay = 1000
): Promise<T> {
for (let i = 0; i < maxRetries; i++) {
try {
const response = await fetch(url);
if (response.ok) return response.json();
// Don't retry client errors
if (response.status >= 400 && response.status < 500) {
throw new Error(`Client error: ${response.status}`);
}
} catch (error) {
if (i === maxRetries - 1) throw error;
}
// Exponential backoff with jitter
const delay = baseDelay * Math.pow(2, i) + Math.random() * 1000;
await new Promise(r => setTimeout(r, delay));
}
throw new Error('Max retries exceeded');
}Webhook Handling
import { createHmac } from 'crypto';
function verifyWebhookSignature(
payload: string,
signature: string,
secret: string
): boolean {
const expected = createHmac('sha256', secret)
.update(payload)
.digest('hex');
return signature === `sha256=${expected}`;
}
// Express handler
app.post('/webhook', express.raw({ type: '*/*' }), (req, res) => {
const signature = req.headers['x-signature'] as string;
const payload = req.body.toString();
if (!verifyWebhookSignature(payload, signature, process.env.WEBHOOK_SECRET!)) {
return res.status(401).send('Invalid signature');
}
const event = JSON.parse(payload);
// Process event...
res.status(200).send('OK');
});GraphQL Client
async function graphqlClient<T>(
query: string,
variables?: Record<string, unknown>
): Promise<T> {
const response = await fetch(process.env.GRAPHQL_ENDPOINT!, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.API_KEY}`,
},
body: JSON.stringify({ query, variables }),
});
const { data, errors } = await response.json();
if (errors) {
throw new Error(errors.map((e: { message: string }) => e.message).join(', '));
}
return data;
}Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- ShurikenTrade/shuriken-skills★ 90same name
- drewid74/ai_skills★ 8same name
- Lincoln-cn/JAgentSkillManager★ 4same name
- harrissohail6/claude-code-config★ 1same name
- shristi2211/Claude_Skills★ 1same name
- DejusDevspace/my-skills★ 0same name
- hallucinaut/skills★ 0same name
- techieharry/ToolMaster★ 0same name
- vbrevik/claude_code_skills★ 0same name
- Ztier20/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use data-analysis and code-review.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
shanggqmSkilldata-analysis
数据分析技能,提供结构化的数据查询、统计分析和报告生成工作流。当用户需要查询数据库、进行数据统计分析、生成分析报告时使用。按规范输出原始数据、计算结果、Markdown报告和HTML可视化报告。
Also in 3 projects that use this
GoogleSkillcode-review
Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.
Also in 4 projects that use this
In this repository54 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/deep-recon/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adversarial-researchSkill
- algorithmic-artSkill
- breakdownSkill
- c4-architectSkill
- canvas-designSkill
- coding-agentsSkill
- compound-engineeringSkill
- context-budgetSkill
- counterfactualSkill
- critiqueSkill
- d3js-visualizationSkill
- data-analyst-agentSkill
- database-migrationsSkill
- deep-reconSkill
- design-tasteSkill
- doc-coauthoringSkill
- e2b-sandboxSkill
- ecosystem-auditSkill
- excalidraw-diagramSkill
- executing-plansSkill
- frontend-designSkill
- fullstack-agentSkill
- grillSkill
- kickoffSkill
- mcp-builderSkill
- model-migrationSkill
- naming-the-machineSkill
- full-output-enforcementSkill
- package-researchSkill
- pdf-generationSkill
- pp2pSkill
- pp3pSkill
- prompt-engineerSkill
- prompt-groundingSkill
- redesignSkill
- requesting-code-reviewSkill
- reverse-engineer-to-learnSkill
- review-changesSkill
- scratchpadSkill
- shipSkill
- slack-gif-creatorSkill
- sprint-architectSkill
- techdebtSkill
- test-and-fixSkill
- threat-modelSkill
- verification-before-completionSkill
- visual-verdictSkill
- webapp-testingSkill
- web-asset-generatorSkill
- whatdidimissSkill
- writing-plansSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

