Monorepo Manager Skill
This skill assists in maintaining a healthy and performant monorepo structure.
Capabilities
- •Dependency Graph Analysis: Visualize and understand package dependencies.
- •Task Orchestration: Run tasks (build, test, lint) efficiently across multiple packages, respecting topological order.
- •Cache Optimization: Configure and troubleshoot build caching to speed up CI/CD.
- •Workspace Integrity: Ensure version consistency for shared dependencies.
Key Concepts
- •Workspace Protocol (
workspace:*): Use this for internal dependencies to ensure the local version is always used. - •Topological Sort: Tasks must run in dependency order (e.g., build
corebeforeadapter-stockfish). - •Remote Caching: Sharing build artifacts across team members/CI (e.g., with Turborepo Remote Cache).
Best Practices Checklist
- • Consistent Dependency Versions: Use
syncpackor similar tools to keep external dependency versions aligned across packages. - • Root configuration: Keep shared configs (tsconfig, eslintrc) in the root or a dedicated
configpackage. - • Scoping: Use
--filteror similar flags to run commands only on affected packages.
Common commands (pnpm)
- •
pnpm -r --filter <package_name> <command>: Run a command in a specific package. - •
pnpm -r --filter ...[origin/main] <command>: Run command on packages changed since main. - •
pnpm install: Install dependencies for the entire workspace.
Troubleshooting
- •"Module not found": Check if the dependency is listed in
package.jsonand if the referenced workspace package is built. - •"Version mismatch": Ensure standard dependencies are using the same version to avoid multiple copies in
node_modules.