monorepo-dependency-management
モノレポ環境での依存関係管理、ワークスペース間の整合性維持を専門とするスキル。pnpm workspaces、変更影響分析、パッケージ間バージョン同期、循環依存検出の方法論を提供する。Anchors:• The Pragmatic Programmer (Andrew Hunt) / 適用: 実践的改善と品質維持 / 目的: モノレポの段階的構築と保守性向上• Program Development in Java (Barbara Liskov) / 適用: 抽象化と依存関係設計 / 目的: パッケージ間の明確な境界定義• pnpm workspace protocol / 適用: workspace:*による内部依存定義 / 目的: ワークスペース構造の標準化Trigger:Use when managing monorepo dependencies, analyzing workspace relationships, synchronizing package versions, detecting circular dependencies, or configuring pnpm workspaces.monorepo, pnpm, workspace, dependency graph, version sync, circular dependency, hoisting, turborepo
When & Why to Use This Skill
This Claude skill specializes in monorepo dependency management and workspace consistency, specifically optimized for pnpm environments. It provides comprehensive methodologies for dependency graph analysis, version synchronization using the workspace protocol, and circular dependency detection to maintain high-quality, scalable codebases. By integrating principles from 'The Pragmatic Programmer' and Liskov's design patterns, it ensures robust architectural boundaries and streamlined developer workflows.
Use Cases
- Setting up and configuring a new monorepo environment using pnpm workspaces and the workspace:* protocol.
- Analyzing complex dependency graphs to identify and resolve circular dependencies that cause build failures.
- Synchronizing package versions across multiple workspaces to prevent version mismatch and ensure environment stability.
- Optimizing dependency hoisting patterns (shamefully-hoist, public-hoist-pattern) to improve build performance and reduce disk usage.
- Conducting change impact analysis to understand how modifications in one package affect the rest of the monorepo ecosystem.
| name | monorepo-dependency-management |
|---|---|
| description | | |
| • The Pragmatic Programmer (Andrew Hunt) / 適用 | 実践的改善と品質維持 / 目的: モノレポの段階的構築と保守性向上 |
| • Program Development in Java (Barbara Liskov) / 適用 | 抽象化と依存関係設計 / 目的: パッケージ間の明確な境界定義 |
| • pnpm workspace protocol / 適用 | workspace:*による内部依存定義 / 目的: ワークスペース構造の標準化 |
モノレポ依存関係管理
概要
モノレポ環境での依存関係管理、ワークスペース間の整合性維持を専門とするスキル。 pnpm workspaces、変更影響分析、パッケージ間バージョン同期の方法論を提供する。
ワークフロー
Phase 1: ワークスペース構造の理解
目的: モノレポの現在の構造と依存関係を把握
参照エージェント: agents/dependency-analysis.md
アクション:
- pnpm-workspace.yaml の構造を確認
scripts/analyze-workspace-deps.mjsで依存グラフを可視化- 循環依存の有無を検出
- 各パッケージの役割と依存関係を整理
Phase 2: 設計と実装
目的: ワークスペース構成の最適化または新規セットアップ
参照エージェント: agents/workspace-setup.md, agents/version-sync.md
アクション:
- pnpm-workspace.yamlの設計・更新
- workspace:*プロトコルによる内部依存設定
- バージョン同期戦略の決定(カタログ機能活用)
references/pnpm-workspace-setup.mdで設定パターンを確認
Phase 3: ホイスティング最適化と検証
目的: 依存解決の最適化と構造検証
参照エージェント: agents/hoisting-optimization.md
アクション:
- shamefully-hoist設定の検討
- public-hoist-patternの設定
scripts/analyze-workspace-deps.mjsで最終検証scripts/log_usage.mjsで実行記録
リソース参照
参照ドキュメント
| ドキュメント | 内容 |
|---|---|
| references/basics.md | モノレポ基本概念、pnpm workspace基礎 |
| references/patterns.md | 依存管理パターン、設計戦略 |
| references/pnpm-workspace-setup.md | pnpm-workspace.yaml設定詳細 |
| references/change-impact-analysis.md | 変更影響分析、依存グラフ解析 |
| references/version-synchronization.md | バージョン同期戦略 |
| references/dependency-hoisting.md | ホイスティング設定最適化 |
エージェント
| エージェント | 役割 |
|---|---|
agents/dependency-analysis.md |
依存グラフ分析、循環依存検出 |
agents/workspace-setup.md |
ワークスペース初期設定 |
agents/version-sync.md |
バージョン同期管理 |
agents/hoisting-optimization.md |
ホイスティング最適化 |
スクリプト
| スクリプト | 用途 |
|---|---|
scripts/analyze-workspace-deps.mjs |
依存グラフ分析、循環依存検出 |
scripts/validate-skill.mjs |
スキル構造検証 |
scripts/log_usage.mjs |
使用記録 |
ベストプラクティス
すべきこと
- workspace:*プロトコルで内部依存を明示
- 循環依存は検出したら即座に解決
- バージョン同期はカタログ機能で自動化
- 定期的な依存グラフ分析で健全性維持
- 変更前に影響範囲を確認
避けるべきこと
- 循環依存の放置
- バージョンの不整合(共有パッケージのバージョン分散)
- 過度なホイスティング(必要に応じて制御)
- レベルをスキップした設定(基本を理解してから応用)