software-architecture-skill
このスキルを使用せずに設計・実装を開始してはいけません。以下のいずれかに該当する場合、必ず最初にこのスキルを呼び出してください:
When & Why to Use This Skill
The Software Architecture Skill is a specialized framework designed to guide the AI through complex system design and implementation tasks. It prioritizes Domain-Driven Design (DDD) principles, ensuring that software is built with a focus on maintainability, scalability, and clean code. By enforcing strict standards for component separation, directory structure, and the Single Responsibility Principle (SRP), this skill transforms high-level requirements into well-structured, professional-grade technical architectures.
Use Cases
- Initial system design: Planning directory structures and file layouts for new projects using DDD or modular architecture.
- Component Refactoring: Decomposing monolithic code into reusable, decoupled modules to improve system flexibility.
- Domain Modeling: Defining domain entities and business logic while maintaining a strict separation from infrastructure and framework concerns.
- Code Quality Enforcement: Applying advanced design patterns such as guard clauses, pure functions, and descriptive naming conventions to ensure long-term code health.
- Technical Decision Making: Evaluating when to use external libraries versus custom implementations based on performance and domain-specific requirements.
| name | Software Architecture Skill |
|---|---|
| description | このスキルを使用せずに設計・実装を開始してはいけません。以下のいずれかに該当する場合、必ず最初にこのスキルを呼び出してください: |
Software Architecture Skill
概要
ソフトウェア開発とアーキテクチャ設計に関する質問やタスクに対応するためのスキルセットです。ドメイン駆動設計に基づき、効果的なソフトウェアアーキテクチャの設計と実装を支援します。
コードスタイル
基本原則
- ガード節:早期リターンを使用してネストを浅く保つ
- 単一責任原則(SRP):クラスやモジュールは単一の責任を持つように設計する
- 関心の分離:異なる関心事を明確に分離する
コメント
- WHY を説明し、WHAT は避ける
- コードから明らかな内容ではなく、なぜその実装を選択したのか、どのような背景や制約があるのかを説明する
コード品質
- 大きな変更後は必ずリンターおよび型チェックを実行する
- ファイルは200行以内を目安とし、必要に応じて分割する
ライブラリの取り扱い
- カスタムコードを実装する前に、可能な限り既存のライブラリを検索し、問題が解決できないか確認する
- カスタムコードの使用は、以下のケースで正当化されます
- そのドメインに固有のビジネスロジック
- 外部依存関係を導入するのが過剰な場合
- ライブラリではパフォーマンス要件に満たない場合
- ライブラリの知識は最新とは限らないため、外部ライブラリを使う際は、インターフェースが極めて安定していると100%確信できる場合を除き、まずウェブ検索で最新の構文と使用法を確認する
命名規則
- 一般的な名称は避ける:
utils、common、shared、helpersなど - isLoading, hasErrorのように補助動詞付きの説明的な名前を使用して、ブール値を表現してください
- DDDの
bounded contextの命名規則に従ってください
関数設計
- 関数は40行以内を目安とし、それ以上長くなる場合は複数の小さな関数に分割する
- 引数は 3-4 個以内を推奨とし、多い場合は引数を論理的なグループにまとめる
- 純粋関数を可能な限り作成し、副作用を避ける
DDD
- DDDが適用可能な場合には、DDDのパターンと原則を遵守してください
- ドメインエンティティとインフラストラクチャの懸念事項を分離する
- ビジネスロジックをフレームワークやデータベースから分離する
- ユースケースを明確に定義し、互いに独立したコンテキストで実装する