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.
npx skills add https://github.com/microsoft/rushstack --skill rushstack-best-practices
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.
rush build --to @my-company/my-project
rush build --to my-project # If project name is unique
rush build --to . # Use current directory's project
Select all dependencies of specified project, but not the project itself.
rush build --to-except @my-company/my-project
Select specified project and all its downstream dependencies.
rush build --from @my-company/my-library
Select projects that might be affected by specified project changes, excluding dependencies.
rush build --impacted-by @my-company/my-library
Similar to --impacted-by, but excludes specified project itself.
rush build --impacted-by-except @my-company/my-library
Only select specified project, completely ignore dependency relationships.
rush build --only @my-company/my-project
rush build --impacted-by projectA --only projectB
Choose the correct command tool based on different scenarios:
rush command - Execute operations affecting the entire repository or multiple projectsrushx command - Execute specific scripts for a single projectnpm 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:
{
"pnpmVersion": "8.x.x" // Preferred - efficient, strict
// "npmVersion": "8.x.x" // Alternative
// "yarnVersion": "1.x.x" // Alternative
}
Configure in common/config/subspaces/<subspace>/common-versions.json:
{
"preferredVersions": {
"react": "17.0.2",
"typescript": "~4.5.0"
},
"implicitlyPreferredVersions": true,
"allowedAlternativeVersions": {
"typescript": ["~4.5.0", "~4.6.0"]
}
}
Always use Rush commands, not npm/pnpm directly:
rush add -p lodash --dev # Add dev dependency
rush add -p react --exact # Add exact version
rush remove -p lodash # Remove dependency
Configure in <project>/config/rush-project.json:
{
"operationSettings": [
{
"operationName": "build",
"outputFolderNames": ["lib", "dist"],
"disableBuildCacheForOperation": false,
"dependsOnEnvVars": ["MY_ENV_VAR"]
}
]
}
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 usageGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take microsoft/rushstack-best-practices from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.