[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77QBGNB1FQKB7E232ABFX7V":3,"skill-same:01M77QBGNB1FQKB7E232ABFX7V":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":14,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M77QBGNB1FQKB7E232ABFX7V","ai-sdk-5",null,"Vercel AI SDK 5 patterns. Trigger: When building AI chat features - breaking changes from v4.","janpereira-dev\u002FskillsCurate","janpereira-dev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6440548?v=4","01M6KKKXBFFK7QF5Y2JFXN35FF","Jan Pereira","01M77ND31QCT5KM25E1SW71M8F",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjanpereira-dev\u002FskillsCurate\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fai-sdk-5\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: ai-sdk-5\ndescription: >\n  Vercel AI SDK 5 patterns.\n  Trigger: When building AI chat features - breaking changes from v4.\nlicense: Apache-2.0\nmetadata:\n  author: gentleman-programming\n  version: \"1.0\"\n---\n\n## Breaking Changes from AI SDK 4\n\n```typescript\n\u002F\u002F ❌ AI SDK 4 (OLD)\nimport { useChat } from \"ai\";\nconst { messages, handleSubmit, input, handleInputChange } = useChat({\n  api: \"\u002Fapi\u002Fchat\",\n});\n\n\u002F\u002F ✅ AI SDK 5 (NEW)\nimport { useChat } from \"@ai-sdk\u002Freact\";\nimport { DefaultChatTransport } from \"ai\";\n\nconst { messages, sendMessage } = useChat({\n  transport: new DefaultChatTransport({ api: \"\u002Fapi\u002Fchat\" }),\n});\n```\n\n## Client Setup\n\n```typescript\nimport { useChat } from \"@ai-sdk\u002Freact\";\nimport { DefaultChatTransport } from \"ai\";\nimport { useState } from \"react\";\n\nexport function Chat() {\n  const [input, setInput] = useState(\"\");\n\n  const { messages, sendMessage, isLoading, error } = useChat({\n    transport: new DefaultChatTransport({ api: \"\u002Fapi\u002Fchat\" }),\n  });\n\n  const handleSubmit = (e: React.FormEvent) => {\n    e.preventDefault();\n    if (!input.trim()) return;\n    sendMessage({ text: input });\n    setInput(\"\");\n  };\n\n  return (\n    \u003Cdiv>\n      \u003Cdiv>\n        {messages.map((message) => (\n          \u003CMessage key={message.id} message={message} \u002F>\n        ))}\n      \u003C\u002Fdiv>\n\n      \u003Cform onSubmit={handleSubmit}>\n        \u003Cinput\n          value={input}\n          onChange={(e) => setInput(e.target.value)}\n          placeholder=\"Type a message...\"\n          disabled={isLoading}\n        \u002F>\n        \u003Cbutton type=\"submit\" disabled={isLoading}>\n          Send\n        \u003C\u002Fbutton>\n      \u003C\u002Fform>\n\n      {error && \u003Cdiv>Error: {error.message}\u003C\u002Fdiv>}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## UIMessage Structure (v5)\n\n```typescript\n\u002F\u002F ❌ Old: message.content was a string\n\u002F\u002F ✅ New: message.parts is an array\n\ninterface UIMessage {\n  id: string;\n  role: \"user\" | \"assistant\" | \"system\";\n  parts: MessagePart[];\n}\n\ntype MessagePart =\n  | { type: \"text\"; text: string }\n  | { type: \"image\"; image: string }\n  | { type: \"tool-call\"; toolCallId: string; toolName: string; args: unknown }\n  | { type: \"tool-result\"; toolCallId: string; result: unknown };\n\n\u002F\u002F Extract text from parts\nfunction getMessageText(message: UIMessage): string {\n  return message.parts\n    .filter((part): part is { type: \"text\"; text: string } => part.type === \"text\")\n    .map((part) => part.text)\n    .join(\"\");\n}\n\n\u002F\u002F Render message\nfunction Message({ message }: { message: UIMessage }) {\n  return (\n    \u003Cdiv className={message.role === \"user\" ? \"user\" : \"assistant\"}>\n      {message.parts.map((part, index) => {\n        if (part.type === \"text\") {\n          return \u003Cp key={index}>{part.text}\u003C\u002Fp>;\n        }\n        if (part.type === \"image\") {\n          return \u003Cimg key={index} src={part.image} alt=\"\" \u002F>;\n        }\n        return null;\n      })}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Server-Side (Route Handler)\n\n```typescript\n\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts\nimport { openai } from \"@ai-sdk\u002Fopenai\";\nimport { streamText } from \"ai\";\n\nexport async function POST(req: Request) {\n  const { messages } = await req.json();\n\n  const result = await streamText({\n    model: openai(\"gpt-4o\"),\n    messages,\n    system: \"You are a helpful assistant.\",\n  });\n\n  return result.toDataStreamResponse();\n}\n```\n\n## With LangChain\n\n```typescript\n\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts\nimport { toUIMessageStream } from \"@ai-sdk\u002Flangchain\";\nimport { ChatOpenAI } from \"@langchain\u002Fopenai\";\nimport { HumanMessage, AIMessage } from \"@langchain\u002Fcore\u002Fmessages\";\n\nexport async function POST(req: Request) {\n  const { messages } = await req.json();\n\n  const model = new ChatOpenAI({\n    modelName: \"gpt-4o\",\n    streaming: true,\n  });\n\n  \u002F\u002F Convert UI messages to LangChain format\n  const langchainMessages = messages.map((m) => {\n    const text = m.parts\n      .filter((p) => p.type === \"text\")\n      .map((p) => p.text)\n      .join(\"\");\n    return m.role === \"user\"\n      ? new HumanMessage(text)\n      : new AIMessage(text);\n  });\n\n  const stream = await model.stream(langchainMessages);\n\n  return toUIMessageStream(stream).toDataStreamResponse();\n}\n```\n\n## Streaming with Tools\n\n```typescript\nimport { openai } from \"@ai-sdk\u002Fopenai\";\nimport { streamText, tool } from \"ai\";\nimport { z } from \"zod\";\n\nconst result = await streamText({\n  model: openai(\"gpt-4o\"),\n  messages,\n  tools: {\n    getWeather: tool({\n      description: \"Get weather for a location\",\n      parameters: z.object({\n        location: z.string().describe(\"City name\"),\n      }),\n      execute: async ({ location }) => {\n        \u002F\u002F Fetch weather data\n        return { temperature: 72, condition: \"sunny\" };\n      },\n    }),\n  },\n});\n```\n\n## useCompletion (Text Generation)\n\n```typescript\nimport { useCompletion } from \"@ai-sdk\u002Freact\";\nimport { DefaultCompletionTransport } from \"ai\";\n\nconst { completion, complete, isLoading } = useCompletion({\n  transport: new DefaultCompletionTransport({ api: \"\u002Fapi\u002Fcomplete\" }),\n});\n\n\u002F\u002F Trigger completion\nawait complete(\"Write a haiku about\");\n```\n\n## Error Handling\n\n```typescript\nconst { error, messages, sendMessage } = useChat({\n  transport: new DefaultChatTransport({ api: \"\u002Fapi\u002Fchat\" }),\n  onError: (error) => {\n    console.error(\"Chat error:\", error);\n    toast.error(\"Failed to send message\");\n  },\n});\n\n\u002F\u002F Display error\n{error && (\n  \u003Cdiv className=\"error\">\n    {error.message}\n    \u003Cbutton onClick={() => sendMessage({ text: lastInput })}>\n      Retry\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n)}\n```\n\n## Keywords\nai sdk, vercel ai, chat, streaming, langchain, openai, llm\n","## Breaking Changes from AI SDK 4\n\n```typescript\n\u002F\u002F ❌ AI SDK 4 (OLD)\nimport { useChat } from \"ai\";\nconst { messages, handleSubmit, input, handleInputChange } = useChat({\n  api: \"\u002Fapi\u002Fchat\",\n});\n\n\u002F\u002F ✅ AI SDK 5 (NEW)\nimport { useChat } from \"@ai-sdk\u002Freact\";\nimport { DefaultChatTransport } from \"ai\";\n\nconst { messages, sendMessage } = useChat({\n  transport: new DefaultChatTransport({ api: \"\u002Fapi\u002Fchat\" }),\n});\n```\n\n## Client Setup\n\n```typescript\nimport { useChat } from \"@ai-sdk\u002Freact\";\nimport { DefaultChatTransport } from \"ai\";\nimport { useState } from \"react\";\n\nexport function Chat() {\n  const [input, setInput] = useState(\"\");\n\n  const { messages, sendMessage, isLoading, error } = useChat({\n    transport: new DefaultChatTransport({ api: \"\u002Fapi\u002Fchat\" }),\n  });\n\n  const handleSubmit = (e: React.FormEvent) => {\n    e.preventDefault();\n    if (!input.trim()) return;\n    sendMessage({ text: input });\n    setInput(\"\");\n  };\n\n  return (\n    \u003Cdiv>\n      \u003Cdiv>\n        {messages.map((message) => (\n          \u003CMessage key={message.id} message={message} \u002F>\n        ))}\n      \u003C\u002Fdiv>\n\n      \u003Cform onSubmit={handleSubmit}>\n        \u003Cinput\n          value={input}\n          onChange={(e) => setInput(e.target.value)}\n          placeholder=\"Type a message...\"\n          disabled={isLoading}\n        \u002F>\n        \u003Cbutton type=\"submit\" disabled={isLoading}>\n          Send\n        \u003C\u002Fbutton>\n      \u003C\u002Fform>\n\n      {error && \u003Cdiv>Error: {error.message}\u003C\u002Fdiv>}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## UIMessage Structure (v5)\n\n```typescript\n\u002F\u002F ❌ Old: message.content was a string\n\u002F\u002F ✅ New: message.parts is an array\n\ninterface UIMessage {\n  id: string;\n  role: \"user\" | \"assistant\" | \"system\";\n  parts: MessagePart[];\n}\n\ntype MessagePart =\n  | { type: \"text\"; text: string }\n  | { type: \"image\"; image: string }\n  | { type: \"tool-call\"; toolCallId: string; toolName: string; args: unknown }\n  | { type: \"tool-result\"; toolCallId: string; result: unknown };\n\n\u002F\u002F Extract text from parts\nfunction getMessageText(message: UIMessage): string {\n  return message.parts\n    .filter((part): part is { type: \"text\"; text: string } => part.type === \"text\")\n    .map((part) => part.text)\n    .join(\"\");\n}\n\n\u002F\u002F Render message\nfunction Message({ message }: { message: UIMessage }) {\n  return (\n    \u003Cdiv className={message.role === \"user\" ? \"user\" : \"assistant\"}>\n      {message.parts.map((part, index) => {\n        if (part.type === \"text\") {\n          return \u003Cp key={index}>{part.text}\u003C\u002Fp>;\n        }\n        if (part.type === \"image\") {\n          return \u003Cimg key={index} src={part.image} alt=\"\" \u002F>;\n        }\n        return null;\n      })}\n    \u003C\u002Fdiv>\n  );\n}\n```\n\n## Server-Side (Route Handler)\n\n```typescript\n\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts\nimport { openai } from \"@ai-sdk\u002Fopenai\";\nimport { streamText } from \"ai\";\n\nexport async function POST(req: Request) {\n  const { messages } = await req.json();\n\n  const result = await streamText({\n    model: openai(\"gpt-4o\"),\n    messages,\n    system: \"You are a helpful assistant.\",\n  });\n\n  return result.toDataStreamResponse();\n}\n```\n\n## With LangChain\n\n```typescript\n\u002F\u002F app\u002Fapi\u002Fchat\u002Froute.ts\nimport { toUIMessageStream } from \"@ai-sdk\u002Flangchain\";\nimport { ChatOpenAI } from \"@langchain\u002Fopenai\";\nimport { HumanMessage, AIMessage } from \"@langchain\u002Fcore\u002Fmessages\";\n\nexport async function POST(req: Request) {\n  const { messages } = await req.json();\n\n  const model = new ChatOpenAI({\n    modelName: \"gpt-4o\",\n    streaming: true,\n  });\n\n  \u002F\u002F Convert UI messages to LangChain format\n  const langchainMessages = messages.map((m) => {\n    const text = m.parts\n      .filter((p) => p.type === \"text\")\n      .map((p) => p.text)\n      .join(\"\");\n    return m.role === \"user\"\n      ? new HumanMessage(text)\n      : new AIMessage(text);\n  });\n\n  const stream = await model.stream(langchainMessages);\n\n  return toUIMessageStream(stream).toDataStreamResponse();\n}\n```\n\n## Streaming with Tools\n\n```typescript\nimport { openai } from \"@ai-sdk\u002Fopenai\";\nimport { streamText, tool } from \"ai\";\nimport { z } from \"zod\";\n\nconst result = await streamText({\n  model: openai(\"gpt-4o\"),\n  messages,\n  tools: {\n    getWeather: tool({\n      description: \"Get weather for a location\",\n      parameters: z.object({\n        location: z.string().describe(\"City name\"),\n      }),\n      execute: async ({ location }) => {\n        \u002F\u002F Fetch weather data\n        return { temperature: 72, condition: \"sunny\" };\n      },\n    }),\n  },\n});\n```\n\n## useCompletion (Text Generation)\n\n```typescript\nimport { useCompletion } from \"@ai-sdk\u002Freact\";\nimport { DefaultCompletionTransport } from \"ai\";\n\nconst { completion, complete, isLoading } = useCompletion({\n  transport: new DefaultCompletionTransport({ api: \"\u002Fapi\u002Fcomplete\" }),\n});\n\n\u002F\u002F Trigger completion\nawait complete(\"Write a haiku about\");\n```\n\n## Error Handling\n\n```typescript\nconst { error, messages, sendMessage } = useChat({\n  transport: new DefaultChatTransport({ api: \"\u002Fapi\u002Fchat\" }),\n  onError: (error) => {\n    console.error(\"Chat error:\", error);\n    toast.error(\"Failed to send message\");\n  },\n});\n\n\u002F\u002F Display error\n{error && (\n  \u003Cdiv className=\"error\">\n    {error.message}\n    \u003Cbutton onClick={() => sendMessage({ text: lastInput })}>\n      Retry\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n)}\n```\n\n## Keywords\nai sdk, vercel ai, chat, streaming, langchain, openai, llm\n",{"name":5,"license":15,"metadata":24,"description":27},{"author":25,"version":26},"gentleman-programming","1.0","Vercel AI SDK 5 patterns. Trigger: When building AI chat features - breaking changes from v4.\n","main","ba43a4e7e8b0fd6b150b14bcb48978ec40879a28",".agents\u002Fskills\u002Fai-sdk-5","https:\u002F\u002Fgithub.com\u002Fjanpereira-dev\u002FskillsCurate","https:\u002F\u002Fgithub.com\u002Fjanpereira-dev","IT Leader, Scrum Master, FullStack Developer, SEO\u002FSEM Master #Angular #React\r\n","2026-07-13 03:04:32",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add janpereira-dev\u002FskillsCurate --skill ai-sdk-5",{"tool":41,"command":42},"bunx","bunx skills add janpereira-dev\u002FskillsCurate --skill ai-sdk-5",{"tool":44,"command":45},"pnpm","pnpm dlx skills add janpereira-dev\u002FskillsCurate --skill ai-sdk-5","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjanpereira-dev\u002FskillsCurate\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fai-sdk-5\u002FSKILL.md",true,[],[50,57,64,71,79,87],{"skillNo":51,"name":52,"nameZh":6,"description":53,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M77T9KN6TEJMPPTQZDEB4K61","zustand-5","Zustand 5 state management patterns. Trigger: When managing React state with Zustand.","https:\u002F\u002Fgithub.com\u002Fjanpereira-dev\u002FskillsCurate\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzustand-5\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M77T9GN2GABPPWDGDCXJ6QWK","zod-4","Zod 4 schema validation patterns. Trigger: When using Zod for validation - breaking changes from v3.","https:\u002F\u002Fgithub.com\u002Fjanpereira-dev\u002FskillsCurate\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fzod-4\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M77T98A9R6PK155P71VX9MND","work-unit-commits","Plan commits as reviewable work units. Trigger: implementation, commit splitting, chained PRs, or keeping tests and docs with code.","https:\u002F\u002Fgithub.com\u002Fjanpereira-dev\u002FskillsCurate\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwork-unit-commits\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":75,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M77T9505TGQGWHGAYVXGE2KS","web-quality-audit","Comprehensive web quality audit covering performance, accessibility, SEO, and best practices. Use when asked to \"audit my site\", \"review web quality\", \"run lighthouse audit\", \"check page quality\", or \"optimize my website\".","MIT","https:\u002F\u002Fgithub.com\u002Fjanpereira-dev\u002FskillsCurate\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fweb-quality-audit\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":83,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M77T8YRVRNK8W4MG63XM80NK","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fjanpereira-dev\u002FskillsCurate\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fjanpereira-dev\u002FskillsCurate\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":75,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M77T8CEPQFZRRNGBYZX46P4Y","vercel-react-view-transitions","Guide for implementing smooth, native-feeling animations using React's View Transition API (`\u003CViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter\u002Fexit of components, animate list reorder, implement directional (forward\u002Fback) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.","https:\u002F\u002Fgithub.com\u002Fjanpereira-dev\u002FskillsCurate\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fvercel-react-view-transitions\u002FSKILL.md",[],[]]