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

@mango19920110/claude-cli

v1.2.0

Published

CLI tool for managing Claude Code resources (CLAUDE.md, commands, agents)

Readme

Claude CLI

CLI 工具,用于管理和复用 Claude Code 资源(CLAUDE.md、commands、agents)到多个项目中。

特性

  • 快速初始化 - 一键为项目添加 CLAUDE.md 和推荐命令
  • 灵活安装 - 按需安装单个配置文件或命令
  • 多项目复用 - 全局命令一次安装,所有项目可用
  • 模板支持 - 内置 H5、PC 模板
  • 资源分类 - 按资源类型组织(claude-md、commands、agents)
  • TypeScript - 完全使用 TypeScript 开发

安装

npm install -g @mango19920110/claude-cli

快速开始

1. 初始化新项目

# 进入项目目录
cd /path/to/your-project

# 交互式初始化(推荐)- 会提示选择项目类型
claude-cli init

# 或直接指定类型(适合脚本化场景)
claude-cli init -t <type>

2. 安装全局命令(所有项目可用)

# 安装单个命令到全局
claude-cli install <command-name> -g

# 批量安装多个命令到全局
claude-cli install <command-name1> <command-name2> -g

3. 查看可用资源

# 列出所有可用的模板和命令
claude-cli list

# 仅显示已安装的资源
claude-cli list --installed

命令详解

claude-cli init - 全量初始化

为当前项目初始化完整的 Claude Code 配置。

语法:

claude-cli init [options]

选项:

  • -t, --type <type> - 项目类型(交互式选择时可省略,使用 claude-cli list 查看所有可用类型)
  • -f, --force - 强制覆盖现有文件

示例:

# 交互式初始化(推荐)
claude-cli init

# 直接指定类型初始化
claude-cli init -t <type>

# 强制覆盖现有配置
claude-cli init -t <type> -f

安装内容:

  • ✓ CLAUDE.md 配置文件
  • ✓ .claude/commands/ 目录下的推荐命令(common + 类型特定)

claude-cli install - 按需安装

按需安装单个资源(CLAUDE.md 或命令)。

语法:

claude-cli install [resources...] [options]

选项:

  • -t, --type <type> - 项目类型(仅对 claude-md 有效,使用 claude-cli list 查看所有可用类型)
  • -g, --global - 安装到全局 ~/.claude/commands(默认:false)
  • -f, --force - 覆盖已存在的文件

交互式安装(推荐):

# 不带参数运行,进入交互式选择
claude-cli install

# 交互流程:
# 1. 选择要安装什么(CLAUDE.md 或 Commands)
# 2. 选择项目类型
# 3. 选择具体的命令(支持多选)
# 4. 选择安装位置(本地或全局)

直接安装示例:

# 只安装 CLAUDE.md(会提示选择类型)
claude-cli install claude-md

# 或直接指定类型
claude-cli install claude-md -t <type>

# 安装命令到当前项目
claude-cli install <command-name>

# 安装命令到全局
claude-cli install <command-name> -g

# 批量安装多个命令到全局
claude-cli install <command-name1> <command-name2> -g

claude-cli list - 列出资源

列出所有可用的模板和命令,以及已安装的资源。

语法:

claude-cli list [options]

选项:

  • -i, --installed - 仅显示已安装的资源

示例:

# 列出所有可用资源
claude-cli list

# 仅显示已安装的
claude-cli list --installed

使用场景

场景 1: 全新项目初始化

cd /new-project
claude-cli init

# 交互式选择项目类型后,一步到位包含:
# ✓ CLAUDE.md
# ✓ 所有推荐命令(common + 类型特定)

场景 2: 旧项目只添加 CLAUDE.md

cd /old-project
claude-cli install claude-md

# 交互式选择项目类型后,仅安装:
# ✓ CLAUDE.md

场景 3: 添加单个命令

cd /project
claude-cli install <command-name>

# 安装到:
# ✓ .claude/commands/<command-name>.md

场景 4: 安装全局命令

# 在任意目录执行
claude-cli install <command-name1> <command-name2> -g

# 安装到:
# ✓ ~/.claude/commands/<command-name1>.md
# ✓ ~/.claude/commands/<command-name2>.md

# 之后所有项目都可使用这些命令

场景 5: 团队协作

# 新同事加入项目

# 步骤1: 拉取项目代码(已包含 CLAUDE.md)
git clone <project-repo>
cd project

# 步骤2: 安装全局命令(根据团队需要选择命令)
claude-cli install <command-name1> <command-name2> -g

# 完成!可以开始开发

内置模板

CLI 工具支持多种项目模板,会自动识别 templates/claude-md/ 目录下的所有模板文件。

可用模板

使用 claude-cli list 查看所有可用模板,当前内置:

| 模板类型 | 说明 | |---------|------| | h5-vue2 | H5 移动端项目 (Vue 2) | | h5-vue3 | H5 移动端项目 (Vue 3) | | pc-vue2 | PC 管理后台项目 (Vue 2) | | pc-vue3 | PC 管理后台项目 (Vue 3) |

扩展模板

如需添加新模板,只需:

  1. templates/claude-md/ 目录下添加新的 .md 文件(如 react-ts.md
  2. (可选)在 src/utils/fileSystem.tsgetTemplateLabel() 函数中添加友好名称

CLI 工具会自动识别并显示新模板,无需修改其他代码。

可用命令

使用 claude-cli list 查看所有可用命令。

code-review

对代码进行全面审查,确保符合项目规范。

类型: Common(通用命令)

使用方式:

/code-review

FAQ

Q: init 和 install 有什么区别?

A:

  • init - 全量安装(CLAUDE.md + 所有推荐命令),适合新项目
  • install - 按需安装(可以只装 CLAUDE.md 或单个命令),更灵活

Q: 全局命令和项目命令有什么区别?

A:

  • 全局命令 (~/.claude/commands/) - 所有项目都可用,一次安装处处可用
  • 项目命令 (.claude/commands/) - 仅当前项目可用,跟随项目代码管理

Q: 如何更新已安装的配置?

A: 使用 -f--force 选项强制覆盖:

claude-cli init -f
claude-cli install claude-md -f

License

MIT