Agent skill

Practicing TDD

Guide Test-Driven Development workflow with Red-Green-Refactor cycle. Use when developing features, fixing bugs, or when user mentions TDD/テスト駆動開発/test-first.

Stars 5
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/camoneart/claude-code/tree/main/skills/practicing-tdd

SKILL.md

Practicing TDD

テスト駆動開発(TDD)のベストプラクティスに従った開発フローを管理するスキル。

いつ使うか

  • プロジェクト(プロダクト、アプリ、サイト等)の開発時
  • 新機能実装時
  • バグ修正時
  • ユーザーがTDD、テスト駆動開発について言及した時

基本原則

Red-Green-Refactor サイクル

1. Red    → テストを書いて失敗させる
2. Green  → テストを通す最小限のコード
3. Refactor → コードを整理整頓
4. 繰り返し

開発手順

ステップ1: ToDo リスト作成

やるべきことを箇条書きで整理(テストリスト)

ステップ2: Red(レッド)

  1. ToDo リストから1つピックアップ
  2. テストから書く(テストファースト)
  3. テストを実行して失敗させる

ステップ3: Green(グリーン)

  1. 失敗しているテストを成功させることに集中
  2. 最小限のコードを書く(綺麗より動作優先)
  3. 全てのテストが成功することを確認

ステップ4: Refactor(リファクタリング)

  1. 全てのテストが成功している状態で整理整頓
  2. テストは通ったままにする
  3. 実装コード、テストコード両方をリファクタリング

ステップ5: 繰り返し

  1. 気付きを ToDo リストに反映
  2. 次の ToDo を選んで Red に戻る

品質基準

テスト配置

  • テストコードは src/__tests__/ または実装ファイルと同階層の *.test.ts(x) に配置
  • pnpm test で必ず全スイートを実行

カバレッジ基準

  • コードカバレッジは常に 80% 以上 を維持
  • CI で閾値を下回った場合はジョブを fail させる

バグ修正フロー

  1. 再現テスト(Red)を書く
  2. 修正(Green)
  3. リファクタリング(Refactor)

品質ゲート

テスト追加・変更後は必ず実行:

bash
pnpm run lint && pnpm run typecheck

参考記事

詳細は references.md を参照。

注意事項

  • テストを書かずに実装を進めない
  • 複数の機能を同時に実装しない(1つずつ)
  • テストが失敗したままリファクタリングしない
  • カバレッジ80%未満でコミットしない

Expand your agent's capabilities with these related and highly-rated skills.

camoneart/claude-code

translating-technical-articles

Translates English technical articles (engineering blogs, documentation) to Japanese while preserving layout and structure. Use when the user asks to translate an article, convert English content to Japanese, or mentions translating a URL or technical blog post.

5 0
Explore
camoneart/claude-code

guiding-tdd-development

Guide Test-Driven Development with task splitting, Red-Green-Refactor cycle, and framework auto-detection. Use when developing features with TDD approach, fixing bugs test-first, or when user mentions "TDD", "テスト駆動開発", "test-first", "/tdd".

5 0
Explore
camoneart/claude-code

distributed-tracing

Implement distributed tracing with Jaeger and Tempo to track requests across microservices and identify performance bottlenecks. Use when debugging microservices, analyzing request flows, or implementing observability for distributed systems.

5 0
Explore
camoneart/claude-code

dependency-upgrade

Manage major dependency version upgrades with compatibility analysis, staged rollout, and comprehensive testing. Use when upgrading framework versions, updating major dependencies, or managing breaking changes in libraries.

5 0
Explore
camoneart/claude-code

stripe-integration

Implement Stripe payment processing for robust, PCI-compliant payment flows including checkout, subscriptions, and webhooks. Use when integrating Stripe payments, building subscription systems, or implementing secure checkout flows.

5 0
Explore
camoneart/claude-code

typescript-advanced-types

Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications. Use when implementing complex type logic, creating reusable type utilities, or ensuring compile-time type safety in TypeScript projects.

5 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results