Node.js Development Setup Skill
Purpose
Quickly set up and verify a Node.js/TypeScript development environment with all necessary tooling.
Workflow
Quick Setup Checklist
- ✅ Verify Node.js 18+ and npm 9+
- ✅ Detect package manager (npm/yarn/pnpm)
- ✅ Install dependencies
- ✅ Verify package.json scripts
- ✅ Setup ESLint
- ✅ Setup Prettier
- ✅ Setup TypeScript (if applicable)
- ✅ Setup Testing (Jest/Vitest)
- ✅ Setup Git hooks (Husky + lint-staged)
- ✅ Verify build
- ✅ Run quality checks
- ✅ Test execution
For detailed step-by-step instructions with commands and troubleshooting, see references/DETAILED-WORKFLOW.md.
Common Node.js Commands Reference
Package Management
npm install <package> # Install package
npm install -D <package> # Install as dev dependency
npm install -g <package> # Install globally
npm uninstall <package> # Remove package
npm update # Update all packages
npm outdated # Check for outdated packages
npm audit # Security audit
npm audit fix # Auto-fix vulnerabilities
Project Commands
npm run dev # Development server
npm run build # Production build
npm test # Run tests
npm run lint # Lint code
npm run format # Format code
Yarn Equivalents
yarn add <package> # Install package
yarn add -D <package> # Install as dev dependency
yarn remove <package> # Remove package
yarn upgrade # Update all packages
yarn audit # Security audit
Troubleshooting
Issue: "npm: command not found"
Solution: Node.js not installed
# macOS
brew install node
# Or use nvm (recommended)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install node
Issue: "Cannot find module 'X'"
Solution: Dependencies not installed
rm -rf node_modules package-lock.json
npm install
Issue: "EACCES: permission denied"
Solution: Global npm permissions issue
# Fix npm permissions (recommended)
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
# Add to ~/.bashrc or ~/.zshrc
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
Issue: "TypeScript errors in node_modules"
Solution: Skip library checking
// tsconfig.json
{
"compilerOptions": {
"skipLibCheck": true
}
}
Issue: "ESLint and Prettier conflicts"
Solution: Install eslint-config-prettier
npm install --save-dev eslint-config-prettier
Add to .eslintrc.js:
extends: [
// ... other configs
'prettier', // Must be last
],
Best Practices
- Use Node version manager (nvm) - Easily switch Node versions
- Lock dependency versions - Commit package-lock.json
- Separate dev dependencies - Use --save-dev for tooling
- Enable TypeScript strict mode - Catch more errors
- Configure ESLint + Prettier - Consistent code style
- Use git hooks - Automate checks with Husky
- Target 90%+ coverage - Comprehensive testing
- Regular security audits - Run
npm auditfrequently
Integration with Other Skills
This skill may be invoked by:
quality-check- When checking Node.js code qualityrun-tests- When running Node.js tests