SuperAPI AI Directory

wiki-generator

Writing & research

View repository

Updated 10-15 21:35

About this skill

Wiki Generator Skill

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

  1. The documentation root directory is fixed as .cursor/skills/wiki-generator/wiki/。
  2. All Wiki pages must be navigable from wiki/_sidebar.md .
  3. When generating or updating architecture/flow-type documents, at least 1 Mermaid diagram must be included.
  4. When generating or updating any Markdown, the end of the document must include Sources: 资料来源:, and list the code paths and key line number ranges.
  5. 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

  1. Read the base configuration:package.json、vite.config.ts(or an equivalent build configuration).
  2. Inventory the core directories and entry points: such as src/routes、src/pages、src/components、src/stores。
  3. Generate multi-page documents and establish navigation:
    • Include at least wiki/README.md and wiki/_sidebar.md
    • Split highly complex modules into second-level directories (such as wiki/Editor/Overview.md)
  4. Add Mermaid diagrams for key architecture flows.
  5. Complete Sources for each document.

Failure Conditions (FAIL)

  • Missing _sidebar.md or 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

  1. Clarify the scope: module-level or full-level.
  2. Update the corresponding Markdown against the latest code.
  3. If flows or states have changed, update the Mermaid diagrams accordingly.
  4. Update Sources accordingly.
  5. Apply navigation rules according to the type:
    • Content change: not required to update _sidebar.md
    • Structural change: must update wiki/_sidebar.md in sync, including its hierarchy, titles, and links

Completion Criteria

  • Content change: document content, Mermaid (if applicable), and Sources have been synchronized
  • Structural change: on the basis of the above,_sidebar.md has 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

  1. First read the corresponding Wiki document, then check it against the latest code.
  2. If the target module is not documented, first perform a local initialization of Workflow 1 and add the documentation.
  3. 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

  1. Determine whether the existing Wiki has become outdated due to this change.
  2. If outdated, immediately synchronize and update the corresponding documentation (including Mermaid and Sources).
  3. 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-generator is a symbolic link entry point (if present)

Prompt example

  • @[wiki-generator] 更新 SuperMagic HTML 渲染链路文档,并补齐 Sources。
  • @[wiki-generator] 新增 IframeRuntime 深入页,按二级导航挂到 SuperMagic 下。
  • @[wiki-generator] 仅修正文档措辞,不改结构。