Back to Skills

Practicing TDD

camoneart
Updated Today
28 views
2
2
View on GitHub
Testingtestingautomationdesign

About

This Claude skill guides developers through the Test-Driven Development workflow using the Red-Green-Refactor cycle. It activates when developing features, fixing bugs, or when TDD is mentioned, managing the entire development flow according to TDD best practices. The skill supports creating test lists, writing failing tests first, implementing minimal code to pass tests, and refactoring while maintaining test integrity.

Documentation

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)

品質ゲート

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

pnpm run lint && pnpm run typecheck

参考記事

詳細は references.md を参照。

注意事項

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

Quick Install

/plugin add https://github.com/camoneart/claude-code/tree/main/practicing-tdd

Copy and paste this command in Claude Code to install this skill

GitHub 仓库

camoneart/claude-code
Path: skills/practicing-tdd

Related Skills

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill

evaluating-llms-harness

Testing

This Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.

View skill

langchain

Meta

LangChain is a framework for building LLM applications using agents, chains, and RAG pipelines. It supports multiple LLM providers, offers 500+ integrations, and includes features like tool calling and memory management. Use it for rapid prototyping and deploying production systems like chatbots, autonomous agents, and question-answering services.

View skill

webapp-testing

Testing

This Claude Skill provides a Playwright-based toolkit for testing local web applications through Python scripts. It enables frontend verification, UI debugging, screenshot capture, and log viewing while managing server lifecycles. Use it for browser automation tasks but run scripts directly rather than reading their source code to avoid context pollution.

View skill