create-ai-project 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents-en/investigator.md +131 -0
- package/.claude/agents-en/solver.md +145 -0
- package/.claude/agents-en/verifier.md +165 -0
- package/.claude/agents-ja/investigator.md +131 -0
- package/.claude/agents-ja/solver.md +145 -0
- package/.claude/agents-ja/verifier.md +165 -0
- package/.claude/commands-en/diagnose.md +123 -0
- package/.claude/commands-ja/diagnose.md +123 -0
- package/README.ja.md +4 -0
- package/README.md +4 -0
- package/package.json +8 -3
- package/.claude/agents/acceptance-test-generator.md +0 -250
- package/.claude/agents/code-reviewer.md +0 -187
- package/.claude/agents/design-sync.md +0 -221
- package/.claude/agents/document-reviewer.md +0 -187
- package/.claude/agents/integration-test-reviewer.md +0 -192
- package/.claude/agents/prd-creator.md +0 -190
- package/.claude/agents/quality-fixer-frontend.md +0 -324
- package/.claude/agents/quality-fixer.md +0 -281
- package/.claude/agents/requirement-analyzer.md +0 -161
- package/.claude/agents/rule-advisor.md +0 -175
- package/.claude/agents/task-decomposer.md +0 -285
- package/.claude/agents/task-executor-frontend.md +0 -264
- package/.claude/agents/task-executor.md +0 -258
- package/.claude/agents/technical-designer-frontend.md +0 -444
- package/.claude/agents/technical-designer.md +0 -368
- package/.claude/agents/work-planner.md +0 -208
- package/.claude/commands/build.md +0 -75
- package/.claude/commands/design.md +0 -37
- package/.claude/commands/front-build.md +0 -103
- package/.claude/commands/front-design.md +0 -42
- package/.claude/commands/front-plan.md +0 -40
- package/.claude/commands/implement.md +0 -73
- package/.claude/commands/plan.md +0 -43
- package/.claude/commands/project-inject.md +0 -76
- package/.claude/commands/refine-skill.md +0 -206
- package/.claude/commands/review.md +0 -78
- package/.claude/commands/sync-skills.md +0 -116
- package/.claude/commands/task.md +0 -13
- package/.claude/settings.local.json +0 -94
- package/.claude/skills/coding-standards/SKILL.md +0 -246
- package/.claude/skills/documentation-criteria/SKILL.md +0 -193
- package/.claude/skills/documentation-criteria/references/adr-template.md +0 -64
- package/.claude/skills/documentation-criteria/references/design-template.md +0 -242
- package/.claude/skills/documentation-criteria/references/plan-template.md +0 -130
- package/.claude/skills/documentation-criteria/references/prd-template.md +0 -109
- package/.claude/skills/frontend/technical-spec/SKILL.md +0 -147
- package/.claude/skills/frontend/typescript-rules/SKILL.md +0 -315
- package/.claude/skills/frontend/typescript-testing/SKILL.md +0 -212
- package/.claude/skills/implementation-approach/SKILL.md +0 -141
- package/.claude/skills/integration-e2e-testing/SKILL.md +0 -146
- package/.claude/skills/project-context/SKILL.md +0 -42
- package/.claude/skills/subagents-orchestration-guide/SKILL.md +0 -212
- package/.claude/skills/task-analyzer/SKILL.md +0 -142
- package/.claude/skills/task-analyzer/references/skills-index.yaml +0 -211
- package/.claude/skills/technical-spec/SKILL.md +0 -86
- package/.claude/skills/typescript-rules/SKILL.md +0 -121
- package/.claude/skills/typescript-testing/SKILL.md +0 -155
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: typescript-rules
|
|
3
|
-
description: 型安全性とエラーハンドリングのためのTypeScript開発ルール。TypeScriptコード実装や型定義レビュー時に使用。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# TypeScript 開発ルール
|
|
7
|
-
|
|
8
|
-
## Backend実装における型安全性
|
|
9
|
-
|
|
10
|
-
**データフローでの型安全性**
|
|
11
|
-
入力層(`unknown`) → 型ガード → ビジネス層(型保証) → 出力層(シリアライズ)
|
|
12
|
-
|
|
13
|
-
**Backend固有の型シナリオ**:
|
|
14
|
-
- **API通信**: レスポンスは必ず`unknown`で受け、型ガードで検証
|
|
15
|
-
- **フォーム入力**: 外部入力は`unknown`、バリデーション後に型確定
|
|
16
|
-
- **レガシー統合**: `window as unknown as LegacyWindow`のように段階的アサーション
|
|
17
|
-
- **テストコード**: モックも必ず型定義、`Partial<T>`や`vi.fn<[Args], Return>()`活用
|
|
18
|
-
|
|
19
|
-
## コーディング規約
|
|
20
|
-
|
|
21
|
-
**クラス使用の判断基準**
|
|
22
|
-
- **推奨:関数とinterfaceでの実装**
|
|
23
|
-
- 背景: テスタビリティと関数合成の柔軟性が向上
|
|
24
|
-
- **クラス使用を許可**:
|
|
25
|
-
- フレームワーク要求時(NestJSのController/Service、TypeORMのEntity等)
|
|
26
|
-
- カスタムエラークラス定義時
|
|
27
|
-
- 状態とビジネスロジックが密結合している場合(例: ShoppingCart、Session、StateMachine)
|
|
28
|
-
- **判断基準**: 「このデータは振る舞いを持つか?」がYesならクラス検討
|
|
29
|
-
```typescript
|
|
30
|
-
// 関数とinterface
|
|
31
|
-
interface UserService { create(data: UserData): User }
|
|
32
|
-
const userService: UserService = { create: (data) => {...} }
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**関数設計**
|
|
36
|
-
- **引数は0-2個まで**: 3個以上はオブジェクト化
|
|
37
|
-
```typescript
|
|
38
|
-
// オブジェクト引数
|
|
39
|
-
function createUser({ name, email, role }: CreateUserParams) {}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**依存性注入**
|
|
43
|
-
- **外部依存は引数で注入**: テスト可能性とモジュール性確保
|
|
44
|
-
```typescript
|
|
45
|
-
// 依存性を引数で受け取る
|
|
46
|
-
function createService(repository: Repository) { return {...} }
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**非同期処理**
|
|
50
|
-
- Promise処理: 必ず`async/await`を使用
|
|
51
|
-
- エラーハンドリング: 必ず`try-catch`でハンドリング
|
|
52
|
-
- 型定義: 戻り値の型は明示的に定義(例: `Promise<Result>`)
|
|
53
|
-
|
|
54
|
-
**フォーマット規則**
|
|
55
|
-
- セミコロン省略(Biomeの設定に従う)
|
|
56
|
-
- 型は`PascalCase`、変数・関数は`camelCase`
|
|
57
|
-
- インポートは絶対パス(`src/`)
|
|
58
|
-
|
|
59
|
-
**クリーンコード原則**
|
|
60
|
-
- 使用されていないコードは即座に削除
|
|
61
|
-
- デバッグ用`console.log()`は削除
|
|
62
|
-
- コメントアウトされたコード禁止(バージョン管理で履歴管理)
|
|
63
|
-
- コメントは「なぜ」を説明(「何」ではなく)
|
|
64
|
-
|
|
65
|
-
## エラーハンドリング
|
|
66
|
-
|
|
67
|
-
**絶対ルール**: エラーの握りつぶし禁止。すべてのエラーは必ずログ出力と適切な処理を行う。
|
|
68
|
-
|
|
69
|
-
**Fail-Fast原則**: エラー時は速やかに失敗させ、不正な状態での処理継続を防ぐ
|
|
70
|
-
```typescript
|
|
71
|
-
// 禁止: 無条件フォールバック
|
|
72
|
-
catch (error) {
|
|
73
|
-
return defaultValue // エラーを隠蔽
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// 必須: 明示的な失敗
|
|
77
|
-
catch (error) {
|
|
78
|
-
logger.error('処理失敗', error)
|
|
79
|
-
throw error // 上位層で適切に処理
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
**Result型パターン**: エラーを型で表現し、明示的に処理
|
|
84
|
-
```typescript
|
|
85
|
-
type Result<T, E> = { ok: true; value: T } | { ok: false; error: E }
|
|
86
|
-
|
|
87
|
-
// 使用例:エラーの可能性を型で表現
|
|
88
|
-
function parseUser(data: unknown): Result<User, ValidationError> {
|
|
89
|
-
if (!isValid(data)) return { ok: false, error: new ValidationError() }
|
|
90
|
-
return { ok: true, value: data as User }
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
**カスタムエラークラス**
|
|
95
|
-
```typescript
|
|
96
|
-
export class AppError extends Error {
|
|
97
|
-
constructor(message: string, public readonly code: string, public readonly statusCode = 500) {
|
|
98
|
-
super(message)
|
|
99
|
-
this.name = this.constructor.name
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
// 用途別: ValidationError(400), BusinessRuleError(400), DatabaseError(500), ExternalServiceError(502)
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
**層別エラー処理**
|
|
106
|
-
- API層: HTTPレスポンスに変換、機密情報を除外してログ出力
|
|
107
|
-
- サービス層: ビジネスルール違反を検出、AppErrorはそのまま伝播
|
|
108
|
-
- リポジトリ層: 技術的エラーをドメインエラーに変換
|
|
109
|
-
|
|
110
|
-
**構造化ログと機密情報保護**
|
|
111
|
-
機密情報(password, token, apiKey, secret, creditCard)は絶対にログに含めない
|
|
112
|
-
|
|
113
|
-
**非同期エラーハンドリング**
|
|
114
|
-
- グローバルハンドラー設定必須: `unhandledRejection`, `uncaughtException`
|
|
115
|
-
- すべてのasync/awaitでtry-catch使用
|
|
116
|
-
- エラーは必ずログと再スロー
|
|
117
|
-
|
|
118
|
-
## パフォーマンス最適化
|
|
119
|
-
|
|
120
|
-
- ストリーミング処理: 大きなデータセットはストリームで処理
|
|
121
|
-
- メモリリーク防止: 不要なオブジェクトは明示的に解放
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: typescript-testing
|
|
3
|
-
description: Vitestを使用したTypeScriptテストルール。カバレッジ要件、テスト設計原則、品質基準を含む。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# TypeScript テストルール
|
|
7
|
-
|
|
8
|
-
## テストフレームワーク
|
|
9
|
-
|
|
10
|
-
- **Vitest**: このプロジェクトではVitestを使用
|
|
11
|
-
- テストのインポート: `import { describe, it, expect, beforeEach, vi } from 'vitest'`
|
|
12
|
-
- モックの作成: `vi.mock()` を使用
|
|
13
|
-
|
|
14
|
-
## テストの基本方針
|
|
15
|
-
|
|
16
|
-
### 品質要件
|
|
17
|
-
- **カバレッジ**: 単体テストのカバレッジは70%以上を必須
|
|
18
|
-
- **独立性**: 各テストは他のテストに依存せず実行可能
|
|
19
|
-
- **再現性**: テストは環境に依存せず、常に同じ結果を返す
|
|
20
|
-
- **可読性**: テストコードも製品コードと同様の品質を維持
|
|
21
|
-
|
|
22
|
-
### カバレッジ要件
|
|
23
|
-
**必須**: 単体テストのカバレッジは70%以上
|
|
24
|
-
**指標**: Statements(文)、Branches(分岐)、Functions(関数)、Lines(行)
|
|
25
|
-
|
|
26
|
-
### テストの種類と範囲
|
|
27
|
-
1. **単体テスト(Unit Tests)**
|
|
28
|
-
- 個々の関数やクラスの動作を検証
|
|
29
|
-
- 外部依存はすべてモック化
|
|
30
|
-
- 最も数が多く、細かい粒度で実施
|
|
31
|
-
|
|
32
|
-
2. **統合テスト(Integration Tests)**
|
|
33
|
-
- 複数のコンポーネントの連携を検証
|
|
34
|
-
- 実際の依存関係を使用(DBやAPI等)
|
|
35
|
-
- 主要な機能フローの検証
|
|
36
|
-
|
|
37
|
-
3. **E2Eテストでの機能横断検証**
|
|
38
|
-
- 新機能追加時、既存機能への影響を必ず検証
|
|
39
|
-
- Design Docの「統合ポイントマップ」で影響度「高」「中」の箇所をカバー
|
|
40
|
-
- 検証パターン: 既存機能動作 → 新機能有効化 → 既存機能の継続性確認
|
|
41
|
-
- 判定基準: レスポンス内容の変化なし、処理時間5秒以内
|
|
42
|
-
- CI/CDでの自動実行を前提とした設計
|
|
43
|
-
|
|
44
|
-
## テストの実装規約
|
|
45
|
-
|
|
46
|
-
### ディレクトリ構造
|
|
47
|
-
```
|
|
48
|
-
src/
|
|
49
|
-
└── application/
|
|
50
|
-
└── services/
|
|
51
|
-
├── __tests__/
|
|
52
|
-
│ ├── service.test.ts # 単体テスト
|
|
53
|
-
│ └── service.int.test.ts # 統合テスト
|
|
54
|
-
└── service.ts
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### 命名規則
|
|
58
|
-
- テストファイル: `{対象ファイル名}.test.ts`
|
|
59
|
-
- 統合テストファイル: `{対象ファイル名}.int.test.ts`
|
|
60
|
-
- テストスイート: 対象の機能や状況を説明する名前
|
|
61
|
-
- テストケース: 期待される動作を説明する名前
|
|
62
|
-
|
|
63
|
-
### テストコードの品質ルール
|
|
64
|
-
|
|
65
|
-
**推奨: すべてのテストを常に有効に保つ**
|
|
66
|
-
- メリット: テストスイートの完全性を保証
|
|
67
|
-
- 実践: 問題があるテストは修正して有効化
|
|
68
|
-
|
|
69
|
-
**避けるべき: test.skip()やコメントアウト**
|
|
70
|
-
- 理由: テストの穴が生まれ、品質チェックが不完全になる
|
|
71
|
-
- 対処: 不要なテストは完全に削除する
|
|
72
|
-
|
|
73
|
-
## テスト品質基準
|
|
74
|
-
|
|
75
|
-
### 境界値・異常系の網羅
|
|
76
|
-
正常系に加え、境界値と異常系を含める。
|
|
77
|
-
```typescript
|
|
78
|
-
it('returns 0 for empty array', () => expect(calc([])).toBe(0))
|
|
79
|
-
it('throws on negative price', () => expect(() => calc([{price: -1}])).toThrow())
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### 期待値の直接記述
|
|
83
|
-
期待値はリテラルで記述。実装ロジックを再現しない。
|
|
84
|
-
**有効なテスト**: 期待値 ≠ モック戻り値(実装による変換・処理がある)
|
|
85
|
-
```typescript
|
|
86
|
-
expect(calcTax(100)).toBe(10) // not: 100 * TAX_RATE
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### 結果ベースの検証
|
|
90
|
-
呼び出し順序・回数ではなく結果を検証。
|
|
91
|
-
```typescript
|
|
92
|
-
expect(mock).toHaveBeenCalledWith('a') // not: toHaveBeenNthCalledWith
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### 意味あるアサーション
|
|
96
|
-
各テストに最低1つの検証を含める。
|
|
97
|
-
```typescript
|
|
98
|
-
it('creates user', async () => {
|
|
99
|
-
const user = await createUser({name: 'test'})
|
|
100
|
-
expect(user.id).toBeDefined()
|
|
101
|
-
})
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### 適切なモック範囲
|
|
105
|
-
直接依存の外部I/Oのみモック。間接依存は実物使用。
|
|
106
|
-
```typescript
|
|
107
|
-
vi.mock('./database') // 外部I/Oのみ
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Property-based Testing(fast-check)
|
|
111
|
-
不変条件やプロパティを検証する場合はfast-checkを使用。
|
|
112
|
-
```typescript
|
|
113
|
-
import fc from 'fast-check'
|
|
114
|
-
|
|
115
|
-
it('reverses twice equals original', () => {
|
|
116
|
-
fc.assert(fc.property(fc.array(fc.integer()), (arr) => {
|
|
117
|
-
return JSON.stringify(arr.reverse().reverse()) === JSON.stringify(arr)
|
|
118
|
-
}))
|
|
119
|
-
})
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**使用条件**: Design DocのACにProperty注釈が付与されている場合に使用。
|
|
123
|
-
|
|
124
|
-
## モックの型安全性
|
|
125
|
-
|
|
126
|
-
### 必要最小限の型定義
|
|
127
|
-
```typescript
|
|
128
|
-
// 必要な部分のみ
|
|
129
|
-
type TestRepo = Pick<Repository, 'find' | 'save'>
|
|
130
|
-
const mock: TestRepo = { find: vi.fn(), save: vi.fn() }
|
|
131
|
-
|
|
132
|
-
// やむを得ない場合のみ、理由明記
|
|
133
|
-
const sdkMock = {
|
|
134
|
-
call: vi.fn()
|
|
135
|
-
} as unknown as ExternalSDK // 外部SDKの複雑な型のため
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## Vitestの基本例
|
|
139
|
-
|
|
140
|
-
```typescript
|
|
141
|
-
import { describe, it, expect, vi } from 'vitest'
|
|
142
|
-
|
|
143
|
-
vi.mock('./userService', () => ({
|
|
144
|
-
getUserById: vi.fn(),
|
|
145
|
-
updateUser: vi.fn()
|
|
146
|
-
}))
|
|
147
|
-
|
|
148
|
-
describe('ComponentName', () => {
|
|
149
|
-
it('should follow AAA pattern', () => {
|
|
150
|
-
const input = 'test'
|
|
151
|
-
const result = someFunction(input)
|
|
152
|
-
expect(result).toBe('expected')
|
|
153
|
-
})
|
|
154
|
-
})
|
|
155
|
-
```
|