본문으로 건너뛰기
cccskills
무료GitHub에 공개

fec-api-integration

Use when designing, implementing, or reviewing frontend-to-backend API integration, typed API clients, REST/tRPC/OpenAPI client choices, auth refresh, API error mapping, upload flows, SSE/WebSocket/polling choices, CORS-facing frontend behavior, or cross-boundary loading/error states. Do not use for backend-only service architecture or TanStack Query cache policy alone; Chinese triggers include API integration, front-end and back-end joint debugging, typed API client, Interface error handling, SSE, WebSocket.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md6.0 KB
  • references/integration-patterns.md2.7 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

API integration

Suitable for front-end and back-end boundary types, errors, authentication, uploads, real-time communication and user status design. Load integration-patterns.md when specific code patterns are required.

Purpose

Standardize front-end API integration boundaries to make requests, errors, authentication, and real-time data maintainable.

Procedure

  1. Clarify interface ownership

    • For TypeScript full stack in the same team, tRPC or shared schema can be considered.
    • Multi-language or multi-consumer API preferred OpenAPI/GraphQL codegen.
    • Typed fetch wrapper can be used for small internal applications, but types must be maintained centrally.
    • Do not scatter fetch, URL, header, error parsing and token logic in components.
    • Public interfaces need to specify versions, compatibility windows, obsolete field policies, and caller scope.
  2. Establish client boundaries

    • Handle base URL, credentials, JSON parsing, timeouts, cancellation and unified errors with an API client.
    • The environment variable only reads the public prefix, and the private token does not enter the client bundle.
    • The component only consumes domain functions or query/mutation hooks, and does not directly splice interface paths.
    • 204, empty response, non-JSON error and network disconnection must have clear behavior.
    • TypeScript contracts must cover request, response, error shapes, and pagination/cursor metadata.
  3. Map user-understandable errors

    • 401: Boot login after failed refresh.
    • 403: Indicates insufficient permissions, do not retry.
    • 404: Display missing status or return to the upper level entrance.
    • 409: Prompt for conflict and next step.
    • 422: Mapping field level error.
    • 429/5xx/Network Error: Allow backoff to retry or show try again later.
    • Unrecognized errors should fall into a unified fallback, and the original backend exception should not be exposed to the user.
    • All errors should be attributed to user-recoverable actions: retry, log in again, modify input, return to the previous level, contact support, or try again later.
    • The error object should retain the log-oriented trace id / request id, but the UI should not expose the internal stack, SQL, service name or sensitive fields.
  4. Management interface evolution

    • Compatible with new fields; deleting or renaming fields must go through the migration period, adaptation layer or double-write/double-read strategy.
    • Capture breaking changes using schema, type generators or contract tests.
    • Record status codes, error codes, idempotence, retry semantics and time zone/amount/enumeration rules for front-end and back-end collaboration items.
  5. Handle authentication refresh

    • Access token has a short life cycle, and refresh is prioritized in httpOnly cookies or server sessions.
    • Only a single refresh of the queue is allowed after 401 to avoid multiple requests being refreshed at the same time.
    • If the refresh fails, you need to clear the local identity status and jump to login.
    • Do not put bearer token in URL, localStorage or logs.
  6. Select the upload and real-time plan

    • Multipart is available for small files; large files are given priority for pre-signed direct upload or multipart upload.
    • Only use SSE for server push; use WebSocket for two-way collaboration, chat or multi-person status.
    • Simple status refresh, low-frequency task progress can be polled, and stop conditions can be set.
    • Both uploads and live connections require cancellation, reconnection, timeout and error UI.
  7. Verify integration quality

    • Check loading, empty, error, unauthorized, offline, retrying status.
    • Confirm base URL, credentials, CORS, and status code behavior using the browser network panel.
    • Use mock or test services to cover 401, 403, 422, 500, disconnection and cancellation requests.
    • Verify that the client bundle does not contain private environment variables, server keys, or internal addresses.
    • Add minimal testing for key API client behaviors to demonstrate that timeouts, cancellations, error mappings, and flush queues are expected.
    • Verification error boundary cooperates with the request layer: rendering exceptions go to the Error Boundary, and request failures go to the recoverable UI, without swallowing each other.

Constraints

  • Do not manage token refresh, error format parsing, or retry strategies directly in page components.
  • No blind automatic retries for 4xx business errors.
  • Do not expose backend exception stacks, internal error codes or raw SQL/service names to users.
  • Do not use localStorage to store high-value tokens; if legacy systems cannot be avoided, security review must be linked.
  • No need to use WebSocket to replace simple polling, and no need to use polling to achieve high-frequency two-way collaboration.
  • Do not allow uploads to be forwarded through the API server for large files unless there is an explicit compliance or scanning need.
  • Do not directly expose temporary fields, database field names or backend internal error structures in the public interface.

Expected Output

The output should include API client boundaries, interface type sources, error mappings, authentication refresh policies, upload/real-time schemes, and validation results. After completion, the component will not scatter request details, the user status will be intact, failure scenarios can be recovered, and the client will not leak the server key.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Use when reviewing or improving frontend accessibility, semantic structure, keyboard support, focus management, ARIA labels, screen reader behavior, WCAG 2.2 issues, touch accessibility, or assistive-technology regressions; Chinese triggers include accessibility, accessibility, a11y, WCAG, screen reader.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

用于审查或改进前端无障碍、语义结构、键盘支持、焦点管理、ARIA 标签、屏幕阅读器行为、WCAG 2.2 问题、触控无障碍或辅助技术回归;中文触发词包括 无障碍、accessibility、a11y、WCAG、屏幕阅读器。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

Use when absorbing ideas, capabilities, workflows, architecture, quality systems, ecosystem extensions, or engineering practices from any reference system into the current project through original, project-native redesign rather than copying.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

用于从参考系统中吸收想法、能力、工作流、架构、质量体系、生态扩展或工程实践,并通过原创的项目内重设计转化为当前项目能力,而不是复制原实现。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

用于设计、实现或审查前后端 API 集成、类型化 API client、REST/tRPC/OpenAPI 客户端选型、认证刷新、API 错误映射、上传流程、SSE/WebSocket/轮询选择、CORS 相关前端行为或跨边界 loading/error 状态。不要用于纯后端服务架构或仅 TanStack Query 缓存策略;中文触发词包括 API 集成、前后端联调、typed API client、接口错误处理、SSE、WebSocket。

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

Use when frontend work needs to communicate data, action, state, permission, validation, or business-rule needs to backend teams without dictating endpoint design, field names, database shape, or implementation details; Chinese triggers include front-end and back-end requirements handover, back-end requirements, API requirements clarification, data requirements description.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

bovinphang/frontend-craft222026년 9월 26일 업데이트

bovinphang의 스킬 모두 보기

이 스킬의 문제 신고