Communitygithub.com

YepAPI/skills

채팅 UI 컴포넌트, AI SDK를 활용한 스트리밍 응답, 컨텍스트 윈도우 관리 및 RAG 패턴을 제공합니다.

skills란 무엇인가요?

이 스킬은 AI 챗봇 애플리케이션 구축을 위한 완전한 가이드를 제공합니다. Vercel AI SDK의 `useChat()` 훅과 `streamText()` 함수를 사용하여 실시간 스트리밍 응답을 구현하는 방법을 설명하며, 응답을 버퍼링하지 않고 `text/event-stream` 형식으로 전송함으로써 사용자 경험을 향상시킵니다. 또한 컨텍스트 윈도우 관리를 위해 토큰 한도에 근접하면 가장 오래된 메시지를 정리하고 시스템 프롬프트는 항상 유지하는 전략을 제시합니다. RAG(Retrieval-Augmented Generation) 패턴을 통해 사용자 쿼리를 임베딩하고 벡터 검색을 수행한 후 상위 k개의 결과를 컨텍스트로 주입하는 방법을 다룹니다. 채팅 UI는 자동 스크롤, 애니메이션 로딩 인디케이터, 마크다운 렌더링을 포함하며, 서버 측에서 메시지 기록을 `messages` 테이블에 영구 저장합니다. YepAPI의 `POST /v1/ai/chat` 엔드포인트를 사용하며, `AbortController`를 통한 생성 중단 기능도 지원합니다. 이 스킬은 Claude Code, Cursor, Codex 등 다양한 AI 에이전트 플랫폼에서 활용할 수 있습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/ai-chatbot

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

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

문서

AI 챗봇

규칙

  • Vercel AI SDK(ai 패키지)를 스트리밍에 사용 — 클라이언트에서 useChat() 훅, 서버에서 streamText() 사용
  • text/event-stream으로 응답 스트리밍 — 전체 응답을 버퍼링하지 않고 전송
  • 메시지 형식: { role: "user" | "assistant" | "system", content: string }
  • 컨텍스트 윈도우 관리: 토큰 한도에 근접하면 가장 오래된 메시지 정리, 시스템 프롬프트는 항상 유지
  • RAG 패턴: 사용자 쿼리 임베딩 → 벡터 검색 → 상위 k개 결과를 사용자 메시지 전에 컨텍스트로 주입
  • 채팅 UI: 자동 스크롤, 애니메이션 점 로딩 인디케이터, 어시스턴트 메시지에 마크다운 렌더링
  • 대화 기록은 서버 측에 저장 — chatId, role, content, createdAt 컬럼을 가진 messages 테이블 사용
  • 시스템 프롬프트는 메시지 배열의 첫 번째에 위치 — 사용자 메시지가 덮어쓰지 못하게 함
  • YepAPI 채팅 엔드포인트: POST /v1/ai/chat — { messages, model?, stream? } 형식
  • 생성 중단 버튼 — AbortController를 사용하여 진행 중인 스트림 취소

패턴

// 클라이언트 — Vercel AI SDK의 useChat
const { messages, input, handleInputChange, handleSubmit, isLoading, stop } = useChat({
  api: "/api/chat",
});
// 서버 — 스트리밍 응답
import { streamText } from "ai";

export async function POST(req: Request) {
  const { messages } = await req.json();
  const result = streamText({ model, messages });
  return result.toDataStreamResponse();
}

주의 사항

  • 전체 대화 기록을 정리하지 않고 전송하지 않음 — 컨텍스트 윈도우를 초과함
  • 전체 응답을 기다리는 동안 UI를 차단하지 않음 — 항상 스트리밍
  • 클라이언트 상태에만 메시지 저장 금지 — 서버 측에 저장하여 기록 유지
  • 모델 이름을 하드코딩하지 않음 — 환경 변수 또는 config 사용

Individual skills in this repo

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

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Layout grids, KPI cards, data tables with sorting/filtering, sidebar navigation, and responsive breakpoints.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Tenant isolation (row-level vs schema), subdomain routing, per-tenant config, and data partitioning.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

관련 스킬