本文へスキップ
Skillpedia
テスト41k · #7027

tdd

できること

このスキルは、テストを先に書き、それを通す最小限のコードを書くことで、エージェントにコードを作らせます。各変更が、コードより前に書かれたテストで証明されてほしい開発者向けです。

使う場面

  • ✓新しい動作を、テストファーストで1つずつ小さな手順で作りたいとき。
  • ✓バグを、それを再現するテストを先に書いてから直したいとき。
  • ✓コードそのものからではなく、信頼できる情報源からテストを書きたいとき。

スキルのリンク

https://github.com/Yeachan-Heo/oh-my-claudecode/blob/main/skills/tdd/SKILL.md

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

使い方

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

貼り付け用メッセージ

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

AIへの頼み方の例

“価格ルールのテストを、1つずつ小さな手順で先に書いてください。仕様書の例を使ってください。”

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

仕組み

エージェントは、合意された節目で次のテストを書き、それが期待どおりの理由で失敗することを確認します。その後、テストを通す最小限の変更を書きます。このサイクルを繰り返し、リファクタリングは後のレビューの段階に回します。

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

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

TDD

Red-green in small steps, at seams that were agreed in advance. In a launch run the seam list is C2's approved output; outside launch, agree the seams with the user before the first test exists — a seam nobody approved gets no tests.

The loop

One test → one implementation → repeat:

  1. Write the next test at a seam. Run it. Watch it fail for the reason you expect — a test that cannot fail is not a test.
  2. Implement the smallest change that turns it green.
  3. Repeat. Each test is a tracer bullet: a narrow but complete path through the behavior, not a layer finished in isolation.

Rules

  • Expected values come from an independent source of truth — a spec line, a worked example, a documented output. Never from the implementation under test: a test that asserts what the code happens to do is a mirror, not a check.
  • Substitute at the seam's declared boundary class only — in-process, locally substitutable, owned-remote port, or true-external, the class C2 records for each seam. No substitutes inside the boundary the test is exercising.
  • Refactoring is not part of the loop. It belongs to the review stage; the repair worker owns it. Do not refactor mid-red-green.
  • A bug fix starts with the failing test that reproduces it — reproduction before theory, the debugger's rule.
  • When proposing a seam, say in one line what it catches and what it lets through — a seam choice nobody can price is a guess, not a decision.

When no seam fits

If the behavior cannot be tested at any approved seam, stop and say so: report the missing seam as a finding (it feeds architecture-survey and refit) rather than inventing a seam or testing through internals.

Output

  • The seam list used, with boundary classes and each seam's catch/miss line
  • Red/green evidence — the failing run and the passing run
  • Any seam-absence findings
よくある質問

テストはコードの動作をそのままコピーしますか?

いいえ。期待値は、仕様書や具体例などの独立した情報源から来ます。テスト対象のコードからは取りません。

テストはどこに書かれますか?

事前に合意された箇所だけに書かれます。誰も承認していない箇所に対してテストは書きません。

リファクタリングはいつ行われますか?

赤と緑のループの中ではなく、後のレビューの段階で行われます。

詳細

作者による元の説明

Test-first at pre-agreed seams — one test, one implementation, tracer-bullet red/green; independent expected values; substitutions only at the seam's boundary class; launch Phase 4 reference.

repo: Yeachan-Heo/oh-my-claudecode

人気

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

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

0

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

コメント

  • …

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

似ているスキル