Docs Diagrams 标志

Docs Diagrams

组织热门
vercel
docs-diagrams

Draw diagrams for the Next.js docs in the style of the ones already published there: the light/dark PNGs an mdx references with `<Image srcLight="/docs/light/<name>.png" srcDark="/docs/dark/<name>.png">`. Use when a guide or API reference needs a new diagram or an existing one needs a change. Hand-written SVG from a primitives library, rendered by headless Chrome at 2x. No AI image generation.

Add to TypingMind

概览

发布者vercel
代码仓库next.js
技能名称docs-diagrams
星标数
143.1K
复刻数
34.7K
附带文件
6
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 6 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 vercel 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Docs Diagrams AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/vercel/next.js/tree/canary/.agents/skills/docs-diagrams
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vercel/next.js.git /tmp/next.js
mkdir -p .claude/skills
cp -r /tmp/next.js/.agents/skills/docs-diagrams .claude/skills/docs-diagrams
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Docs Diagrams,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Docs Diagrams。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Docs Diagrams 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Docs diagrams

Use the diagrams already published in the docs as references. They share a faint grid background, bordered panels with soft shadows, gray skeleton UI, gray arrows, and a small accent palette in which each color has a consistent meaning. This skill reproduces that visual language from code.

Files

TaskRead
Colors, sizes, fonts, what each color means, shape anatomystyle-tokens.md
Reviewing a render before handing it offreview-checklist.md
Primitives: canvas, panels, tree rows, windows, holes, badgesscripts/lib.mjs
Generate SVG + HTML for every diagram modulescripts/gen.mjs
Screenshot light + dark PNGs at 2xscripts/render.sh
Measure a render's margins from the inkscripts/measure.py

Workflow

1. Read the mdx

The <Image> block gives you the file names (srcLight="/docs/light/<name>.png"), the width and height the page reserves, and the alt text, which is the brief.

The paragraph before the image often states the color legend in words ("gray marks static output and blue marks content that can render at request time"). When it does, the drawing has to match that sentence exactly. When it does not, take the states the alt text names (a Suspense fallback, request-time content), map them with "What the colors mean" in style-tokens.md, and suggest adding the legend sentence to the mdx in your hand-off.

Draw only what the brief names. The alt text and surrounding paragraph determine which values, rows, and labels appear. Use the labels from the alt text and docs/01-app/04-glossary.mdx for terminology the brief leaves open.

2. Pull references from the docs

The images are not in this repo; they are served from the docs blob store. List what exists and fetch two or three that explain something similar, in both themes, before drawing:

bash
grep -rhoE 'srcLight="[^"]+"' docs | sort -u
curl -sL -o ref.png "https://h8DxKfmAPhn8O0p3.public.blob.vercel-storage.com/docs/light/nested-layouts.png"

Use the full srcLight path: most images live under /docs/, some under /learn/. Swap light for dark for the dark variant. If the page you are drawing for already has images, those are the first references. Look at more than one: the anatomy is consistent, and you want the shared parts rather than one image's quirks. Published files are a mix of 1x and 2x; that is history, not a target. Always produce 2x.

3. Write a diagram module

Copy scripts/ into a scratch folder outside the repo and add diagrams/<name>.mjs:

js
export default {
  name: 'my-diagram', // must equal the mdx srcLight basename
  width: 1600, // what the mdx declares
  height: 700,
  draw(t, lib, { width, height }) {
    const k = width / 1600
    const s = []
    // compose lib primitives here, laid out from a few named constants
    return s.join('\n')
  },
}

lib.mjs has the shapes the docs are built from:

  • Panels and rows: panel, treePanel, urlPill, urlStack, codePanel.
  • Arrows and captions: arrow, bracketArrow, bracketCaption, callout.
  • Browser windows: browserWindow(t, x, y, w, h, url, body = '') for the frame, pageLayout for the page inside it, postCard and commentRows for the content, skel.* for single placeholders. Pass the URL and body as positional arguments.
  • States and comparisons: hole (not rendered yet), card (rendered or highlighted), grid (columns and spans for bars).
  • Badges and legends: badge, statusBadge, legendRow, swatchLegend.
  • Text: label, code, textWidth for sizing a block around a label, and the icons.

Build a window's page with pageLayout rather than placing skeleton atoms by hand. It carries the spacing that makes placeholders read as a page, and returns regions.post and regions.comments for the usual split of the content column.

When the brief describes moments or stages (before and after, Shell → Prefetch → Navigation), the docs show them as a row of browser windows with arrows between them, each window showing the page at that moment. Content that has rendered at one moment stays rendered, in the same style, in every later moment. When values or APIs need comparing across the moments, bar rows go underneath, split at the gaps between the windows. grid lays out those bars; its column headers sit under the windows and double as their captions (the comment on grid says how to line the two up). Use grid on its own when windows would add nothing.

Lay the block out from named constants and center it on the canvas. When a diagram needs a shape lib does not have, add it to lib.mjs using the existing tokens, in the same style, so the next diagram gets it too. Never hard-code a color or a one-off offset inside a shape.

A module may export an array of diagrams when several share a drawing. Helper modules without a default export are skipped.

