Objectives
Consolidate the project's frontend architecture and core business knowledge into a maintainable multi-page Wiki, and keep the documentation consistent with the code after answering questions or code changes.
Global Hard Rules
- The documentation root directory is fixed as
.cursor/skills/wiki-generator/wiki/。 - All Wiki pages must be navigable from
wiki/_sidebar.md. - When generating or updating architecture/flow-type documents, at least 1 Mermaid diagram must be included.
- When generating or updating any Markdown, the end of the document must include
Sources: 资料来源:, and list the code paths and key line number ranges. - Links between documents must use relative paths.
Workflow 1: Organize and Initialize Documentation
Trigger Conditions
- When building the Wiki for the first time or when a full architecture review is requested.
Required Steps
- Read the base configuration:
package.json、vite.config.ts(or an equivalent build configuration). - Inventory the core directories and entry points: such as
src/routes、src/pages、src/components、src/stores。 - Generate multi-page documents and establish navigation:
- Include at least
wiki/README.mdandwiki/_sidebar.md - Split highly complex modules into second-level directories (such as
wiki/Editor/Overview.md)
- Include at least
- Add Mermaid diagrams for key architecture flows.
- Complete Sources for each document.
Failure Conditions (FAIL)
- Missing
_sidebar.mdor the existence of orphan pages - Architecture documents have no Mermaid diagrams
- Missing Sources
Workflow 2: Update Document Content
Trigger Conditions
- The user requests updating the documentation for a specified module or refreshing existing Wiki content.
First Determine the Change Type
- Content change: only updates to the main text, examples, explanations, diagrams, or Sources; file paths and structure remain unchanged.
- Structural change: adding/deleting/renaming/moving documents, or adding/adjusting directory levels.
Required Steps
- Clarify the scope: module-level or full-level.
- Update the corresponding Markdown against the latest code.
- If flows or states have changed, update the Mermaid diagrams accordingly.
- Update Sources accordingly.
- Apply navigation rules according to the type:
- Content change: not required to update
_sidebar.md - Structural change: must update
wiki/_sidebar.mdin sync, including its hierarchy, titles, and links
- Content change: not required to update
Completion Criteria
- Content change: document content, Mermaid (if applicable), and Sources have been synchronized
- Structural change: on the basis of the above,
_sidebar.mdhas been synchronized and links are reachable
Failure Conditions (FAIL)
- Structural change but
_sidebar.md - Sources are inconsistent with the actually referenced code
Workflow 3: Answer Team Members' Questions
Trigger Conditions
- A team member asks about a module's principles, flow, or design background.
Required Steps
- First read the corresponding Wiki document, then check it against the latest code.
- If the target module is not documented, first perform a local initialization of Workflow 1 and add the documentation.
- Answer according to a fixed structure:
- Architecture principle explanation
- Core code paths (path + key symbols)
- Notes/Suggestions
Workflow 4: Linked updates after architecture changes
Trigger conditions
- The current task modifies architectural key points such as routing, state management, core package dependencies, and cross-module call relationships.
Required steps
- Determine whether the existing Wiki has become outdated due to this change.
- If outdated, immediately synchronize and update the corresponding documentation (including Mermaid and Sources).
- In the final report, clearly state which Wiki pages have been updated in a linked manner.
Output template (for Workflow 1/2)
## 本次 Wiki 变更
- 范围:
- 变更类型:内容变更 / 结构变更
- 涉及文件:
## 导航变更
- 是否更新 `_sidebar.md`:是 / 否
- 原因:
## Sources: 资料来源:
- path/to/fileA.ts (10-80)
- path/to/fileB.tsx (1-120)
Local preview
- Startup command:
pnpm wiki - Script entry point:
bash .cursor/skills/wiki-generator/scripts/serve-wiki.sh - Compatibility notes:
.agents/skills/wiki-generatoris a symbolic link entry point (if present)
Prompt example
@[wiki-generator] 更新 SuperMagic HTML 渲染链路文档,并补齐 Sources。@[wiki-generator] 新增 IframeRuntime 深入页,按二级导航挂到 SuperMagic 下。@[wiki-generator] 仅修正文档措辞,不改结构。