一键导入
api-integration-patterns
Implement robust third-party API integrations with proper authentication, error handling, and rate limiting
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Implement robust third-party API integrations with proper authentication, error handling, and rate limiting
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Design AI agents with appropriate capabilities, tools, and personas for specific software development tasks
Design RESTful APIs with proper resource modeling, HTTP methods, error handling, and clear contracts following REST principles
Document APIs comprehensively with signatures, parameters, return values, errors, and working code examples for developer reference
Apply proven architectural patterns (MVC, layered, microservices) to create maintainable systems with clear separation of concerns
Systematically reproduce, diagnose, and analyze bugs to determine root cause, assess severity, and plan fix strategy
Design and implement continuous integration and deployment pipelines with automated testing, builds, and deployments
| name | API Integration Patterns |
| description | Implement robust third-party API integrations with proper authentication, error handling, and rate limiting |
| category | integration |
| required_tools | ["Read","Write","Edit","WebSearch"] |
Build reliable integrations with external APIs, handling authentication flows, retries, rate limits, and error conditions gracefully.
import requests
from time import sleep
import logging
class APIClient:
def __init__(self, base_url, api_key):
self.base_url = base_url
self.session = requests.Session()
self.session.headers.update({
'Authorization': f'Bearer {api_key}',
'User-Agent': 'MyApp/1.0'
})
def make_request(self, method, endpoint, **kwargs):
url = f"{self.base_url}/{endpoint}"
max_retries = 3
for attempt in range(max_retries):
try:
response = self.session.request(method, url, **kwargs)
# Handle rate limiting
if response.status_code == 429:
retry_after = int(response.headers.get('Retry-After', 60))
logging.warning(f"Rate limited. Waiting {retry_after}s")
sleep(retry_after)
continue
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
if attempt == max_retries - 1:
raise
# Exponential backoff
wait = 2 ** attempt
logging.warning(f"Request failed, retrying in {wait}s: {e}")
sleep(wait)
raise Exception("Max retries exceeded")