Community코딩 & 개발github.com

API 설계 원칙

직관적이고 확장 가능하며 유지보수하기 쉬운 API를 설계하여 개발자에게 즐거움을 주는 REST 및 GraphQL API 설계 원칙을 마스터하세요. 새 API를 설계하거나, API 사양을 검토하거나, API 설계 표준을 수립할 때 사용하세요.

API 설계 원칙란 무엇인가요?

이 스킬은 개발자 경험을 최우선으로 하는 견고한 REST 및 GraphQL API 설계를 위한 포괄적인 가이드입니다. 리소스 중심 아키텍처와 올바른 HTTP 메서드 사용부터 스키마 우선 개발 및 실시간 업데이트를 위한 구독 기능까지 핵심 개념을 다룹니다. URL, 헤더, 쿼리 파라미터 기반의 API 버전 관리 전략을 설명하고, 세부 패턴은 `references/details.md` 파일에 제공합니다. REST(명명 규칙, 상태 코드, 페이지네이션, 속도 제한)와 GraphQL(DataLoader, 입력 검증, 커서 기반 페이지네이션) 모두에 대한 모범 사례를 제시하며, 과다/부족 페칭, 호환성 깨짐, 일관성 없는 에러 형식 등 일반적인 함정을 피하는 방법을 알려줍니다. 이 지침을 따르면 모든 개발 플랫폼에서 유지보수 가능하고 확장 가능한 API를 구축할 수 있습니다.

지원 대상~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/mianhtsys/landingMod3/tree/HEAD/MODULO_3_DESARROLLO_AL_LADO_DEL_CLIENTE_Y_SERVIDOR_WEB/architecture-skills-framework/.agents/skills/api-design-principles

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

API 설계 원칙은(는) 무엇을 하나요?

직관적이고 확장 가능하며 유지보수하기 쉬운 API를 설계하여 개발자에게 즐거움을 주고 시간이 지나도 변함없는 가치를 유지하는 REST 및 GraphQL API 설계 원칙을 마스터하세요.

이 스킬을 사용해야 할 때

  • 새로운 REST 또는 GraphQL API 설계
  • 기존 API의 사용성 개선을 위한 리팩토링
  • 팀을 위한 API 설계 표준 수립
  • 구현 전 API 사양 검토
  • API 패러다임 간 전환(REST에서 GraphQL 등)
  • 개발자 친화적인 API 문서 생성
  • 특정 사용 사례(모바일, 타사 통합)에 맞춘 API 최적화

핵심 개념

1. RESTful 설계 원칙

리소스 중심 아키텍처

  • 리소스는 명사(사용자, 주문, 제품)여야 하며 동사가 아니어야 함
  • HTTP 메서드를 동작에 사용(GET, POST, PUT, PATCH, DELETE)
  • URL은 리소스 계층 구조를 나타냄
  • 일관된 명명 규칙 사용

HTTP 메서드 의미론:

  • GET: 리소스 조회(멱등성, 안전)
  • POST: 새 리소스 생성
  • PUT: 전체 리소스 교체(멱등성)
  • PATCH: 리소스 부분 업데이트
  • DELETE: 리소스 제거(멱등성)

2. GraphQL 설계 원칙

스키마 우선 개발

  • 타입이 도메인 모델을 정의함
  • 쿼리는 데이터 읽기용
  • 뮤테이션은 데이터 수정용
  • 구독은 실시간 업데이트용

쿼리 구조:

  • 클라이언트가 필요한 것만 정확히 요청
  • 단일 엔드포인트, 다중 작업
  • 강력한 타입 시스템의 스키마
  • 내장된 인트로스펙션

3. API 버전 관리 전략

URL 기반 버전 관리:

/api/v1/users
/api/v2/users

헤더 기반 버전 관리:

Accept: application/vnd.api+json; version=1

쿼리 파라미터 기반 버전 관리:

/api/users?version=1

상세 패턴 및 작업 예제

상세 패턴 문서는 references/details.md에 있습니다. 위 탐색 계층만으로 충분하지 않을 때 해당 파일을 읽으세요.

모범 사례

REST API

  1. 일관된 명명: 컬렉션에는 복수 명사 사용(/users, /user 아님)
  2. 무상태: 각 요청에 필요한 모든 정보 포함
  3. HTTP 상태 코드 올바르게 사용: 2xx 성공, 4xx 클라이언트 오류, 5xx 서버 오류
  4. API 버전 관리: 첫날부터 호환성 깨짐 변경 사항 계획
  5. 페이지네이션: 대용량 컬렉션은 항상 페이지네이션 적용
  6. 속도 제한: 속도 제한으로 API 보호
  7. 문서화: 대화형 문서를 위해 OpenAPI/Swagger 사용

