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

ai-auto-unit-tests

v0.1.0

Published

Interactive installer for an AI unit-testing workflow: Cursor skill + optional Copilot/Cloud Code repo instructions.

Readme

ai-auto-unit-tests

一个通过 npm 安装的“安装向导 + Cursor Skill + Copilot 指令文件”组合,用来让 AI 在完成编码后按策略处理单元测试。

主要功能

  • 按任务/PR 询问一次:实现/修改代码后,AI 会先问一次是否需要补单元测试并运行;同一任务后续不重复询问。
  • 四个栈优先支持
    • TypeScript:Vitest
    • Node:Jest
    • Java:JUnit 5(Maven/Gradle)
    • Python:pytest
  • 可选写入 Copilot / Cloud Code 指令:在仓库生成 .github/copilot-instructions.md,让 VS Code 体系的助手也遵循“先询问再写测试”的策略。
  • 可选写入仓库策略文件:生成 AI_TESTING_POLICY.md,作为跨工具的统一规则说明。
  • 可选安装位置
    • 个人全局(所有项目):~/.cursor/skills/auto-unit-tests
    • 当前项目(仅本项目):./.cursor/skills/auto-unit-tests

安装

方式 A:交互式安装(推荐)

在你的项目根目录执行:

npm i -D ai-auto-unit-tests

若当前终端支持交互(TTY),安装后会弹出多选菜单,让你选择要安装的目标。

如果安装时没有弹出(比如 CI、无 TTY),手动运行:

npx cursor-skill-setup

方式 B:非交互安装(适合脚本/CI)

全选安装并覆盖已有文件:

npx cursor-skill-setup --all -y

仅安装到个人全局 Cursor:

npx cursor-skill-setup --personal

仅安装到当前项目,并写入 Copilot/策略文件:

npx cursor-skill-setup --project --copilot --policy

生效方式

  • Cursor:安装后需要 重启 Cursor,skill 才会被加载。
  • Copilot / Cloud Code:只要仓库里存在 .github/copilot-instructions.md,它们就会在生成/对话时参考该指令文件(具体生效方式取决于工具版本与设置)。

使用(验证是否生效)

  1. 在 Cursor 新开一个对话,让 AI 做一个实现任务(不要提测试),例如“实现一个函数/修复一个 bug”。
  2. AI 完成实现后应 询问一次 是否需要补单元测试并运行。
  3. 你回答 YES 后,AI 会(按项目情况)安装必要测试工具、补测试、并尝试运行测试命令;失败会修到通过再继续。

常见问题

为什么安装时没弹出多选菜单?

postinstall 只会在有 TTY 的终端里尝试交互。你可以随时手动运行:

npx cursor-skill-setup

我想禁止安装时弹出交互

设置环境变量:

set CURSOR_SKILL_NO_PROMPT=1