4. Render

Run ./render.sh from inside the scratch folder. It runs node gen.mjs and screenshots each <name>-<theme>.html with headless Chrome at --force-device-scale-factor=2. Output lands in light/<name>.png and dark/<name>.png, the names the mdx expects. node gen.mjs <name> regenerates one diagram while iterating.

The script defaults to the macOS Google Chrome path. On Linux, Windows, or a machine with Chrome installed elsewhere, set CHROME to the browser executable:

bash
CHROME=/path/to/chrome ./render.sh

5. Review

Look at both PNGs at full size, against review-checklist.md and against the references from step 2. Run python3 scripts/measure.py light/<name>.png for the margins. Fix in constants and re-render. Do not hand off a PNG you have not looked at.

6. Hand off

Deliver the PNGs with their pixel dimensions and the mdx path each one matches. Uploading to the blob store is a manual step by the docs maintainer, so the PNGs are the deliverable, not a commit. Check that the mdx srcLight basename and the PNG name agree, including singular vs plural. If you added a primitive to lib.mjs, commit it back into this skill, or hand off the diff if you cannot commit.

What the docs typically draw

The published diagrams are combinations of a few shapes. These are the common kinds, each with a page where you can see it. There are more, and a new concept may need a new combination.

  • File tree → URL: a file-tree panel (folder, file, layout and route icons; the row the page is about is bold with a blue dot; elided children are a gray ... row) with gray arrows to URL pills (globe + path, gray-filled when the path is not routable), bracket arrows beside the tree for which layout wraps which routes, and mono status badges (Routable, Not Routable). See Layouts and Pages and Project structure.
  • Files → component hierarchy: a file list with an arrow to a code panel (React logo and a title in the bar, nested JSX in the docs' syntax colors). See Project structure.
  • Browser window with skeleton UI: traffic lights and a URL pill, the page as gray skeleton shapes (avatar, bars, sidebar, image placeholders). Content that has not rendered yet is a dashed hole; content that has arrived or is the subject is a solid accent card, sometimes floated outside the window with a blue arrow. A row of windows with arrows between them shows a sequence; bracket captions underneath name the groups. See Fetching Data and Caching.
  • Region map with badges: a window whose regions are outlined and tinted by category, each tagged with a letter badge, with callouts on leader lines and a legend. The same badges tag rows in a tree and lines in a code panel so the views cross-reference. See Parallel Routes.
  • Zone graph: dashed, color-coded boxes with a tag in the corner, mono route pills inside, gray arrows between them labelled with mono pills (SOFT NAV, HARD NAV). See Multi-zones.

Some docs images are product screenshots (DevTools panels, the bundle analyzer, OS dialogs). Capture those from the real UI; this skill does not draw them.

Conventions

Canvas. The docs canvas is 1600 CSS px wide and the page scales it to the column, so the sizes in the tokens are sizes at 1600. For a new diagram, declare 1600 and let the height follow the content. If a page already declares a narrower width, match it and scale element sizes by k = width / 1600, otherwise the picture renders larger than its neighbours once the page scales it. grid, swatchLegend, arrow, pageLayout, postCard and commentRows take or derive k and scale their defaults by it; pass × k sizes to skel.*, hole and card yourself.

Margins. The mdx height wins: fit the content to the declared box. Top must equal bottom and left must equal right, within 4px; the two pairs need not match each other. Measure from the ink with scripts/measure.py, not from the coordinates you passed: text drawn with dominant-baseline="central" has its visual top about 0.35 × size above its y, and textWidth is a heuristic, so expect to nudge by a few px after measuring.

Color. Within one picture a color means exactly one thing in the bars and the legend; if the legend says blue is "request-time content", nothing else may be blue. In the windows, rendered UI is always gray skeleton, whatever the bars say gray means; that is the docs' convention. Blue in a window marks the one state the picture is about (not included in static output, or newly rendered), the same state blue marks in the bars. See "What the colors mean" in style-tokens.md.

Alignment. Equal margins, shared edges, text centered in its box, arrows and splits lined up vertically through the whole diagram. This is the review bar.

Type. Code and routes in Geist Mono, everything else in Inter. Geist Mono must be installed locally; the fallback is ui-monospace.

Related skills

  • $write-guide and $write-api-reference produce the mdx that references these images.
  • $update-docs for finding which docs pages a code change touches.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Docs Diagrams AI 技能有什么作用?

Draw diagrams for the Next.js docs in the style of the ones already published there: the light/dark PNGs an mdx references with `<Image srcLight="/docs/light/<name>.png" srcDark="/docs/dark/<name>.png">`. Use when a guide or API reference needs a new diagram or an existing one needs a change. Hand-written SVG from a primitives library, rendered by headless Chrome at 2x. No AI image generation.

为什么在 TypingMind 中使用 Docs Diagrams?

因为您只需安装一次,就能搭配任何模型使用。Docs Diagrams 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Docs Diagrams?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/vercel/next.js/tree/canary/.agents/skills/docs-diagrams。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Docs Diagrams?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Docs Diagrams 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Docs Diagrams 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Docs Diagrams AI 技能免费吗?

是的。vercel 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