本文へ移動
cccskills
無料GitHub で公開日本語紹介

tdd

機能追加やバグ修正を、失敗するテストと最小限の実装の順に進めます。利用者が使う公開インターフェースを通じて動作を確かめ、内部構造に依存しないテストを作るスキルです。

原文原文の説明を見る

Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

インストール方法を見る

こんなときに便利

  • テストを先に書いて機能追加したいとき
  • バグの再現テストから修正したいとき
  • 統合テストの対象を決めたいとき
  • 内部構造に依存したテストの見直し

日本語での紹介

できること

機能追加やバグ修正を、失敗するテストを書いてから、それを通す最小限の実装を加える順に進めます。公開インターフェース、つまり呼び出し側が使う入口から動作を確認し、内部構造が変わっても使い続けられるテストを目指します。期待値は仕様や既知の正しい例に基づき、実装と同じ計算で作らない方針です。

こんなときに便利

テストを先に書いて開発したいときや、統合テストの対象を絞りたいときに向いています。テストをまとめて書くのではなく、対象の入口を一つ選び、テスト一つと実装一つを積み重ねます。内部メソッドや過剰なモックに依存したテストの見直しにも役立ちます。

使い方の例

  • 「この機能を、失敗するテストから一つずつ実装して」
  • 「このバグを再現するテストを先に書いて修正して」
  • 「統合テストで確認する公開インターフェースを一緒に決めて」

注意点

テストを書く前に、対象とする入口を利用者と確認します。GLOSSARY.mdがあれば参照し、関連するADR(設計判断の記録)を尊重します。リファクタリングは実装の反復に含めず、code-reviewによるレビュー段階で扱います。

この紹介文は、公開されている SKILL.md をもとに AI(Claude Haiku)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(4)

  • SKILL.md3.5 KB
  • agents/openai.yaml87 B
  • mocking.md1.4 KB
  • tests.md2.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Test-Driven Development

TDD is the red → green loop. This skill is the reference that makes that loop produce tests worth keeping: what a good test is, where tests go, the anti-patterns, and the rules of the loop. Every section applies on every cycle: consult them before and during the loop, not after.

When exploring the codebase, read GLOSSARY.md (if it exists) so test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.

What a good test is

Tests verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't. A good test reads like a specification: "user can checkout with valid cart" tells you exactly what capability exists, and it survives refactors because it doesn't care about internal structure.

See tests.md for examples and mocking.md for mocking guidelines.

Seams: where tests go

A seam is the public boundary you test at: the interface where you observe behavior without reaching inside. Tests live at seams, never against internals.

Test only at pre-agreed seams. Before writing any test, write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam. You can't test everything, so agreeing the seams up front is how testing effort lands on the critical paths and complex logic instead of every edge case.

Ask: "What's the public interface, and which seams should we test?" Give each proposed seam a one-line note on what it catches and what it misses.

When the shape of that interface is itself in question (how deep the module is, where the seam belongs, what the interface should expose), call the Skill tool with "codebase-design" for the vocabulary. It is the shared source of the module, interface, depth, seam, adapter, leverage and locality terms, and it is a reference to consult, not a session to run.

Anti-patterns

  • Implementation-coupled: mocks internal collaborators, tests private methods, or verifies through a side channel (querying the database instead of using the interface). The tell: the test breaks when you refactor but behavior hasn't changed.
  • Tautological: the assertion recomputes the expected value the way the code does (expect(add(a, b)).toBe(a + b), a snapshot derived by hand the same way, a constant asserted equal to itself), so it passes by construction and can never disagree with the code. Expected values must come from an independent source of truth: a known-good literal, a worked example, the spec.
  • Horizontal slicing: writing all tests first, then all implementation. Bulk tests verify imagined behavior: you test the shape of things rather than user-facing behavior, the tests go insensitive to real changes, and you commit to test structure before understanding the implementation. Work in vertical slices instead: one test → one implementation → repeat, each test a tracer bullet that responds to what the last cycle taught you.

Rules of the loop

  • Red before green. Write the failing test first, then only enough code to pass it. Don't anticipate future tests or add speculative features.
  • One slice at a time. One seam, one test, one minimal implementation per cycle.
  • Refactoring is not part of the loop. It belongs to the review stage (see the code-review skill), not the red → green implementation cycle.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

ask-matt

無料日本語概要

アイデアの整理、実装、不具合調査など、状況に合う関連スキルと使う順序を案内します。作業の規模や段階に応じて、次に進む手順を選ぶための相談役です。

  • アイデアから実装までの手順選び
  • 不具合調査の始め方を知りたいとき
  • 複数回に分ける開発の進め方を相談
mattpocock/skills28.8万2026年10月12日 更新

chief-of-staff

無料日本語概要

長期的な目標に向けて複数のサブエージェントの作業を調整し、利用者との対話を続けながら、次の仕事にも役立つ作業環境や規約の改善を進めるスキル。

  • 長期目標に向けて担当を調整したいとき
  • 裏で作業を進めながら対話を続けたいとき
  • 共通の規約や作業環境を改善したいとき
mattpocock/skills28.8万2026年10月12日 更新

claude-handoff

無料日本語概要

進行中の会話を引き継ぎ用に要約し、新しいバックグラウンドエージェントへ渡します。次の作業方針や参照資料を整理して、現在の作業場所で続きを始めます。

  • 新しいエージェントに続きを任せたいとき
  • 次の作業範囲を絞って引き継ぎたいとき
  • 次のセッション用に参照資料を整理
mattpocock/skills28.8万2026年10月12日 更新

code-review

無料日本語概要

指定したコミットやブランチなどを基準にコードの変更を確認し、開発規約への適合と仕様の実現を別々にレビューします。二つの観点の指摘を分けて報告するスキルです。

  • ブランチやPRの変更レビュー
  • 指定コミットやタグ以降の確認
  • 文書化された開発規約との照合
mattpocock/skills28.8万2026年10月12日 更新

codebase-design

無料日本語概要

呼び出し側が覚える使い方を小さく保ち、複雑な処理を内部にまとめる設計を支援します。共通の用語と判断基準で、モジュールの使いやすさやテストのしやすさを検討するスキルです。

  • モジュールの使い方を簡単にしたいとき
  • 散らばった複雑な処理をまとめたいとき
  • 実装を差し替える場所の検討
mattpocock/skills28.8万2026年10月12日 更新

diagnosing-bugs

無料日本語概要

再現しにくい不具合や処理速度の悪化を、症状を判定するテストやスクリプトで調べます。原因候補の検証から修正、再発防止の確認まで進めるスキル。

  • 再現しにくいエラーを調べたいとき
  • 処理が遅くなった原因の調査
  • 断続的な不具合を繰り返し検証
mattpocock/skills28.8万2026年10月12日 更新

mattpocock のスキルをすべて見る

このスキルの問題を報告する