文档站工坊 · Docs Site Builder
Turn any folder of source material into a professional Fumadocs documentation
website and deploy it to
https://{product-id}.example.com/docs
.
A code repo and a folder of articles are the same thing: a folder of source
material. There is one unified flow, not separate modes. The difference is only
in what each file contributes — code becomes explained API/usage docs; an article
becomes a presented page; an image becomes embedded media.
The core idea: read the folder one unit at a time and incrementally refine the
docs. Don't read everything then write everything. Each file you ingest updates
the evolving outline and fills in or improves pages — including earlier ones. This
scales past the context window and produces a coherent, deduplicated result.
User Configuration
Defaults are portable. Base domain is
; subdomain is the product id.
Deploy delegates to
(reads
).
See
references/user-config.md
.
When to Use
- "用 fumadocs 给这个项目生成文档站并部署到 xxx.example.com/docs"
- "把这个装满文章和图片的文件夹整理成一个文档网站"
- A code repo, an article collection, or a mixed knowledge folder needs a polished,
navigable, image-rich docs site
Workflow (MANDATORY — follow in order)
Step 0: Resolve skill root
bash
export SKILL_DIR="${SKILL_DIR:-$(pwd)}" # or the installed lov-repo2docs dir
If any network command times out in the sandbox, export the proxy once:
bash
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891
Step 1: Collect inputs with AskUserQuestion
Use BEFORE doing anything, unless the user already gave all:
- Source: GitHub URL, local folder path, or current directory?
- Product id: the subdomain → . Propose a slug from
the folder/repo name; confirm.
- Title: human-facing name for the docs.
- Deploy now?: deploy to Vercel + bind subdomain immediately, or generate only.
Step 2: Resolve the source folder
| Source | Action |
|---|
| GitHub URL | git clone --depth 1 <url> <tmp>/src
|
| Local path | use as-is (read-only) |
| Current dir | use |
Never write into the source folder. The docs site is a separate directory.
Step 3: Inventory the folder
Build a manifest of every file, classified and ordered (overview material first):
bash
python3 "$SKILL_DIR/scripts/inventory.py" --src "<src>" --out /tmp/manifest.json
The manifest lists
(path, kind ∈ article/code/image/pdf/office/data/other,
title guess, reading
) and
. This is cheap — it does NOT read full
contents. You read contents later, incrementally. Use
to gauge scale and
to decide whether to delegate batches to subagents (see Step 5 scaling note).
Step 4: Scaffold the Fumadocs site
bash
python3 "$SKILL_DIR/scripts/scaffold_docs.py" \
--product-id "<id>" --out "<docs-out-dir>" --title "<Title>" --pm pnpm
Sets
and resets
to a placeholder. See
for layout, the
double-prefix gotcha, and
components.
Step 5: Copy images into the site
bash
python3 "$SKILL_DIR/scripts/copy_assets.py" \
--src "<src>" --site "<docs-out-dir>" --out /tmp/assets-map.json
This copies (and, if Pillow is present, downsizes/transcodes HEIC/TIFF/BMP) every
image into
and returns a
{source-path: /assets/...}
map.
Reference images in MDX with the
root-relative web path from the map
(
) — with basePath
, Next resolves it to
automatically.
Step 6: Incremental authoring loop (the core)
Initialize the outline from the folder's top-level structure — by default,
preserve the source directory hierarchy as the sidebar (a folder → a sidebar
group, its
). Then walk
in
and, for each unit:
- Read the unit (the file contents).
- Place it in the evolving outline: a new page, a section of an existing
page, or merged into a group index. Update the relevant .
- Write or refine the MDX page:
- For articles/notes/PDF/office: present the content as a real page —
preserve the author's substance; clean up formatting; embed its images via
the assets map; if a folder holds many images, render a gallery/grid.
- For code: write explained docs — purpose, install, usage, public API,
examples — derived from the code, README, and comments. Don't dump source.
- For images with no surrounding article: group them into a gallery page
for their folder.
- Refine backward: as later units add context, improve earlier pages, the
intro, cross-links, and sidebar order. The structure is emergent and
incrementally polished, not one-shot.
Quality bar: a
professional, polished site — coherent IA, working internal
links, real content (never lorem ipsum), inviting landing page, images that render
crisply. Use Fumadocs components (
,
,
,
,
/gallery) per
.
Scaling note (large folders): when
is large, delegate batches to
subagents (Explore / general-purpose). Give each a slice of
+ the assets
map; have it return structured page contributions and outline deltas (which group,
which order). The main thread owns and merges the evolving IA so the result stays
coherent. Don't let subagents each invent a separate top-level structure.
Step 7: Verify the build locally
bash
cd "<docs-out-dir>" && pnpm build # must succeed — fix MDX/link/image errors
Step 8: Deploy (if requested)
Delegate to
— do NOT reimplement Vercel/DNS here.
Ensure
"name" is a valid lowercase slug, then deploy with domain
. The site serves at
via the basePath. After
deploy,
verify the live URL returns 200 (curl), not just that the alias was set.
CLI Reference
— enumerate + classify a folder:
| Argument | Default | Description |
|---|
| (required) | Source folder |
| stdout | Manifest JSON path |
| | Skip title-reading files larger than this |
| Argument | Default | Description |
|---|
| (required) | Source folder |
| (required) | Fumadocs site root |
| | Downscale wider images (needs Pillow) |
| off | Copy verbatim, never transcode/resize |
| stdout | Asset path-map JSON |
| Argument | Default | Description |
|---|
| (required) | Slug → |
| (required) | Output dir (separate from source) |
| | Human-facing title |
| | Package manager |
Dependencies
- Node.js 18+, , , Python 3.8+
- Optional: Pillow () for image optimization
- Vercel CLI () for deploy
- skill (Vercel + Cloudflare DNS)
For Fumadocs structure, components, and config, see
.
Runtime context (shared)
运行前读取本 Skill 包的
,由宿主提供
上下文。字段解析顺序为:当前请求、项目上下文、个人 Preferences、品牌 Profile、通用默认值。
- 只使用 Manifest 声明的字段;Profile 保存公开品牌事实,Preferences 保存个人工作偏好。
- 字段缺失时,按 Manifest 的问题配置向用户提出一个聚焦问题;用户明确同意后再保存回答。
- 报错提供可复制的 、字段路径与来源,诊断内容避开秘密、完整私人路径和原始配置。
通用反馈闭环
用户在 Skill 驱动任务中提出修改意见时,继续当前产物前必须执行:
- 先判断意见是 (仅本次)还是 (可跨任务复用)。
- 只修改当前任务,不改 Skill。
- 先确定作用域:领域规则先更新对应 canonical Skill;适用于所有 Skill 的规则先更新共享规范。
- 完成规则更新、版本、lint 与分发核验后,再把修改应用到当前任务。
- 修改会使此前的“确认”“继续”“发吧”失效;完成当前产物修改和回读后必须停下,等待用户下一步指示,不自动进入发布、提交或其他外部写入。