GraphQL API

  1. 스키마 우선: 리졸버를 작성하기 전에 스키마 설계
  2. N+1 문제 방지: 효율적인 데이터 페칭을 위해 DataLoader 사용
  3. 입력 검증: 스키마 및 리졸버 수준에서 검증 수행
  4. 오류 처리: 뮤테이션 페이로드에 구조화된 오류 반환
  5. 페이지네이션: 커서 기반 페이지네이션(Relay 스펙) 사용
  6. 폐기: 점진적 마이그레이션을 위해 @deprecated 지시어 사용
  7. 모니터링: 쿼리 복잡성 및 실행 시간 추적

일반적인 함정

  • 과다 페칭/부족 페칭(REST): GraphQL에서 해결되지만 DataLoader 필요
  • 호환성 깨짐 변경 사항: API 버전 관리 또는 폐기 전략 사용
  • 일관성 없는 오류 형식: 오류 응답 표준화
  • 속도 제한 누락: 제한이 없는 API는 남용에 취약
  • 부실한 문서화: 문서화되지 않은 API는 개발자를 좌절시킴
  • HTTP 의미론 무시: 멱등성 작업에 POST 사용은 기대치를 깸
  • 강한 결합: API 구조가 데이터베이스 스키마를 반영해서는 안 됨

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

mianhtsys/landingMod3

Implement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.

mianhtsys/landingMod3

Diseña y compara alternativas arquitectónicas trazables a RF/RNF sin implementar código.

mianhtsys/landingMod3

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.

mianhtsys/landingMod3

Revisión adversarial de la arquitectura contra RF/RNF, detectando contradicciones, cobertura faltante y complejidad innecesaria.

mianhtsys/landingMod3

Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.

mianhtsys/landingMod3

>- Generate grounded-and-verified, engine-agnostic database documentation that reaches 100% parity with the real schema. Introspects the LIVE database as ground truth and cross-validates it against ORM models, migrations, generated types, seeds, and application queries, then proves completeness by diffing the docs back against the database. Produces ER diagrams (mermaid), per-table data dictionaries, and a machine-readable schema.json. Works with PostgreSQL, MySQL, SQL Server, and SQLite across any ORM (Prisma, TypeORM, Drizzle, Sequelize, Knex, Django, Rails) or raw SQL. Use when asked to document a database, produce an ERD or data dictionary, write db/schema docs, audit schema drift, or refresh existing DB docs.

mianhtsys/landingMod3

Compara estrategias de persistencia y motores de datos según consistencia, concurrencia, volumen, recuperación y operación.

mianhtsys/landingMod3

Design robust, scalable database schemas for SQL and NoSQL databases. Provides normalization guidelines, indexing strategies, migration patterns, constraint design, and performance optimization. Ensures data integrity, query performance, and maintainable data models.

mianhtsys/landingMod3

Consolida análisis especializados en una recomendación arquitectónica, matriz de decisión, ADR y plan de validación.

mianhtsys/landingMod3

Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.

mianhtsys/landingMod3

Build and maintain web frontends — component architecture, state management, API integration, responsive layout, client-side performance, and frontend testing patterns. Framework agnostic, focused on web frontend implementation. Do not use for backend service implementation, data engineering, or platform infrastructure work.

mianhtsys/landingMod3

Evalúa despliegue, contenedores, escalado, alta disponibilidad, observabilidad, backup, recuperación y CI/CD de forma proporcional.

mianhtsys/landingMod3

Execute read-only SQL queries against multiple Microsoft SQL Server databases. Use when: (1) querying MSSQL/SQL Server databases, (2) exploring database schemas/tables, (3) running SELECT queries for data analysis, (4) checking database contents. Supports multiple database connections with descriptions for intelligent auto-selection. Blocks all write operations (INSERT, UPDATE, DELETE, DROP, etc.) for safety.

mianhtsys/landingMod3

Generate and maintain OpenAPI 3.1 specifications from code, design-first specs, and validation patterns. Use when creating API documentation, generating SDKs, or ensuring API contract compliance.

mianhtsys/landingMod3

PHP 8.0+ development — XAMPP, RESTful APIs, PDO/MySQL/MariaDB, and authentication. Use when building PHP backends, creating API endpoints, configuring XAMPP, or integrating PHP with databases.

mianhtsys/landingMod3

Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features

mianhtsys/landingMod3

Analiza requisitos funcionales y no funcionales, reglas, restricciones, capacidad y ambigüedades antes de seleccionar tecnologías.

mianhtsys/landingMod3

Implement modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first breakpoint strategies. Use when building adaptive interfaces, implementing fluid layouts, or creating component-level responsive behavior.

mianhtsys/landingMod3

>- Use when designing or implementing software securely: define security requirements, threat-model a feature, choose secure defaults, design authentication and authorization, handle untrusted data and secrets, evaluate dependencies, design multi-tenant trust boundaries, or review security-sensitive changes. Use for prevention during requirements, design, implementation, and review; not for post-build security assessments or scanning an existing codebase.

mianhtsys/landingMod3

Revisa seguridad arquitectónica, identidad, autorización, secretos, APIs, auditoría, fraude y resiliencia antes de implementar.

관련 스킬