Skip to main content

api-integration

REST/GraphQL API client design, rate limiting, error handling, and authentication best practices

소스 정보

저장소
Hack23/riksdagsmonitor
최근 소스 활동
2026년 4월 16일 09:31
감지된 SKILL.md 언어
영어
스타
13
포크
3

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
api-integration
description
REST/GraphQL API client design, rate limiting, error handling, and authentication best practices
license
CC-BY-4.0
# API Integration Skill ## 🔴 AI FIRST Quality Principle > **Apply the AI FIRST principle: never accept first-pass quality. Minimum 2 iterations. Read all output, improve every section. No shortcuts.** ## Purpose Expert knowledge in building robust API clients with proper error handling, rate limiting, authentication, and retry logic. ## Core Principles 1. **Resilience** - Handle failures gracefully 2. **Rate Limiting** - Respect API limits 3. **Retry Logic** - Exponential backoff 4. **Circuit Breaker** - Fail fast when needed 5. **Security** - Secure credential storage ## Enforces - REST/GraphQL client patterns - Rate limiting and throttling - Retry logic with exponential backoff - Circuit breaker pattern - Error handling and recovery - Authentication (OAuth, API keys, JWT) - Request/response logging - Timeout configuration ## API Client Pattern ```javascript class APIClient { constructor(config) { this.baseUrl = config.baseUrl; this.timeout = config.timeout || 30000; this.retries = config.retries || 3; this.circuitBreaker = new CircuitBreaker(); } async request(endpoint, options = {}) { if (this.circuitBreaker.isOpen()) { throw new Error('Circuit breaker open'); } for (let attempt = 1; attempt <= this.retries; attempt++) { try { const response = await fetch( `${this.baseUrl}${endpoint}`, { ...options, timeout: this.timeout } ); if (!response.ok) { throw new APIError(response.status, response.statusText); } this.circuitBreaker.recordSuccess(); return await response.json(); } catch (error) { if (attempt === this.retries) { this.circuitBreaker.recordFailure(); throw error; } await this.delay(1000 * Math.pow(2, attempt)); } } } } ``` ## When to Use - Building API clients - Integrating external services - Handling API failures - Rate limit management - Authentication implementation ## References - [REST API Design](https://restfulapi.net/) - [Circuit Breaker Pattern](https://martinfowler.com/bliki/CircuitBreaker.html) --- **Version**: 1.0 | **Last Updated**: 2026-02-06 | **Category**: Development & Operations
GitHub에서 보기