协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
review-software-architecture【开发与工程】ソフトウェアアーキテクチャを結合度、凝集度、SOLIDの原則、APIデザイン、スケーラビリティ、 技術的負債の観点でレビューする。システムレベルの評価、アーキテクチャ決定記録のレビュー、 改善推奨事項を網羅する。実装前の提案アーキテクチャ評価、既存システムのスケーラビリティや セキュリティの評価、ADRレビュー、技術的負債の評価、または大規模な拡張に向けた 準備状況の評価に使用する。
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
システムレベルでソフトウェアアーキテクチャを品質属性、設計原則の遵守、長期的な保守性について評価する。
システムの境界とインターフェースをマッピングする:
## System Context
- **Name**: [System name]
- **Purpose**: [One-line description]
- **Users**: [Who uses it and how]
- **Scale**: [Requests/sec, data volume, user count]
- **Age**: [Years in production, major versions]
- **Team**: [Size, composition]
## External Dependencies
| Dependency | Type | Criticality | Notes |
|-----------|------|-------------|-------|
| PostgreSQL | Database | Critical | Primary data store |
| Redis | Cache | High | Session store + caching |
| Stripe | External API | Critical | Payment processing |
| S3 | Object storage | High | File uploads |
期待結果: システムが何をしているか、何に依存しているかが明確に把握できている。 失敗時: アーキテクチャドキュメントが存在しない場合は、コード構造、設定ファイル、デプロイメントファイルからコンテキストを導き出す。
モジュールがどれだけ密接に依存しているかを検査する:
# Detect circular dependencies (JavaScript/TypeScript)
npx madge --circular src/
# Detect import patterns (Python)
# Look for deep cross-package imports
grep -r "from app\." --include="*.py" | sort | uniq -c | sort -rn | head -20
各モジュールが単一で明確な責任を持っているかを評価する:
| 結合レベル | 説明 | 例 |
|---|---|---|
| 低(良好) | モジュールはインターフェースを通じて通信する | サービスAがサービスBのAPIを呼び出す |
| 中 | モジュールはデータ構造を共有する | 共有DTO/モデルライブラリ |
| 高(懸念) | モジュールが互いの内部を参照する | モジュール間での直接データベースアクセス |
| 病的 | モジュールが互いの内部状態を変更する | グローバル可変状態 |
期待結果: コードベースからの具体例を添えて結合度と凝集度が評価されている。 失敗時: コードベースが大きすぎて手動でレビューできない場合は、3〜5個の主要モジュールと最も変更頻度が高いファイルをサンプリングする。
| 原則 | 問い | 危険信号 |
|---|---|---|
| Single Responsibility(単一責任) | 各クラス/モジュールは変更する理由が一つだけか? | 無関係な懸念事項に関する5つ以上の公開メソッドを持つクラス |
| Open/Closed(開放/閉鎖) | 既存コードを変更せずに動作を拡張できるか? | 新機能のたびにコアクラスへの頻繁な変更 |
| Liskov Substitution(リスコフ置換) | サブタイプは動作を壊さずに基底型を置き換えられるか? | コンシューマーコードに散在する型チェック(instanceof) |
| Interface Segregation(インターフェース分離) | インターフェースは焦点を絞り最小限か? | コンシューマーが使用しないメソッドを実装する「太った」インターフェース |
| Dependency Inversion(依存関係逆転) | 高レベルモジュールは詳細ではなく抽象に依存しているか? | ビジネスロジック内でのインフラクラスの直接インスタンス化 |
## SOLID Assessment
| Principle | Status | Evidence | Impact |
|-----------|--------|----------|--------|
| SRP | Concern | UserService handles auth, profile, notifications, and billing | High — changes to billing risk breaking auth |
| OCP | Good | Plugin system for payment providers | Low |
| LSP | Good | No type-checking anti-patterns found | Low |
| ISP | Concern | IRepository has 15 methods, most implementors use 3-4 | Medium |
| DIP | Concern | Controllers directly instantiate database repositories | Medium |
期待結果: 少なくとも1つの具体例を添えて各原則が評価されている。 失敗時: すべての原則がすべてのアーキテクチャスタイルに同様に適用されるわけではない。ある原則があまり関連しない場合(例:関数型コードベースでのISP)は注記する。
APIを公開するシステム(REST、GraphQL、gRPC)の場合:
## API Design Review
| Aspect | Status | Notes |
|--------|--------|-------|
| Naming consistency | Good | RESTful resource naming throughout |
| Versioning | Concern | No versioning strategy — breaking changes affect all clients |
| Error format | Good | RFC 7807 Problem Details used consistently |
| Auth | Good | JWT with role-based scopes |
| Rate limiting | Missing | No rate limiting on any endpoint |
| Documentation | Concern | OpenAPI spec exists but 6 months out of date |
期待結果: 具体的な所見を添えて共通標準に対してAPIデザインがレビューされている。 失敗時: APIが公開されていない場合はこのステップをスキップし、内部モジュールインターフェースに焦点を当てる。
期待結果: 述べられた非機能要件に対してスケーラビリティと信頼性が評価されている。 失敗時: 非機能要件が文書化されていない場合は、最初のステップとしてそれらを定義することを推奨する。
## Technical Debt Inventory
| Item | Severity | Impact | Estimated Effort | Recommendation |
|------|----------|--------|-----------------|----------------|
| No database migrations | High | Schema changes are manual and error-prone | 1 sprint | Adopt Alembic/Flyway |
| Monolithic test suite | Medium | Tests take 45 min, developers skip them | 2 sprints | Split into unit/integration/e2e |
| Hardcoded config values | Medium | Environment-specific values in source code | 1 sprint | Extract to env vars/config service |
| No CI/CD pipeline | High | Manual deployment prone to errors | 1 sprint | Set up GitHub Actions |
期待結果: 深刻度、影響、作業見積もりを添えて技術的負債が目録化されている。 失敗時: 負債の目録が圧倒的な量になる場合は、影響/工数比率で上位5項目を優先する。
ADRが存在する場合、評価する:
ADRが存在しない場合は、主要な決定のためにADRを確立することを推奨する。
## Architecture Review Report
### Executive Summary
[2-3 sentences: overall health, key concerns, recommended actions]
### Strengths
1. [Specific architectural strength with evidence]
2. ...
### Concerns (by severity)
#### Critical
1. **[Title]**: [Description, impact, recommendation]
#### Major
1. **[Title]**: [Description, impact, recommendation]
#### Minor
1. **[Title]**: [Description, recommendation]
### Technical Debt Summary
[Top 5 debt items with prioritized recommendations]
### Recommended Next Steps
1. [Actionable recommendation with clear scope]
2. ...
期待結果: レビューレポートが優先順位付けされた推奨事項を含み実行可能なものである。 失敗時: レビューが時間制限されている場合は、何がカバーされ何が未評価のままか明示する。
code-reviewer を使用すること。security-audit-codebase — セキュリティ重視のコードと設定レビューconfigure-git-repository — リポジトリ構造と規則design-serialization-schema — データスキーマの設計と進化review-data-analysis — 分析的正確性のレビュー(補完的な視点)