本文へスキップ
Skillpedia
テスト95k · #1315

test-driven-development

できること

このスキルは、まず問題を示すテストを書き、その後に小さな修正を加える、テスト駆動開発をAIに導きます。変更が機能している証拠がほしい開発者向けです。

使う場面

  • ✓テストを先に書いて、新機能を作りたいとき。
  • ✓バグを直すとき、まず失敗するテストで修正を証明したいとき。
  • ✓既存のテストを壊さずに、振る舞いを変えたいとき。

スキルのリンク

https://github.com/odysseus-dev/odysseus/blob/dev/resources/skills/general/test-driven-development/SKILL.md

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

使い方

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

貼り付け用メッセージ

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

AIへの頼み方の例

“空の検索結果でページがクラッシュするバグを直してください。まず失敗するテストを書き、その後に修正してください。”

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

仕組み

AIは既存のコードとテストを読み、期待される振る舞いを示す最も小さなテストを書いて、それが失敗することを確認します。その後、テストを通す最小の変更を加え、差分をレビューします。

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

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

When to Use

Use when implementing a feature, fixing a bug, or changing behavior where a regression test can define the expected result. Prefer this workflow for parser, routing, agent-loop, and UI behavior changes.

Procedure

  1. Inspect the relevant code, existing tests, and local conventions before editing.
  2. Write the smallest regression test that demonstrates the requested behavior or reproduces the bug.
  3. Run that test and confirm it fails for the expected reason, not because the test setup is broken.
  4. Make the smallest production change that makes the test pass.
  5. Run the focused test again, then run the surrounding module suite.
  6. Review the diff for unrelated changes, brittle assertions, hidden state, and missing error paths.
  7. Report the tests run and any remaining coverage or environment limits.

Pitfalls

  • Do not write a test that only mirrors the implementation; assert the user-visible contract.
  • Do not weaken an assertion just to make a failing test pass.
  • Do not skip the focused failing-test step when the behavior is observable in a local test.
  • Keep network, filesystem, and model calls deterministic with fakes or fixtures unless the integration itself is under test.

Verification

  • The new regression test fails before the fix and passes after it.
  • The relevant focused suite passes.
  • The broader suite passes or its failure is explained with evidence.
  • The final diff contains the test and the production change needed for the same behavior.
よくある質問

なぜテストが最初に失敗する必要があるのですか?

失敗するテストは、テストが本当に振る舞いを確認していることを示し、偶然通ってしまうのを防ぐとスキルは述べています。

テストを通すためにアサーションを弱めますか?

いいえ。失敗するテストを通すためだけにアサーションを弱めないよう、スキルは述べています。

テストでネットワーク呼び出しはどう扱いますか?

接続そのものが検証対象でない限り、フェイクやフィクスチャで予測可能にしておくとスキルは述べています。

詳細

作者による元の説明

Build or fix software with a focused red-green-refactor loop

repo: odysseus-dev/odysseus

人気

GitHubのスター
95k
ランキング
#1315
ライセンス
AGPL-3.0
更新日
2026/11/2

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

0

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

コメント

  • …

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

似ているスキル