npx skills add ...
npx skills add microsoft/rushstack --skill rushstack-best-practices
npx skills add microsoft/rushstack --skill rushstack-best-practices
Provides best practices and guidance for working with Rush monorepos. Use when the user is working in a Rush-based repository, asks about Rush commands (install, update, build, rebuild), needs help with project selection, dependency management, build caching, subspace configuration, or troubleshooting Rush-specific issues.
This skill provides essential best practices for working with Rush monorepos. Following these guidelines ensures efficient dependency management, optimal build performance, and proper command usage.
When encountering unclear issues or questions:
When running commands like install, update, build, rebuild, etc., by default all projects under the entire repository are processed. Use these selection flags to improve efficiency:
Select specified project and all its dependencies.
Select all dependencies of specified project, but not the project itself.
Select specified project and all its downstream dependencies.
Select projects that might be affected by specified project changes, excluding dependencies.
Similar to --impacted-by, but excludes specified project itself.
Only select specified project, completely ignore dependency relationships.
Choose the correct command tool based on different scenarios:
rush command - Execute operations affecting the entire repository or multiple projects
rushx command - Execute specific scripts for a single project
npm run or pnpm runrush-pnpm command - Replace direct use of pnpm in Rush repository
| Command | Behavior | When to Use |
|---|---|---|
rush update | Updates shrinkwrap, installs new dependencies | After cloning, after git pull, after modifying package.json |
rush install | Read-only install from existing shrinkwrap | CI/CD pipelines, ensuring version consistency |
| Command | Behavior | When to Use |
|---|---|---|
rush build | Incremental build, only changed projects | Daily development, quick validation |
rush rebuild | Clean build all projects | Complete rebuild needed, investigating issues |
Choose in rush.json:
Configure in common/config/subspaces/<subspace>/common-versions.json:
Always use Rush commands, not npm/pnpm directly:
Configure in <project>/config/rush-project.json:
Cache Behavior:
common/temp/build-cacheenableParallelismnpm, pnpm, yarn - use Rush commandsrush purge to clean environmentrush update --recheck to force dependency checkrush rebuild to skip cacherushx build output for specific errors--verbose for detailed logs--to, --from, etc.) to reduce scopeWhat is Subspace:
When to Use:
Official Websites:
Search Existing Issues:
Search these resources first when:
Ask the user for clarification when:
For expanded information on specific domains, see:
references/core-commands.md - Detailed command referencereferences/project-configuration.md - Configuration file specificationsreferences/dependency-management.md - Advanced dependency patternsreferences/build-system.md - Build optimization and cachingreferences/subspace.md - Subspace setup and usagerush build --impacted-by @my-company/my-libraryrush build --impacted-by-except @my-company/my-libraryrush build --only @my-company/my-project
rush build --impacted-by projectA --only projectB{
"pnpmVersion": "8.x.x" // Preferred - efficient, strict
// "npmVersion": "8.x.x" // Alternative
// "yarnVersion": "1.x.x" // Alternative
}{
"preferredVersions": {
"react": "17.0.2",
"typescript": "~4.5.0"
},
"implicitlyPreferredVersions": true,
"allowedAlternativeVersions": {
"typescript": ["~4.5.0", "~4.6.0"]
}
}rush add -p lodash --dev # Add dev dependency
rush add -p react --exact # Add exact version
rush remove -p lodash # Remove dependency{
"operationSettings": [
{
"operationName": "build",
"outputFolderNames": ["lib", "dist"],
"disableBuildCacheForOperation": false,
"dependsOnEnvVars": ["MY_ENV_VAR"]
}
]
}