Communitygithub.com

YepAPI/skills

チャットUIコンポーネント、AI SDKによるストリーミングレスポンス、コンテキストウィンドウ管理、RAGパターンを提供します。

skills とは?

このスキルは、Vercel AI SDKを使用した高度なAIチャットボット機能を提供します。クライアント側では`useChat()`フック、サーバー側では`streamText()`を活用し、`text/event-stream`形式でレスポンスをストリーミングすることで、ユーザーは応答の完全なバッファリングを待つことなく、スムーズな対話が可能です。メッセージは`{ role, content }`形式で管理され、コンテキストウィンドウが上限に近づくと最も古いメッセージをトリミングし、常にシステムプロンプトを保持する賢い管理機能を備えています。また、RAG(検索拡張生成)パターンを実装しており、ユーザークエリをベクトル検索し、トップkの結果をコンテキストとして注入することで、より正確な応答を生成します。チャットUIは自動スクロール、アニメーション読み込みインジケーター、マークダウンレンダリングに対応し、`AbortController`による生成停止機能も提供。会話履歴はサーバー側の`messages`テーブルに永続化され、YepAPIの`/v1/ai/chat`エンドポイントと統合されています。このスキルは、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 テーブルを使用
  • システムプロンプトは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をブロック — 常にストリーミング
  • メッセージをクライアント状態のみに保存 — 履歴のためにサーバーサイドで永続化
  • モデル名をハードコーディング — 環境変数または設定を使用

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.

関連スキル