ni

fohte's avatarfrom fohte

Use ni (@antfu/ni) for package manager operations. Use this skill when installing dependencies, running scripts, or executing packages in JavaScript/TypeScript projects.

⭐1stars🔀0forks📁View on GitHub🕐Updated Jan 4, 2026

When & Why to Use This Skill

The ni skill streamlines JavaScript and TypeScript development by providing package manager agnostic commands. By automatically detecting the project's lockfile, it allows developers to install dependencies, run scripts, and manage packages using a unified syntax across npm, yarn, pnpm, and bun, significantly improving workflow efficiency and reducing command-line friction.

Use Cases

  • Scenario 1: Seamlessly managing dependencies in multi-repo environments where different projects use different package managers like pnpm, yarn, or npm without switching syntax.
  • Scenario 2: Running project-specific scripts such as 'build', 'test', or 'lint' using the 'nr' command, ensuring the correct manager is used for the current context.
  • Scenario 3: Quickly adding, updating, or removing packages and devDependencies using consistent 'ni', 'nu', and 'nun' commands across any JS/TS codebase.
  • Scenario 4: Executing one-off packages or binaries using 'nlx' (the agnostic equivalent of npx) for tasks like code formatting, linting, or scaffolding.
nameni
descriptionUse ni (@antfu/ni) for package manager operations. Use this skill when installing dependencies, running scripts, or executing packages in JavaScript/TypeScript projects.

ni - Package Manager Agnostic Commands

JavaScript/TypeScript プロジェクトでパッケージマネージャー操作を行う際は、npm, yarn, pnpm, bun などを直接使用せず、@antfu/ni のコマンドを使用すること。

ni はプロジェクトの lockfile を自動検出し、適切なパッケージマネージャーコマンドに変換する。

コマンド対応表

ni コマンド 用途 npm 相当
ni 依存関係のインストール npm install
ni <pkg> パッケージ追加 npm install <pkg>
ni -D <pkg> devDependencies に追加 npm install -D <pkg>
nr <script> スクリプト実行 npm run <script>
nlx <pkg> パッケージ実行 npx <pkg>
nu 依存関係の更新 npm update
nun <pkg> パッケージ削除 npm uninstall <pkg>
nci クリーンインストール npm ci

使用例

# 依存関係をインストール
ni

# パッケージを追加
ni axios

# devDependencies に追加
ni -D typescript @types/node

# スクリプト実行
nr build
nr test
nr lint

# npx 相当
nlx eslint --fix .
nlx prettier --write .

# パッケージ削除
nun lodash

# クリーンインストール
nci

注意事項

  • ni は mise でグローバルインストール済み (config/mise/home-config.toml)
  • lockfile が存在しないプロジェクトでは、ni はデフォルトで npm を使用する
  • nr でスクリプトを実行する際、引数は -- なしでそのまま渡せる