Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

json-renderJSON render 命令行

Agent Skill

json-render 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,257

周安装

54

GitHub Stars

154

下载量

441
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:json-render(JSON render 命令行)
来源仓库:https://github.com/vercel-labs/vercel-plugin
仓库路径:skills/json-render
安装命令:
npx skills add https://github.com/vercel-labs/vercel-plugin --skill json-render
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/vercel-labs/vercel-plugin --skill json-render

简介

用于处理 GitHub 仓库、Issue 和 Pull Request 等协作信息。

  • 适合围绕代码变更或仓库状态进行信息整理。
  • 可结合来源仓库 README 进一步核验具体用法。
  • 安装前建议确认是否会触发文件读写或命令执行。
  • json-render 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

AI Chat Response Rendering

You are an expert in rendering AI SDK v6 chat responses — UIMessage parts, tool call results, streaming states, and structured data display in React applications.

The Problem

When building chat interfaces with AI SDK v6, the raw message format includes multiple part types (text, tool calls, reasoning, images). Without proper rendering, responses appear as raw JSON or malformed output.

AI SDK v6 Message Format

In v6, messages use the UIMessage type with a parts array:

interface UIMessage {
  id: string
  role: 'user' | 'assistant'
  parts: UIMessagePart[]
}

// Part types:
// - { type: 'text', text: string }
// - { type: 'tool-<toolName>', toolCallId: string, state: string, input?: unknown, output?: unknown }
//     state values: 'partial-call' | 'call' | 'output-available' | 'approval-requested' | 'approval-responded' | 'output-denied'
// - { type: 'reasoning', text: string }
// - { type: 'step-start' }  // internal, skip in rendering

Recommended: Use AI Elements

The simplest approach is to use AI Elements, which handles all part types automatically:

import { Message } from '@/components/ai-elements/message'
import { Conversation } from '@/components/ai-elements/conversation'

{messages.map((message) => (
  <Message key={message.id} message={message} />
))}

⤳ skill: ai-elements — Full component library for AI interfaces

Manual Rendering Pattern

If you need custom rendering without AI Elements, follow this pattern:

'use client'
import { useChat } from '@ai-sdk/react'
import { DefaultChatTransport } from 'ai'

export function Chat() {
  const { messages, sendMessage, status } = useChat({
    transport: new DefaultChatTransport({ api: '/api/chat' }),
  })

  const isLoading = status === 'streaming' || status === 'submitted'

  return (
    <div>
      {messages.map((message) => (
        <div key={message.id}>
          {message.parts?.map((part, i) => {
            // 1. Text parts — render as formatted text
            if (part.type === 'text' && part.text.trim()) {
              return (
                <div key={i} className={
                  message.role === 'user'
                    ? 'bg-primary text-primary-foreground rounded-lg px-3 py-2'
                    : 'bg-muted rounded-lg px-3 py-2'
                }>
                  {part.text}
                </div>
              )
            }

            // 2. Tool parts — type is "tool-<toolName>"
            if (part.type.startsWith('tool-')) {
              const toolPart = part as {
                type: string
                toolCallId: string
                state: string
                input?: unknown
                output?: unknown
              }
              const toolName = toolPart.type.replace('tool-', '')

              if (toolPart.state === 'output-available' && toolPart.output) {
                return <ToolResultCard key={i} name={toolName} output={toolPart.output} />
              }

              if (toolPart.state === 'output-denied') {
                return (
                  <div key={i} className="text-sm text-muted-foreground">
                    {toolName} was denied
                  </div>
                )
              }

              if (toolPart.state === 'approval-requested') {
                return (
                  <div key={i} className="text-sm text-yellow-500">
                    {toolName} requires approval
                  </div>
                )
              }

              return (
                <div key={i} className="text-sm text-muted-foreground animate-pulse">
                  Running {toolName}...
                </div>
              )
            }

            // 3. Reasoning parts
            if (part.type === 'reasoning') {
              return (
                <details key={i} className="text-xs text-muted-foreground">
                  <summary>Thinking...</summary>
                  <p className="whitespace-pre-wrap">{(part as { text: string }).text}</p>
                </details>
              )
            }

            // 4. Skip unknown types (step-start, etc.)
            return null
          })}
        </div>
      ))}
    </div>
  )
}

Rendering Tool Results as Cards

Instead of dumping raw JSON, render structured tool output as human-readable cards:

