supabase
Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...
configure-chatkit
This skill should be used when setting up OpenAI ChatKit in Next.js, adding domain allowlist to environment, building chat UI component, integrating with /api/chat endpoint, displaying history and tool calls visually, and integrating Better Auth session.
Full skill instructions
This skill provides guidance for integrating OpenAI ChatKit in a Next.js frontend.
Setup OpenAI ChatKit in Next.js:
Use this skill when:
# .env.local
NEXT_PUBLIC_CHAT_KIT_PUBLIC_KEY=your_chatkit_public_key
CHAT_KIT_SECRET=your_chatkit_secret_key
CHAT_KIT_INSTANCE_ID=your_instance_id
NEXT_PUBLIC_ALLOWED_DOMAINS=localhost:3000,yourdomain.com
"use client";
import { useState, useEffect, useRef } from "react";
import { useChat } from "@openai/chatkit";
import { useSession } from "better-auth/react";
interface ChatWidgetProps {
conversationId?: string;
}
export function ChatWidget({ conversationId }: ChatWidgetProps) {
const { data: session } = useSession();
const [input, setInput] = useState("");
const [isLoading, setIsLoading] = useState(false);
const messagesEndRef = useRef<HTMLDivElement>(null);
const {
messages,
sendMessage,
isLoading: chatLoading,
error
} = useChat({
apiUrl: "/api/chat",
conversationId,
auth: {
getToken: () => session?.accessToken
}
});
const handleSend = async () => {
if (!input.trim() || isLoading) return;
setIsLoading(true);
try {
await sendMessage(input);
setInput("");
} catch (err) {
console.error("Failed to send message:", err);
} finally {
setIsLoading(false);
}
};
return (
<div className="chat-container">
<div className="chat-messages">
{messages.map((msg) => (
<MessageBubble
key={msg.id}
role={msg.role}
content={msg.content}
toolCalls={msg.tool_calls}
/>
))}
<div ref={messagesEndRef} />
</div>
<div className="chat-input">
<input
value={input}
onChange={(e) => setInput(e.target.value)}
onKeyDown={(e) => e.key === "Enter" && handleSend()}
placeholder="Ask me to manage your tasks..."
disabled={isLoading}
/>
<button onClick={handleSend} disabled={isLoading}>
{isLoading ? "Sending..." : "Send"}
</button>
</div>
{error && <ErrorToast message={error.message} />}
</div>
);
}
interface MessageBubbleProps {
role: "user" | "assistant" | "tool";
content: string;
toolCalls?: ToolCall[];
}
function MessageBubble({ role, content, toolCalls }: MessageBubbleProps) {
const isUser = role === "user";
return (
<div className={`message ${isUser ? "user" : "assistant"}`}>
<div className="message-content">{content}</div>
{toolCalls && toolCalls.length > 0 && (
<div className="tool-calls">
{toolCalls.map((call) => (
<ToolCallBadge key={call.id} tool={call} />
))}
</div>
)}
</div>
);
}
function ToolCallBadge({ tool }: { tool: ToolCall }) {
return (
<div className="tool-badge">
<span className="tool-icon">🔧</span>
<span className="tool-name">{tool.name}</span>
{tool.status === "completed" && <span className="check">✓</span>}
{tool.status === "failed" && <span className="x">✗</span>}
</div>
);
}
async function sendMessage(message: string): Promise<void> {
const response = await fetch("/api/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${session?.accessToken}`
},
body: JSON.stringify({
message,
conversation_id: conversationId
})
});
if (!response.ok) {
throw new Error("Failed to send message");
}
const data = await response.json();
// Update conversation_id if new
if (!conversationId && data.conversation_id) {
setConversationId(data.conversation_id);
}
}
"use client";
import { SessionProvider } from "better-auth/react";
export function AuthProvider({ children }: { children: React.ReactNode }) {
return (
<SessionProvider>
{children}
</SessionProvider>
);
}
// In your chat component
const { data: session } = useSession();
useEffect(() => {
if (session?.accessToken) {
// Configure chat client with auth token
chatClient.setAuthToken(session.accessToken);
}
}, [session]);
.chat-container {
@apply flex flex-col h-full max-w-2xl mx-auto border rounded-lg shadow-lg;
}
.chat-messages {
@apply flex-1 overflow-y-auto p-4 space-y-4;
}
.message {
@apply p-3 rounded-lg max-w-[80%];
}
.message.user {
@apply bg-blue-500 text-white ml-auto;
}
.message.assistant {
@apply bg-gray-100 text-gray-900;
}
.chat-input {
@apply border-t p-4 flex gap-2;
}
.chat-input input {
@apply flex-1 px-4 py-2 border rounded-lg focus:outline-none focus:ring-2;
}
.chat-input button {
@apply px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600;
}
.tool-calls {
@apply mt-2 flex flex-wrap gap-2;
}
.tool-badge {
@apply inline-flex items-center gap-1 px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded;
}
.error-toast {
@apply absolute bottom-20 right-4 bg-red-500 text-white px-4 py-2 rounded-lg shadow;
}
function ErrorToast({ message }: { message: string }) {
return (
<div className="error-toast">
<span>Error: {message}</span>
<button onClick={() => clearError()}>Dismiss</button>
</div>
);
}
function LoadingIndicator() {
return (
<div className="typing-indicator">
<span></span>
<span></span>
<span></span>
</div>
);
}
Handles the full Supabase workflow from schema changes to deployment, with built-in security guardrails that catch common traps like RLS...
Comprehensive guides and best practices for Neon Serverless Postgres, covering setup, connection methods, authentication, and platform APIs.
Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.
A skill to evaluate how secure Firestore security rules are. Use this when Firestore security rules are updated to ensure that the generated rules are extremely secure and robust.
Official skill for integrating Firebase AI Logic (Gemini API) into web applications. Covers setup, multimodal inference, structured output, and security.
Complete Better Auth server and client setup with database adapters, session management, plugins, and security configuration.
Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".
Complete Cloudflare platform integration with decision trees for compute, storage, AI, networking, security, and infrastructure-as-code.
Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.
Send, read, and manage Gmail messages, drafts, labels, and account settings.
Comprehensive website auditing across 230+ rules in 21 categories including SEO, performance, security, and accessibility.
Shared authentication, CLI syntax, and output formatting patterns for gws Google Workspace commands.
Discover your celebrity doppelgänger with StarByFace!
GeoSpy: Pricing, Features, FAQs, and Alternatives for AI Teams
Detect AI-generated voices to protect against audio fraud.
Ensure Your Content's Originality with AI Plagiarism Checker
Upscale images by 400% without quality loss
Protect your social media from copyright disputes
Accurately Detect AI-Generated Content with TheChecker.AI
Chrome extension that detects and flags AI-generated content