Test Driven Developmentのロゴ

Test Driven Development

コミュニティ
AlexAI-MCP
test-driven-development

Apply a disciplined red-green-refactor workflow in Claude Code. Use when adding behavior safely, reproducing a bug before fixing it, designing APIs from the outside in, or strengthening change confidence with targeted tests.

概要

公開者AlexAI-MCP
リポジトリhermes-CCC
スキル名test-driven-development
スター
134
フォーク
22
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    AlexAI-MCPがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Test Driven Development」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/test-driven-development
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AlexAI-MCP/hermes-CCC.git /tmp/hermes-CCC
mkdir -p .claude/skills
cp -r /tmp/hermes-CCC/skills/test-driven-development .claude/skills/test-driven-development
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでTest Driven Developmentを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にTest Driven Developmentを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Test Driven Developmentは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Test-Driven Development

Purpose

  • Drive implementation from observable behavior.
  • Reproduce bugs before fixing them.
  • Keep code changes tightly coupled to expected outcomes.
  • Use tests as design tools, not just safety nets.
  • Reduce regressions by proving each behavior change.

Activation Signals

  • Use this skill when adding a new feature with clear acceptance behavior.
  • Use this skill when fixing a bug that should never recur.
  • Use this skill when API shape is easier to design from usage than internals.
  • Use this skill when reviewers will ask for evidence.
  • Use this skill when the codebase already has a strong test culture.

Core Cycle

  1. Write a failing test.
  2. Run the smallest test scope and watch it fail for the right reason.
  3. Implement the smallest change that makes it pass.
  4. Re-run the test.
  5. Refactor while keeping tests green.
  6. Expand coverage only when a new behavior boundary appears.

Red Phase

  • Express one behavior at a time.
  • Name the test after the behavior, not the implementation.
  • Ensure the failure is caused by missing behavior, not a broken fixture.
  • Keep setup minimal.
  • Prefer explicit assertions over snapshot sprawl unless snapshots are already standard.
  • For bug fixes, make the failing test mirror the actual defect.

Green Phase

  • Implement the smallest viable change.
  • Do not optimize before the test passes.
  • Avoid speculative abstractions.
  • If several code paths fail, make one behavior pass first.
  • Keep the first passing diff small enough to reason about.

Refactor Phase

  • Remove duplication exposed by the passing test.
  • Improve names and structure.
  • Preserve behavior while simplifying code.
  • Re-run relevant tests after each meaningful refactor.
  • Stop refactoring once readability improves and the tests still describe the behavior clearly.

Bug-Fix TDD

  • Reproduce the bug in a failing test before touching the fix.
  • If reproduction is expensive, build a narrow harness.
  • If the bug is timing-sensitive, isolate the timing dependency rather than sleeping more.
  • If the bug cannot be reproduced, treat the fix as higher risk and document why.

Test Selection Rules

  • Use unit tests for pure behavior and deterministic branching.
  • Use integration tests for component boundaries and data flow.
  • Use end-to-end tests only when lower layers cannot express the guarantee.
  • Put the regression test at the lowest layer that still captures the defect.

Assertion Rules

  • Assert the most important observable outcome first.
  • Prefer stable assertions over implementation detail checks.
  • Avoid asserting on incidental formatting unless formatting is the feature.
  • For collections, assert the contract that matters: count, key values, order, or identity.

Good Test Names

  • test_search_returns_ranked_results_for_partial_match
  • test_login_redirect_does_not_loop_when_session_is_hydrated
  • test_serializer_rejects_missing_required_field

Bad Test Names

  • test_fix
  • test_works
  • test_api
  • test_stuff

Useful Commands

bash
pytest tests/test_module.py::test_specific_behavior -vv
pytest tests/ -k "auth and redirect" -vv
ruff check path/to/file.py

Design Benefits To Exploit

  • Tests clarify API ergonomics.
  • Tests reveal hidden dependencies.
  • Tests pressure functions toward clean inputs and outputs.
  • Tests expose when code is too coupled to mock cleanly.

Decision Rules

  • If a feature request has no acceptance behavior, clarify before writing code.
  • If the first test is too hard to write, the design seam may be missing.
  • If the code needed to pass the test is huge, the test scope is probably too broad.
  • If refactoring requires changing many tests, the tests may be overfit to internals.

Anti-Patterns

  • writing tests after the implementation and calling it TDD
  • changing the test to match a broken implementation
  • asserting on private internals instead of behavior
  • creating giant fixture setups for simple behavior
  • using TDD language while skipping the red phase

Output Contract

When reporting TDD progress, include:

  • failing test added
  • implementation change
  • verification command
  • refactor notes
  • remaining coverage gaps

Example Status Block

markdown
TDD status:
- Red: added failing regression test for partially hydrated session redirect
- Green: updated middleware guard to wait for token presence
- Refactor: simplified session-check helper naming
- Verify: pytest tests/test_auth.py::test_login_redirect_does_not_loop_when_session_is_hydrated -vv

Coverage Guidance

  • Start with one high-signal test.
  • Add neighboring tests only when the bug or feature has multiple edges.
  • Do not explode the matrix on the first pass.
  • Prefer targeted new tests over broad rewrites of existing suites.

Failure Modes

  • wrong failure reason in red phase
  • massive green-phase implementation
  • no refactor after a crude passing patch
  • tests too brittle to survive harmless refactors
  • overuse of mocks where real data flow would be clearer

Recovery Moves

  • Rewrite the test if it fails for the wrong reason.
  • Split one large behavior into multiple smaller tests.
  • Move down a layer if end-to-end setup is hiding the real contract.
  • Replace mocks with real collaborators when possible.

Checklist

  1. Name the behavior.
  2. Write the failing test.
  3. Confirm the right failure.
  4. Implement the smallest fix.
  5. Re-run the narrow test.
  6. Refactor with tests green.
  7. Run adjacent coverage.
  8. Report evidence, not confidence alone.

よくある質問

AIスキル「Test Driven Development」では何ができますか?

Apply a disciplined red-green-refactor workflow in Claude Code. Use when adding behavior safely, reproducing a bug before fixing it, designing APIs from the outside in, or strengthening change confidence with targeted tests.

TypingMindでTest Driven Developmentを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Test Driven Developmentはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにTest Driven Developmentをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/AlexAI-MCP/hermes-CCC/tree/master/skills/test-driven-developmentを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Test Driven Developmentを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Test Driven Developmentで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもTest Driven Developmentを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Test Driven Development」は無料ですか?

はい。AlexAI-MCPがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