Provides comprehensive testing and TDD guidance. Use for writing tests before implementing new features, creating reproduction tests for bug fixes, running regression tests during refactoring, and checking test coverage during code reviews. Enforces AAA pattern and 100% coverage goal.
/plugin marketplace add sumik5/sumik-claude-plugin/plugin install sumik@sumikThis skill inherits all available tools. When active, it can use any tool Claude has access to.
AI-REVIEW-GUIDELINES.mdREFERENCE.mdTDD.mdTEST-TYPES.mdTESTABLE-DESIGN.mdこのスキルは以下のファイルで構成されています:
実装の前にテストを書く「TDD(Test-Driven Development)」を推奨します。
基本サイクル:
1. Red(失敗するテストを書く)
↓
2. Green(最小限のコードで通す)
↓
3. Refactor(リファクタリング)
↓
繰り返し
詳細は TDD.md を参照してください。
/\
/ \ E2E(少数)
/____\ 統合テスト(中程度)
/______\ 単体テスト(多数)
原則:
詳細は TEST-TYPES.md を参照してください。
すべてのテストは Arrange-Act-Assert パターンに従います:
it('should create user with valid data', () => {
// Arrange(準備)
const userData = { name: 'John', email: 'john@example.com' }
// Act(実行)
const user = userService.createUser(userData)
// Assert(検証)
expect(user.name).toBe('John')
})
- ビジネスロジック: 100%
- ユーティリティ関数: 100%
- コントローラー: 80%以上
- UI コンポーネント: 70%以上
詳細は REFERENCE.md を参照してください。
テストしやすいコードを書くための設計原則:
1. 依存性注入(DI)
2. 純粋関数
3. インターフェース抽象化
詳細は TESTABLE-DESIGN.md を参照してください。
AIが生成したテストコードは網羅的ですが、以下の観点でレビューが必要です:
詳細は AI-REVIEW-GUIDELINES.md を参照してください。
1. テストを先に書く(Red)
↓
2. 最小限の実装(Green)
↓
3. リファクタリング(Refactor)
↓
4. カバレッジ確認
↓
5. 完了
1. バグを再現するテストを書く
↓
2. テストが失敗することを確認
↓
3. バグを修正
↓
4. テストが成功することを確認
↓
5. 完了
// テスト
describe('calculateTotal', () => {
it('should calculate total with discount', () => {
expect(calculateTotal([100, 200], 0.1)).toBe(270)
})
})
// 実装
function calculateTotal(items: number[], discount: number): number {
const subtotal = items.reduce((sum, item) => sum + item, 0)
return subtotal * (1 - discount)
}
test('user registration flow', async ({ page }) => {
await page.goto('/register')
await page.fill('#email', 'john@example.com')
await page.click('button[type="submit"]')
await expect(page.locator('.success')).toBeVisible()
})
実装完了前に確認:
完全なチェックリストは REFERENCE.md を参照してください。