tdd-workflow
できること
このスキルは、依存関係を先にモックするロンドン学派のスタイルで、テスト駆動開発の流れを導きます。テストが先頭に立って、機能を一歩ずつ作りたい開発者向けです。
使う場面
- ✓外側から内側へ、テストを先に書いて機能を作りたいとき。
- ✓新しい振る舞いについて、赤、緑、リファクタリングの流れを明確にしたいとき。
- ✓作業を完了とする前に、最終的なテストの結果を確認したいとき。
スキルのリンク
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-testgen/skills/tdd-workflow/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“モックされた価格設定のサービス向けに、失敗するテストから始めて、割引の計算をテストを先に書いて作ってください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、依存関係をモックした失敗するテストを書き、正しい理由で失敗することを確認します。次に、それを通す最も単純なコードを書き、リファクタリングします。成功を報告する前に、対象のテストと回帰テストを実行し、実際の結果を記録します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Follow the TDD London School (mock-first) approach:
- Write the failing test first -- define expected behavior with mocked dependencies
- Run the test -- confirm it fails for the right reason
- Implement minimal code -- make the test pass with the simplest solution
- Refactor -- clean up while keeping tests green
- 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]
よくある質問
最初に失敗するテストは問題ですか?
いいえ。ソースによると、この手法では最初の赤いテストは想定どおりです。成功を決めるのは最終的な検証だけです。
成功とは何ですか?
対象のテストと回帰のスイートの両方が実際に実行され、通過する必要があります。スキップされたテストは成功ではありません。
結果は記録されますか?
はい。観測された結果とともに、作業の結果をメモリのフックに報告します。
詳細
人気
- GitHubのスター
- 81k
- ランキング
- #1701
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
agent-adaptive-coordinator
81k作業量の変化に合わせて、エージェントのグループを分割し、再配分する手助けをします。作業に合った配置を選びます。
agent-agent
81k大きな目標を順番に並んだ行動計画にし、状況が変わったときに計画を立て直す方法をエージェントに教えます。
agent-agentic-payments
81kAIの買い物のために、支出の上限、期間、販売店のルール、署名付きの承認を含む支出の委任を管理する手助けをします。
agent-analyze-code-quality
81kコードの品質を確認し、コードの臭い、技術的負債、リファクタリングの案を見つける手助けをします。ファイルは変更しません。
似ているスキル
test-driven-development
311k機能や修正を作る前に、まず失敗するテストを書き、それが失敗するのを確認してから、合格させる最小のコードを書くようエージェントに教えます。
verification-before-completion
311kタスク、修正、ビルドが完了した、または合格したと主張する前に、実際のチェックを実行し、その出力を読むようエージェントに教えます。
migrate-to-shoehorn
310kテストファイル内の危険な型キャストを、shoehornライブラリに置き換え、テストが部分的なデータを使いつつ型チェックを通るようにします。