← スキル一覧に戻る

di-mockable-services
by oalkabouss
⭐ 0🍴 0📅 2026年1月19日
SKILL.md
name: di-mockable-services description: Design injectable, mockable services (interfaces + composition root) compatibility: opencode license: MIT metadata: stack: node-react-next style: solid-clean-code
What I do
Je standardise la DI (injection de dépendances) et la conception mockable.
Core rules
- Écrire le contrat d'abord :
IUserApi,UserRepository, etc. - Les hooks/use-cases dépendent des interfaces.
- Les implémentations concrètes vivent dans
infra/. - Le seul endroit qui instancie l'infra est le
composition root.
Example (frontend service)
export interface IUserApi {
getById(id: string): Promise<UserDTO>;
}
export class UserApi implements IUserApi {
constructor(private readonly http: HttpClient) {}
getById(id: string) { return this.http.get(`/users/${id}`); }
}
export class FakeUserApi implements IUserApi {
async getById(id: string) { return { id, name: 'Test' }; }
}
Testing guidance
- En test, remplacer via le container :
container.userApi = new FakeUserApi(). - Éviter les mocks globaux non typés.
スコア
総合スコア
45/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
○言語
プログラミング言語が設定されている
0/5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です