本文へスキップ
Skillpedia
テスト81k · #1701

tdd-workflow

できること

このスキルは、依存関係を先にモックするロンドン学派のスタイルで、テスト駆動開発の流れを導きます。テストが先頭に立って、機能を一歩ずつ作りたい開発者向けです。

使う場面

  • ✓外側から内側へ、テストを先に書いて機能を作りたいとき。
  • ✓新しい振る舞いについて、赤、緑、リファクタリングの流れを明確にしたいとき。
  • ✓作業を完了とする前に、最終的なテストの結果を確認したいとき。

スキルのリンク

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-testgen/skills/tdd-workflow/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-testgen/skills/tdd-workflow/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“モックされた価格設定のサービス向けに、失敗するテストから始めて、割引の計算をテストを先に書いて作ってください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このスキルは、依存関係をモックした失敗するテストを書き、正しい理由で失敗することを確認します。次に、それを通す最も単純なコードを書き、リファクタリングします。成功を報告する前に、対象のテストと回帰テストを実行し、実際の結果を記録します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Follow the TDD London School (mock-first) approach:

  1. Write the failing test first -- define expected behavior with mocked dependencies
  2. Run the test -- confirm it fails for the right reason
  3. Implement minimal code -- make the test pass with the simplest solution
  4. Refactor -- clean up while keeping tests green
  5. Repeat -- add the next behavior

Before starting: mcp__plugin_ruflo-core_ruflo__hooks_pre-task({ description: "TDD: FEATURE_NAME" }) Before reporting the outcome, run the final target tests and the regression suite after the last edit. Record the actual commands, exit codes, whether tests ran, and failing test names. The initial red test is expected during TDD; only the final validation determines success.

Call mcp__plugin_ruflo-core_ruflo__hooks_post-task with the observed result, including when the task is abandoned or validation is interrupted. Set completed, targetTestsRan, and regressionTestsRan to true only when observed; use null for missing exit codes. Skipped or unrun validation is not success. Never substitute an expected result for an observed one.

The following example maps those observations to the hook input (tool-call notation):

const success = completed && targetTestsRan && regressionTestsRan
  && targetExitCode === 0 && regressionExitCode === 0;
mcp__plugin_ruflo-core_ruflo__hooks_post-task({
  taskId: "tdd-FEATURE",
  success,
  storeResults: true,
  task: JSON.stringify({
    feature: "FEATURE",
    targetCommand, targetExitCode, targetTestsRan,
    regressionCommand, regressionExitCode, regressionTestsRan,
    failingTestNames,
    failureReason: success ? null : failureReason
  })
});

On failure, report success: false and the failing test names in task. If the runner failed before identifying tests, or the task was abandoned, state that reason instead of inventing test names.

Principles:

  • Mock external dependencies at boundaries
  • Test behavior, not implementation
  • One assertion per test when possible
  • Descriptive names: should [behavior] when [condition]
よくある質問

最初に失敗するテストは問題ですか?

いいえ。ソースによると、この手法では最初の赤いテストは想定どおりです。成功を決めるのは最終的な検証だけです。

成功とは何ですか?

対象のテストと回帰のスイートの両方が実際に実行され、通過する必要があります。スキップされたテストは成功ではありません。

結果は記録されますか?

はい。観測された結果とともに、作業の結果をメモリのフックに報告します。

詳細

作者による元の説明

TDD London School workflow -- mock-first, outside-in test development

repo: ruvnet/ruflo

人気

GitHubのスター
81k
ランキング
#1701
ライセンス
MIT
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル