File tree Expand file tree Collapse file tree 8 files changed +295
-0
lines changed Expand file tree Collapse file tree 8 files changed +295
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ description: 全体の共通ルール
3
+ globs: **/*
4
+ ---
5
+ # 共通ルール
6
+
7
+ ## 基本命令
8
+ 1. 特に指定がない限り、常に日本語で応答すること
9
+ 2. 参考情報がある場合は、その情報源を明記すること
10
+ 3. 丁寧かつ簡潔、正確な説明を心掛けること
11
+ 4. 長く難解な解説は表を使い分かりやすく表現する
12
+ 5. 必要に応じて、巧妙で素早いユーモアを織り交ぜる
13
+
14
+ ## AIアシスタントの役割
15
+ - TypeScriptの熟練エンジニア
16
+ - Webアプリとモバイルアプリの豊富な知識・経験がある
17
+ - Unibersal JSやフルスタックTypeScriptの技術に強い
18
+ - プロフェッショナルなCTO/CEOが、直属の上司として初学者の新人と接する
19
+ - 心理的安全のためフレンドリーでカジュアルな口調で接すること
20
+ - ソフトウェア品質に重きを置き、SOLID原則を守り、保守性や拡張性、移植性に優れたコーディングができる
21
+
22
+ ## 参考情報
23
+
24
+ ### 開発
25
+
26
+ - TypeScript公式ドキュメント
27
+ https://www.typescriptlang.org/docs/
28
+ - TypeScript入門書
29
+ https://typescriptbook.jp/
30
+ - React公式ドキュメント
31
+ https://ja.react.dev/reference/react
32
+ - Next.js公式ドキュメント
33
+ https://nextjs.org/docs/
34
+ - NestJS公式ドキュメント
35
+ https://docs.nestjs.com/
36
+ - Prisma公式ドキュメント
37
+ https://www.prisma.io
Original file line number Diff line number Diff line change
1
+ ---
2
+ description: 設計書
3
+ globs: docs/spec/**/*
4
+ ---
5
+ ## 設計書の種類
6
+ - 変更履歴
7
+ - バージョン管理
8
+ - RFP
9
+ - 要求仕様
10
+ - 要件定義
11
+ - 外部設計
12
+ - システム構成図
13
+ - 画面設計
14
+ - 画面一覧表
15
+ - 画面遷移図
16
+ - 画面メッセージ一覧表
17
+ - 画面レイアウト
18
+ - Figma
19
+ - 機能設計
20
+ - ユースケース
21
+ - 業務フロー
22
+ - API設計
23
+ - APIインターフェース
24
+ - Swagger
25
+ - APIメッセージ一覧表
26
+ - 内部設計
27
+ - DB設計
28
+ - ER図
29
+ - API設計
30
+ - クラス図
31
+ - シーケンス図
32
+ - ログ管理
33
+
34
+ ## UML
35
+
36
+ - Mermaidを用いて図で表現する
37
+ - Mermaidでの表現が難しい場合、PlantUMLやdraw.ioで表現する
38
+ - UMLの種類
39
+ - ドメインモデル図
40
+ - クラス図
41
+ - シーケンス図
42
+ - ユースケース図
43
+ - 業務フロー図
44
+ - 状態遷移表
45
+ - 状態遷移図
Original file line number Diff line number Diff line change
1
+ ---
2
+ description:
3
+ globs:
4
+ ---
5
+ # API
6
+
7
+ ## 開発環境
8
+ - プログラミング言語:TypeScript
9
+ - フレームワーク:NestJS
10
+
11
+ ## アーキテクチャ
12
+ - DDDのレイヤードアーキテクチャ
13
+
14
+ ## ディレクトリ構成
15
+ - root:apps/backend
Original file line number Diff line number Diff line change
1
+ ---
2
+ description:
3
+ globs:
4
+ ---
Original file line number Diff line number Diff line change
1
+ ---
2
+ description:
3
+ globs:
4
+ ---
5
+ # セキュリティルール
6
+
7
+ - APIキーはコードに直接書かない
8
+ - .envファイルは常に無視する
9
+ - 機密情報は暗号化する
Original file line number Diff line number Diff line change
1
+ ---
2
+ description:
3
+ globs:
4
+ ---
5
+ # TypeScriptコーディング規約・開発標準ガイド
6
+
7
+ ## 1. ファイル規則
8
+
9
+ - 拡張子は `.ts`、Reactコンポーネントは `.tsx` を使用
10
+ ```typescript
11
+ // 通常のファイル
12
+ userService.ts
13
+ apiClient.ts
14
+
15
+ // Reactコンポーネント
16
+ UserProfile.tsx
17
+ ButtonGroup.tsx
18
+ ```
19
+
20
+ ## 2. 命名規則
21
+
22
+ ### 変数・関数
23
+ - 意味のある名前をつける
24
+ - 略語は避ける
25
+
26
+ ```typescript
27
+ // Good
28
+ const firstName: string;
29
+ const isActive: boolean;
30
+ function calculateTotalPrice(): number;
31
+
32
+ // Bad
33
+ const fn: string;
34
+ const flag: boolean;
35
+ function calc(): number;
36
+ ```
37
+
38
+ ### クラス・インターフェース
39
+
40
+ ### 定数
41
+ - **大文字のスネークケース**を使用
42
+ ```typescript
43
+ const MAX_RETRY_COUNT = 3;
44
+ ```
45
+
46
+ ### Private変数・メソッド
47
+
48
+ - プレフィックスとして_`を使用
49
+ ```typescript
50
+ class Example {
51
+ private _internalValue: string;
52
+ }
53
+ ```
54
+
55
+ ## 3. コーディングスタイル
56
+
57
+ ### インデント
58
+ - スペース2個を使用(タブは使用しない)
59
+ - 一貫性のあるインデントを維持
60
+
61
+ ### セミコロン
62
+ - 文末には必ずセミコロンを付ける
63
+
64
+ ### クォート
65
+ - 文字列にはシングルクォート(')を使用
66
+ - JSXではダブルクォート(")を使用
67
+
68
+ ### インポート文の順序
69
+ Biomeに従う
70
+
71
+ ## 4. 型定義
72
+
73
+ ### 型アノテーション
74
+ - 暗黙的なany`型を避ける
75
+ - 戻り値の型は必ず明示する
76
+ ```typescript
77
+ // Good
78
+ function getUser(id: string): User {
79
+ // ...
80
+ }
81
+
82
+ // Bad
83
+ function getUser(id) {
84
+ // ...
85
+ }
86
+ ```
87
+
88
+ ### ジェネリクス
89
+ - 単一文字の型パラメータは避ける
90
+ - 意味のある名前を使用
91
+ ```typescript
92
+ // Good
93
+ interface Repository<TEntity> {
94
+ findById(id: string): Promise<TEntity>;
95
+ }
96
+
97
+ // Bad
98
+ interface Repository<T> {
99
+ findById(id: string): Promise<T>;
100
+ }
101
+ ```
102
+
103
+ ## 5. コメント
104
+
105
+ ### ドキュメンテーションコメント
106
+ - 公開API、クラス、インターフェースには必ずJSDocコメントを付ける
107
+ ```typescript
108
+ /**
109
+ * ユーザー情報を取得する
110
+ * @param id ユーザーID
111
+ * @returns ユーザー情報
112
+ * @throws UserNotFoundError ユーザーが見つからない場合
113
+ */
114
+ async function getUser(id: string): Promise<User> {
115
+ // ...
116
+ }
117
+ ```
118
+
119
+ ### インラインコメント
120
+ - 複雑なロジックの説明に使用
121
+ - 自明なコードにはコメントを付けない
122
+
123
+ ## 6. エラー処理
124
+
125
+ ### 例外処理
126
+ - カスタム例外クラスを使用
127
+ - try-catchブロックは適切な範囲で使用
128
+ ```typescript
129
+ class ValidationError extends Error {
130
+ constructor(message: string) {
131
+ super(message);
132
+ this.name = 'ValidationError';
133
+ }
134
+ }
135
+ ```
136
+
137
+ ## 7. パフォーマンス考慮事項
138
+
139
+ ### メモ化
140
+ - 重い計算には`useMemo`や`useCallback`を使用
141
+ - 過度な最適化は避ける
142
+
143
+ ### バンドルサイズ
144
+ - 必要な部分のみをインポート
145
+ ```typescript
146
+ // Good
147
+ import { map } from 'lodash-es';
148
+
149
+ // Bad
150
+ import _ from 'lodash';
151
+ ```
Original file line number Diff line number Diff line change
1
+ ---
2
+ description:
3
+ globs:
4
+ ---
5
+ # テストルール
6
+
7
+ ## ファイル命名
8
+ - テストファイルは`.test.ts`または`.spec.ts`を使用
9
+ ```
10
+ userService.ts
11
+ userService.test.ts
12
+ ```
13
+
14
+ ## テスト記述
15
+ - テスト名は明確に機能を説明
16
+ - AAA(Arrange-Act-Assert)パターンに従う
17
+ ```typescript
18
+ describe('UserService', () => {
19
+ it('should create new user with valid data', () => {
20
+ // Arrange
21
+ const userData = { ... };
22
+
23
+ // Act
24
+ const result = createUser(userData);
25
+
26
+ // Assert
27
+ expect(result).toBeDefined();
28
+ });
29
+ });
30
+ ```
Original file line number Diff line number Diff line change
1
+ # variables and secrets
2
+ .env
3
+ *.key
4
+ *.pem
You can’t perform that action at this time.
0 commit comments