Pm Preview logo

Pm Preview

Community
konglong87
pm-preview

产品文档实时预览 - 在浏览器中预览 docs/ 下的所有 MD 文档,文档更新时自动刷新 Use when: 需要预览产品文档、查看 PRD/BRD/MRD 等 MD 文档的渲染效果 Do NOT use when: 文档尚未生成(docs/ 为空)

Overview

Publisherkonglong87
RepositorysuperPM
Skill namepm-preview
Stars
86
Forks
8
Bundled files
5
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 5 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by konglong87 on GitHub. Read the source before you install it.

Installation

Install the Pm Preview AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/konglong87/superPM/tree/main/skills/pm-preview
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/konglong87/superPM.git /tmp/superPM
mkdir -p .claude/skills
cp -r /tmp/superPM/skills/pm-preview .claude/skills/pm-preview
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Pm Preview in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Pm Preview on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Pm Preview is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Preamble (run first)

bash
# 检查 docs/ 目录和文档数量
echo "📊 文档预览状态:"
echo ""

if [ ! -d docs ]; then
  echo "  ❌ docs/ 目录不存在"
  echo "  💡 请先执行产品流程(/pm-brainstorm → /pm-demand → ... → /pm-docs)生成文档"
  exit 0
fi

total=0
for prefix in "01-需求调研" "02-方案设计" "03-增长迭代" "04-风控管理" "05-产品战略"; do
  count=$(ls docs/$prefix/*.md 2>/dev/null | wc -l | tr -d ' ')
  if [ "$count" -gt 0 ]; then
    echo "  $prefix: $count 个文档"
    total=$((total + count))
  fi
done

# 递归统计所有 .md 文件
all=$(find docs -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
echo ""
echo "  📄 总计: $all 个 MD 文档"
echo ""

if [ "$all" -eq 0 ]; then
  echo "  ❌ 没有找到任何文档"
  echo "  💡 请先执行产品流程生成文档"
fi

执行流程

步骤 1: 启动预览服务器

先从已加载的本 skill 路径确定其绝对目录(单独安装时不在项目的 skills/ 目录内),再使用 Bash 启动:

bash
bash "<当前 pm-preview skill 所在目录>/scripts/start-preview.sh" --project-dir .

说明:

  • 服务器在随机高端口启动(49152-65535)
  • 使用 --project-dir . 将 session 持久化到 .superpm/preview/,服务器停止后文件保留;验收完毕后应删除不再需要的 session
  • 后台运行,不阻塞终端

输出示例:

json
{"type":"server-started","port":52341,"url":"http://localhost:52341","docs_dir":"/path/to/docs","state_dir":"/path/to/.superpm/preview/..."}

步骤 2: 告知用户打开预览

从输出中提取 url 字段,告知用户:

📄 文档预览已启动!

🌐 预览地址: {url}

在浏览器中打开上述地址,即可查看所有产品文档。

  • 左侧边栏:文档目录树
  • 右侧内容区:Markdown 渲染结果
  • 📝 文档更新时浏览器会自动刷新

步骤 3: 监控状态(可选)

如果用户需要持续预览,可以提醒:

💡 提示:

  • 预览服务器 30 分钟无活动后自动停止
  • 如需手动停止,执行:bash "<当前 pm-preview skill 所在目录>/scripts/stop-preview.sh" .superpm/preview/{session_id}
  • 执行其他 skill(如 /pm-docs)生成新文档后,浏览器会自动刷新

停止预览

用户可通过以下方式停止:

bash
# 查找 session 目录
ls -d .superpm/preview/*/

# 停止服务器
bash "<当前 pm-preview skill 所在目录>/scripts/stop-preview.sh" .superpm/preview/{session_id}

功能特性

特性说明
实时刷新文档更新时通过 WebSocket 自动推送刷新
侧边栏导航按目录分组展示所有文档,支持折叠/展开
Markdown 渲染浏览器端渲染,支持表格、代码块、流程图
亮/暗主题跟随操作系统主题自动切换
零依赖仅使用 Node.js 内置模块,无需 npm install
自动清理30 分钟无活动自动停止,/tmp 下临时文件自动删除

注意事项

  1. 首次使用:确保 docs/ 目录下有至少一个 .md 文件
  2. 浏览器兼容:需要支持 WebSocket 的现代浏览器(Chrome/Firefox/Safari/Edge)
  3. 网络要求:Markdown 渲染和 HTML 清理库随 skill 本地提供,预览不依赖 CDN;需要本地 Node.js
  4. 端口冲突:如果随机端口被占用,服务器会自动使用其他端口
  5. 多会话:每次启动创建独立 session,可同时运行多个预览实例

常见误区 / Red Flags — STOP

误区正确做法
文档还没生成就启动预览先执行产品流程生成文档,再启动预览
预览服务器启动失败时放弃尝试 --foreground 模式查看错误信息
手动修改文档后期望即时刷新文档更新后服务器有 100ms 防抖延迟

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Pm Preview AI skill do?

产品文档实时预览 - 在浏览器中预览 docs/ 下的所有 MD 文档,文档更新时自动刷新 Use when: 需要预览产品文档、查看 PRD/BRD/MRD 等 MD 文档的渲染效果 Do NOT use when: 文档尚未生成(docs/ 为空)

Why use Pm Preview on TypingMind?

Because you install it once and use it with any model. Pm Preview is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Pm Preview in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/konglong87/superPM/tree/main/skills/pm-preview. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Pm Preview?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Pm Preview?

As many as you like. As long as a model supports skills, you can use Pm Preview with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Pm Preview AI skill free?

Yes. It is published on GitHub by konglong87 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