AgentSkillsCN

task-type-doc-viewer

生成基于 Web 的文档查看器,方便用户在浏览器中浏览项目文档。当用户希望在网页浏览器中查看文档时,此技能便可派上用场。它会在“创建文档查看器”、“文档查看器”、“在浏览器中浏览文档”、“生成文档站点”等请求时被触发。

SKILL.md
--- frontmatter
name: task-type-doc-viewer
description: Generate a web-based documentation viewer for browsing project docs. Use when human wants to view documentation in a web browser. Triggers on requests like "create doc viewer", "documentation viewer", "browse docs in browser", "generate docs site".

Task Type: Documentation Viewer

Purpose

Generate a web-based documentation viewer for browsing project docs by:

  1. Creating a self-contained doc-viewer folder
  2. Building a Python server with auto-detection API
  3. Creating an HTML viewer with markdown and Mermaid rendering
  4. Providing usage documentation

Important Notes

Skill Prerequisite

  • If you HAVE NOT learned task-execution-guideline and task-board-management skill, please learn them first before executing this skill.

Important: If Agent DO NOT have skill capability, can directly go to .github/skills/ folder to learn skills. And SKILL.md file is the entry point to understand each skill.


Task Type Default Attributes

AttributeValue
Task TypeDocumentation Viewer
CategoryStandalone
Next Task TypeN/A
Require Human ReviewNo

Task Type Required Input Attributes

AttributeDefault Value
Auto ProceedFalse

Definition of Ready (DoR)

#CheckpointRequired
1Project has x-ipe-docs/ folder with documentationYes

Execution Flow

Execute Documentation Viewer by following these steps in order:

StepNameActionGate to Next
1Create FolderCreate doc-viewer/ directoryFolder exists
2Create ServerBuild server.py with API endpointServer file created
3Create ViewerBuild index.html with marked.js and mermaid.jsHTML file created
4Create READMEWrite usage instructionsREADME created
5TestRun server and verify docs displayServer works

⛔ BLOCKING RULES:

  • Step 5: BLOCKED until server runs and displays documentation correctly

Execution Procedure

Step 1: Create Doc-Viewer Folder Structure

Target Structure:

code
project-root/
  doc-viewer/
    index.html    # The documentation viewer web page
    server.py     # Python server with API for auto-detecting docs
    README.md     # Usage instructions

Actions:

code
1. Create `doc-viewer/` folder if not exist

Step 2: Create Python Server

Create doc-viewer/server.py with:

python
# Key features:
# - Static file serving from project root
# - /api/docs-structure endpoint that dynamically scans x-ipe-docs/ and .github/
# - No-cache headers for always showing latest content

Server Requirements:

FeatureDescription
Static FilesServe files from project root
API EndpointGET /api/docs-structure returns JSON tree
Auto-DetectionDynamically scan x-ipe-docs/ and .github/ folders
No CachingMarkdown files served with no-cache headers

Step 3: Create HTML Viewer

Create doc-viewer/index.html with:

ComponentDescription
Left SidebarNavigation tree (fetched from API)
Right SideMarkdown content display area
Markdown RenderingUse marked.js for markdown
Diagram RenderingUse mermaid.js for flowcharts, class diagrams

Step 4: Create README

Create doc-viewer/README.md with:

markdown
# Documentation Viewer

## Usage
cd doc-viewer && python3 server.py
# Open: http://localhost:8080/doc-viewer/

## Features
- Auto-detection: No manual config - just refresh to see new docs
- No caching: Always shows latest content
- Mermaid diagrams: Renders ```mermaid code blocks as interactive diagrams

Skill/Task Completion Output Attributes

This skill MUST return these attributes to the Task Data Model upon task completion:

yaml
Output:
  category: standalone
  status: completed | blocked
  next_task_type: null
  require_human_review: No
  auto_proceed: {from input Auto Proceed}
  task_output_links:
    - doc-viewer/server.py
    - doc-viewer/index.html
    - doc-viewer/README.md

Definition of Done (DoD)

#CheckpointRequired
1doc-viewer/server.py created with API endpointYes
2doc-viewer/index.html created with sidebar and markdown viewerYes
3doc-viewer/README.md created with usage instructionsYes
4Server runs and displays documentationYes

Important: After completing this skill, always return to task-execution-guideline skill to continue the task execution flow and validate the DoD defined there.


Patterns

Pattern: Basic Documentation Viewer

When: Standard project with x-ipe-docs/ folder Then:

code
1. Create doc-viewer/ folder
2. Create server.py with /api/docs-structure
3. Create index.html with marked.js and mermaid.js
4. Create README.md
5. Test by running server

Pattern: GitHub Skills Integration

When: Project uses .github/skills/ folder Then:

code
1. Extend server.py to also scan .github/skills/
2. Add skills section to navigation tree
3. Group by skill category

Pattern: Multiple Doc Folders

When: Docs split across multiple folders Then:

code
1. Configure server.py to scan all relevant folders
2. Add folder filters to API
3. Display folder groupings in sidebar

Anti-Patterns

Anti-PatternWhy BadDo Instead
Manual doc configHigh maintenanceAuto-detect from filesystem
Cache markdown filesShows stale contentUse no-cache headers
Skip mermaid.jsDiagrams won't renderAlways include mermaid.js
Embed CSS/JS inlineHard to maintainUse CDN links

Example

Request: "Create documentation viewer for my project"

Execution:

code
1. Execute Task Flow from task-execution-guideline skill

2. Create doc-viewer/ folder

3. Create server.py:
   - Serve static files from project root
   - /api/docs-structure scans x-ipe-docs/ and .github/
   - Returns JSON tree structure
   - No-cache headers for markdown

4. Create index.html:
   - Left sidebar with navigation tree
   - Right side markdown display
   - marked.js for markdown rendering
   - mermaid.js for diagram rendering

5. Create README.md:
   # Documentation Viewer
   
   ## Usage
   cd doc-viewer && python3 server.py
   # Open: http://localhost:8080/doc-viewer/

6. Test:
   $ cd doc-viewer && python3 server.py
   Server running at http://localhost:8080/doc-viewer/
   
   ✓ Navigation tree loads
   ✓ Markdown renders correctly
   ✓ Mermaid diagrams display

7. Return Task Completion Output:
   category: Standalone
   next_task_type: N/A
   require_human_review: No
   task_output_links:
     - doc-viewer/server.py
     - doc-viewer/index.html
     - doc-viewer/README.md

8. Resume Task Flow from task-execution-guideline skill