askill
npm-scripts

npm-scriptsSafety 90Repository

npm, yarn, and pnpm package management, scripts, workspaces, and publishing. Use when user asks to "run npm script", "setup package.json", "publish package", "manage dependencies", "npm workspaces", "monorepo setup", or package manager operations.

0 stars
1.2k downloads
Updated 2/9/2026

Package Files

Loading files...
SKILL.md

npm/yarn/pnpm

Package management, scripts, and workspaces.

Package.json Scripts

Common Scripts

{
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "start": "node dist/index.js",
    "test": "vitest",
    "test:watch": "vitest watch",
    "test:coverage": "vitest --coverage",
    "lint": "eslint src/",
    "lint:fix": "eslint src/ --fix",
    "format": "prettier --write .",
    "typecheck": "tsc --noEmit",
    "prepare": "husky"
  }
}

Script Chaining

{
  "scripts": {
    "prebuild": "npm run clean",
    "build": "tsc",
    "postbuild": "npm run copy-assets",
    "clean": "rm -rf dist",
    "copy-assets": "cp -r assets dist/"
  }
}

Run Scripts in Sequence/Parallel

# Sequence (npm-run-all)
npm-run-all lint test build

# Parallel
npm-run-all --parallel lint typecheck

# Or use &&
npm run lint && npm run test

Dependency Management

Install

npm install              # All dependencies
npm install lodash       # Add dependency
npm install -D typescript  # Dev dependency
npm install -g vercel    # Global

# Specific version
npm install lodash@4.17.21
npm install lodash@^4.0.0

Update

npm update              # Update within ranges
npm update lodash       # Specific package
npx npm-check-updates   # Check for updates
npx npm-check-updates -u  # Update package.json

Remove

npm uninstall lodash
npm uninstall -g vercel

Audit

npm audit
npm audit fix
npm audit fix --force  # Breaking changes OK

Workspaces (Monorepo)

Setup

{
  "name": "my-monorepo",
  "private": true,
  "workspaces": ["packages/*"]
}

Structure

my-monorepo/
├── package.json
├── packages/
│   ├── shared/
│   │   └── package.json
│   ├── web/
│   │   └── package.json
│   └── api/
│       └── package.json

Commands

# Install all workspaces
npm install

# Run script in specific workspace
npm run build -w packages/web

# Run in all workspaces
npm run test --workspaces

# Add dep to workspace
npm install lodash -w packages/shared

pnpm

Advantages

  • Faster installs
  • Disk space efficient (hard links)
  • Strict node_modules

Commands

pnpm install
pnpm add lodash
pnpm add -D typescript
pnpm remove lodash
pnpm run dev

Workspaces

# pnpm-workspace.yaml
packages:
  - 'packages/*'
pnpm -F web run build     # Filter by name
pnpm -r run build         # All workspaces

yarn

Commands

yarn                     # Install
yarn add lodash
yarn add -D typescript
yarn remove lodash
yarn dev

Workspaces

{
  "workspaces": ["packages/*"]
}
yarn workspace web build
yarn workspaces foreach run build

Publishing

Prepare

{
  "name": "@scope/package",
  "version": "1.0.0",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "files": ["dist"],
  "repository": "github:user/repo",
  "publishConfig": {
    "access": "public"
  }
}

Publish

npm login
npm publish
npm publish --access public  # Scoped packages

# Dry run
npm publish --dry-run

Version Bump

npm version patch  # 1.0.0 -> 1.0.1
npm version minor  # 1.0.0 -> 1.1.0
npm version major  # 1.0.0 -> 2.0.0

Useful Commands

npm ls                   # List installed
npm ls lodash            # Check specific
npm outdated             # Check outdated
npm why lodash           # Why installed
npm cache clean --force  # Clear cache
npm init -y              # Quick init
npm exec -- eslint .     # Run bin
npx create-react-app     # Run without install

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

85/100Analyzed 2/19/2026

Comprehensive skill covering npm, yarn, and pnpm package management with practical examples. Includes script configuration, dependency management, monorepo/workspaces setup, and publishing workflows. Well-structured with copy-pasteable command examples. Tags and description enable discoverability. Score boosted by being in dedicated skills folder with high-density reference content.

90
85
90
70
85

Metadata

Licenseunknown
Version-
Updated2/9/2026
Publisher1Mangesh1

Tags

apici-cdgithublintingtesting