function ToolResultCard({ name, output }: { name: string; output: unknown }) {
  const data = output as Record<string, unknown>

  // Pattern: Check for known result shapes and render accordingly
  if (data?.success && data?.issue) {
    const issue = data.issue as { identifier?: string; title?: string }
    return (
      <div className="rounded border border-border bg-card p-2 text-sm">
        <span className="font-medium text-green-400">
          {name === 'createIssue' ? 'Created' : 'Updated'} {issue.identifier}
        </span>
        <p className="text-muted-foreground">{issue.title}</p>
      </div>
    )
  }

  if (data?.items && Array.isArray(data.items)) {
    return (
      <div className="rounded border border-border bg-card p-2 text-sm">
        <p className="font-medium">{data.items.length} results</p>
        {data.items.slice(0, 5).map((item: Record<string, unknown>, i: number) => (
          <p key={i} className="text-muted-foreground">{String(item.name || item.title || item.id)}</p>
        ))}
      </div>
    )
  }

  if (data?.error) {
    return (
      <div className="rounded border border-destructive/30 bg-destructive/10 p-2 text-sm text-destructive">
        {String(data.error)}
      </div>
    )
  }

  // Fallback: simple completion message (not raw JSON)
  return (
    <div className="rounded border border-border bg-card p-2 text-xs text-muted-foreground">
      {name} completed
    </div>
  )
}

Server-Side Requirements

The server route must use the correct v6 response format:

// app/api/chat/route.ts
import { streamText, convertToModelMessages, gateway } from 'ai'

export async function POST(req: Request) {
  const { messages } = await req.json()

  // IMPORTANT: convertToModelMessages is async in v6
  const modelMessages = await convertToModelMessages(messages)

  const result = streamText({
    model: gateway('anthropic/claude-sonnet-4.6'),
    messages: modelMessages,
  })

  // Use toUIMessageStreamResponse for chat UIs (not toDataStreamResponse)
  return result.toUIMessageStreamResponse()
}

Client-Side Requirements

import { useChat } from '@ai-sdk/react'
import { DefaultChatTransport } from 'ai'

const { messages, sendMessage, status } = useChat({
  // v6 uses transport instead of api
  transport: new DefaultChatTransport({ api: '/api/chat' }),
})

// v6 uses sendMessage instead of handleSubmit
sendMessage({ text: inputValue })

// Status values: 'ready' | 'submitted' | 'streaming'
const isLoading = status === 'streaming' || status === 'submitted'

Common Mistakes

1. Raw JSON in chat responses

Cause: Rendering message.content instead of iterating message.parts.

Fix: Always iterate message.parts and handle each type:

// WRONG — shows raw JSON
<div>{message.content}</div>

// RIGHT — renders each part type
{message.parts?.map((part, i) => {
  if (part.type === 'text') return <span key={i}>{part.text}</span>
  // ... handle other types
})}

2. Tool results showing as JSON blobs

Cause: Using JSON.stringify(output) as the display.

Fix: Create structured card components for known tool output shapes.

3. "Invalid prompt: messages do not contain..." error

Cause: Not converting UI messages to model messages on the server.

Fix: Use await convertToModelMessages(messages) — it's async in v6.

4. Messages not appearing / empty responses

Cause: Using toDataStreamResponse() instead of toUIMessageStreamResponse().

Fix: Use toUIMessageStreamResponse() when the client uses useChat with DefaultChatTransport.

5. useChat not working with v6

Cause: Using the v5 useChat({api: '/api/chat'}) pattern.

Fix: Use DefaultChatTransport:

// v5 (old)
const { messages, handleSubmit, input } = useChat({ api: '/api/chat' })

// v6 (current)
const { messages, sendMessage, status } = useChat({
  transport: new DefaultChatTransport({ api: '/api/chat' }),
})

Decision Tree

Building a chat UI with AI SDK v6?
  └─ Want pre-built components?
       └─ Yes → Use AI Elements (⤳ skill: ai-elements)
       └─ No → Manual rendering with parts iteration
            └─ Tool results look like JSON?
                 └─ Create ToolResultCard components for each tool's output shape
            └─ Text not rendering?
                 └─ Check part.type === 'text' and use part.text
            └─ Server errors?
                 └─ Check: await convertToModelMessages(), toUIMessageStreamResponse()

Server-Side Message Validation

Use validateUIMessages to validate incoming messages before processing:

import { validateUIMessages, convertToModelMessages, streamText, gateway } from 'ai'

export async function POST(req: Request) {
  const { messages } = await req.json()
  const validatedMessages = validateUIMessages(messages)
  const modelMessages = await convertToModelMessages(validatedMessages)
  // ...
}

Official Documentation

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.36%
按下载量换算152

Claude

30.87%
按下载量换算136

Cursor

19.83%
按下载量换算87

Gemini CLI

9.33%
按下载量换算41

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills