npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

xmind-testcase-generator

v1.6.1

Published

Claude Code plugin - Generate standardized XMind test case files with QA conventions (priority markers, step numbering, preconditions, granularity principles)

Readme

xmind-testcase-generator

AI 编程助手插件 — XMind 测试用例生成器

支持 Claude Code / Cursor / Windsurf / GitHub Copilot 等主流 AI 编程工具。

功能

  • 根据需求文档自动生成标准化 XMind 测试用例文件
  • 内置完整的用例编写规范(优先级、步骤编号、前置条件、粒度原则等)
  • 内置 15 条「容易遗漏的场景 Checklist」,避免用例遗漏
  • 零依赖,仅使用 Python 标准库
  • 一键安装到多个 AI 工具
  • 规则文件自动同步(SKILL.md → xmind-testcase.md)

安装

npm install -g xmind-testcase-generator

然后在项目目录下运行安装向导:

npx xmind-testcase-generator-setup
# 或
cd your-project && bash node_modules/xmind-testcase-generator/scripts/setup.sh

安装向导会让你选择要配置的工具:

请选择要安装的工具(可多选,用空格分隔):

  1) Claude Code    (.claude/ + skills/)
  2) Cursor          (.cursor/rules/)
  3) Windsurf        (.windsurfrules)
  4) GitHub Copilot  (.github/copilot-instructions.md)
  a) 全部安装

手动安装

也可以手动复制规则文件到对应位置:

| AI 工具 | 复制目标 | |---------|---------| | Claude Code | skills/write-cases/SKILL.md | | Cursor | .cursor/rules/xmind-testcase.md | | Windsurf | 追加到 .windsurfrules | | GitHub Copilot | 追加到 .github/copilot-instructions.md |

规则源文件统一在 rules/xmind-testcase.md

使用

在 AI 工具中使用

安装后,在任意 AI 编程工具的对话中直接说:

  • "根据这个需求文档写测试用例"
  • "帮我写 XX 模块的 XMind 用例"
  • "生成用例"

AI 会自动按照规范:

  1. 分析需求文档,提取功能点、交互规则、边界条件
  2. 编写 build_cases() 用例数据
  3. 执行 gen_xmind.py 生成 .xmind 文件
  4. 输出用例统计(总数、smoke 数、占比)

在 Claude Code 中使用 skill

/write-cases

独立使用脚本

# 1. 复制 gen_xmind.py 到工作目录
cp node_modules/xmind-testcase-generator/scripts/gen_xmind.py .

# 2. 修改 build_cases() 函数
# 3. 执行
python3 gen_xmind.py

用例规范摘要

| 项目 | 规范 | |------|------| | 优先级 | P1(smoke ~20%) / P3(normal ~80%),每条必标,不使用 P2 | | 步骤编号 | 1、操作步骤 → 子节点 1、预期结果 | | 前置条件 | F4 备注(note 参数),不混入步骤 | | 平台标签 | 空=全平台, ai=iOS+Android, as=Android+Server, f=FE | | 层级 | 需求→模块→子模块→(深层子tab)→测试点→步骤→预期 | | #开头 | 忽略该节点及所有子节点 |

详细规范见 skills/write-cases/SKILL.md(主文件)或 rules/xmind-testcase.md(自动生成)。

快速示例

from gen_xmind import case, sub_module, module, generate_xmind, P1, P3

def build_cases():
    sub1 = [
        case("登录功能正常", [
            ("输入正确账号密码", ""),
            ("点击登录按钮", "登录成功,跳转首页"),
        ], P1),

        case("密码错误提示", [
            ("输入正确账号和错误密码", ""),
            ("点击登录按钮", "提示'密码错误,请重试'"),
        ]),
    ]

    modules_list = [module("登录模块", [
        sub_module("基础登录", sub1),
    ])]

    return "XX需求-登录", modules_list, "XX需求_登录_用例.xmind"

文件结构

xmind-testcase-generator/
├── .claude-plugin/
│   └── plugin.json              # Claude Code 插件配置
├── .githooks/
│   └── pre-commit               # 自动同步 SKILL.md → xmind-testcase.md
├── commands/
│   └── write-cases.md           # Claude Code 斜杠命令
├── skills/
│   └── write-cases/
│       ├── SKILL.md              # 规则主文件(所有修改都在这里)
│       └── reference.md          # gen_xmind.py API 参考
├── rules/
│   └── xmind-testcase.md        # 自动生成,请勿手动编辑
├── scripts/
│   ├── gen_xmind.py              # XMind 生成脚本
│   ├── setup.sh                  # 多工具安装向导
│   ├── sync-rules.py             # SKILL.md → xmind-testcase.md 同步脚本
│   └── sync-rules.sh             # 同步脚本 shell 包装
├── package.json
├── LICENSE
└── README.md

规则文件同步机制

项目中有两份规则文件:

| 文件 | 使用者 | 说明 | |------|--------|------| | skills/write-cases/SKILL.md | Claude Code | 主文件,所有修改都在这里 | | rules/xmind-testcase.md | Cursor / Windsurf / Copilot | 自动生成,请勿手动编辑 |

工作原理:

  • clone 后执行 npm install,自动配置 git hooks(npm prepare 脚本)
  • 提交包含 SKILL.md 改动时,pre-commit hook 自动运行同步脚本
  • 同步脚本从 SKILL.md 生成 xmind-testcase.md(去掉 Claude Code 专属内容)
  • 生成的文件自动加入本次提交

手动触发同步:

npm run sync-rules

⚠️ 重要:只改 SKILL.md,不要直接改 xmind-testcase.md! 直接改会在下次同步时被覆盖。

支持的工具

| 工具 | 规则文件位置 | 安装方式 | |------|------------|---------| | Claude Code | .claude/ + skills/write-cases/SKILL.md | setup 选项 1 | | Cursor | .cursor/rules/xmind-testcase.md | setup 选项 2 | | Windsurf | .windsurfrules | setup 选项 3 | | GitHub Copilot | .github/copilot-instructions.md | setup 选项 4 |

协作开发

# 1. 克隆仓库
git clone [email protected]:testgroup/xmind-testcase-generator.git
cd xmind-testcase-generator
npm install  # 自动配置 git hooks

# 2. 创建功能分支
git checkout -b feature/你的功能描述

# 3. 修改 skills/write-cases/SKILL.md

# 4. 提交(hook 自动同步 xmind-testcase.md)
git add skills/write-cases/SKILL.md
git commit -m "feat(skill): 描述改动"

# 5. 推送并在 GitLab 创建 MR
git push origin feature/你的功能描述

依赖

  • Python 3.6+(仅标准库,无需 pip install)
  • 任意 AI 编程助手(推荐 Claude Code / Cursor)

License

MIT