api-integrator
БесплатноБез исполняемых скриптовНе проверенIntegrate external REST and GraphQL APIs with proper authentication (Bearer, Basic, OAuth), error handling, retry logic, and JSON schema validation. Use when…
от diegosouzapw★ 68 звёзд на GitHubОб этом скилле
API Integrator
Purpose
Robust patterns for integrating external APIs and databases with authentication, error handling, retry logic, and response validation.
When to Use
- Making REST or GraphQL API calls
- Querying databases
- Integrating external services (Stripe, Twilio, AWS, etc.)
- Need robust error handling and retry logic
- Require response schema validation
- Bulk API operations
Core Instructions
REST API Pattern
import requests
from tenacity import retry, stop_after_attempt, wait_exponential
@retry(
stop=stop_after_attempt(3),
wait=wait_exponential(multiplier=1, min=1, max=10)
)
def call_api(endpoint, method="GET", headers=None, data=None):
"""
Make API call with retries
"""
if not headers:
headers = {}
# Auto-add auth from environment
if os.getenv('API_TOKEN'):
headers["Authorization"] = f"Bearer {os.getenv('API_TOKEN')}"
response = requests.request(
method=method,
url=endpoint,
headers=headers,
json=data,
timeout=30
)
response.raise_for_status()
return response.json()
Error Handling Strategy
- 2xx Success: Return data
- 4xx Client Error: Log and raise (no retry - client's fault)
- 5xx Server Error: Retry with exponential backoff
- Timeout: Retry up to 3 times
- Network Error: Retry with backoff
Authentication Methods
Bearer Token:
headers = {"Authorization": f"Bearer {token}"}
Basic Auth:
from requests.auth import HTTPBasicAuth
auth = HTTPBasicAuth('username', 'password')
response = requests.get(url, auth=auth)
OAuth 2.0:
from requests_oauthlib import OAuth2Session
oauth = OAuth2Session(client_id, token=token)
response = oauth.get(url)
GraphQL Pattern
def call_graphql(endpoint, query, variables=None):
"""
Execute GraphQL query
"""
payload = {
'query': query,
'variables': variables or {}
}
return call_api(endpoint, method='POST', data=payload)
Response Validation
from pydantic import BaseModel, ValidationError
class APIResponse(BaseModel):
id: int
name: str
email: str
def validate_response(data):
try:
return APIResponse(**data)
except ValidationError as e:
# Handle validation errors
log_error(e)
raise
Integration Examples
Example 1: GitHub API
# Get user info
response = call_api('https://api.github.com/users/github')
print(f"GitHub created: {response['created_at']}")
Example 2: Stripe Payment
import stripe
stripe.api_key = os.getenv('STRIPE_KEY')
# Create payment intent
intent = stripe.PaymentIntent.create(
amount=1000,
currency='usd'
)
Example 3: Database Query (PostgreSQL)
import psycopg2
conn = psycopg2.connect(
host=os.getenv('DB_HOST'),
database=os.getenv('DB_NAME'),
user=os.getenv('DB_USER'),
password=os.getenv('DB_PASSWORD')
)
cursor = conn.cursor()
cursor.execute("SELECT * FROM users WHERE active = true")
results = cursor.fetchall()
Best Practices
- Use Environment Variables: Store credentials in
.env, never hardcode - Implement Retries: Use
tenacityfor automatic retry with backoff - Validate Responses: Use Pydantic or JSON Schema
- Handle Rate Limits: Respect API rate limits, implement backoff
- Log Requests: Log all API calls for debugging
- Timeout Properly: Always set request timeouts (default: 30s)
Performance
- 10-30x cost reduction vs calling LLM for each API operation
- < 100ms overhead for request/retry logic
- 95%+ success rate with proper retry strategy
Dependencies
- Python 3.8+
requests- HTTP librarytenacity- Retry logicpydantic- Response validation (optional)requests-oauthlib- OAuth support (optional)
Version
v1.0.0 (2025-10-23)
Установить api-integrator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл api-integrator?
Integrate external REST and GraphQL APIs with proper authentication (Bearer, Basic, OAuth), error handling, retry logic, and JSON schema validation. Use when making API calls, database queries, or integrating external services like Stripe, Twilio, AWS. Achieves 10-30x cost savings through direct execution vs LLM-based calls. Triggers on "API call", "REST API", "GraphQL", "external service", "API integration", "HTTP request".
Как установить скилл api-integrator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-integrator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic