本文へ移動
cccskills
無料GitHub で公開

tdd

AI DevKit · Test-driven development — write a failing test before writing production code. Use when implementing new functionality, adding behavior, or fixing bugs during active development.

インストール方法を見る

含まれるファイル(2)

  • SKILL.md3.3 KB
  • agents/openai.yaml283 B

SKILL.md(原文)

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

TDD

Red. Green. Refactor. In that order, every time.

Hard Rules

  • No production code without a failing test first.
  • If production code was written before its test, delete it and start over with a failing test.
  • Never skip the red step. A test that has never failed proves nothing.

Cycle

For each unit of behavior:

  1. Red — Write a test for the next behavior. Run it. It must fail. Read the failure message — it should describe the missing behavior.
  2. Green — Write the minimum production code to make the test pass. Nothing more. Run the test. Apply the verify skill.
  3. Refactor — Clean up both test and production code. Run the test again. Still green? Done. Apply the verify skill.

Then pick the next behavior and repeat.

Rules for Each Step

Red:

  • Test one behavior, not one function. Name the test after what the system should do, not what the function is called.
  • The test must fail for the right reason — a missing method, wrong return value, unmet condition. Not a syntax error or import failure.
  • If the test passes immediately, it's not testing new behavior. Delete it or pick a different behavior.

Green:

  • Write the simplest code that passes. Hardcode if needed — the next test will force generalization.
  • Do not add code "while you're in there." If it's not required by a failing test, it doesn't exist yet.
  • Do not refactor during green. Pass first, clean second.

Refactor:

  • Remove duplication between test and production code.
  • Extract only when you see real duplication, not predicted duplication.
  • Tests must still pass after every refactor move. Run them after each change.

Anti-Patterns

PatternProblemFix
Test-afterCode shapes the test instead of the other way aroundDelete the code, write the test first
Testing internalsTests break on refactor, not on behavior changeTest public behavior only
Giant red stepMultiple behaviors in one testOne assertion per behavior
Gold-plating greenAdding code no test requiresRemove untested code
Skipping refactorTech debt accumulates immediatelyRefactor before the next red
Mock-heavy testsTests pass but real code failsPrefer real dependencies, mock at boundaries only

Red Flags and Rationalizations

RationalizationWhy It's WrongDo Instead
"This is too simple to test first"Simple code still needs a specWrite the test — it'll be fast
"I'll add the test right after"You won't, and the code will shape the testTest first, always
"I need to see the design first"The test IS the designLet the test drive the interface
"Mocking is too hard for this"Difficulty mocking signals tight couplingFix the design, then test
"The test would be identical to the implementation"Then you're testing internalsTest the behavior from the outside

Memory Integration

After completing a TDD session, store reusable test patterns (setup, assertions, fixtures): npx ai-devkit@latest memory store --title "<pattern>" --content "<details>" --tags "tdd,testing"

レビュー

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

同じリポジトリのスキル

概要と使いどころ

AI DevKit · Exchange information with active Codex, Claude Code, and other AI agents using ai-devkit agent list, detail, and send. Use when an agent needs to find another active agent, read its recent context, send it information, or request information back.

日本語の概要は準備中です。原文の説明を表示しています。

codeaholicguy/ai-devkit1,6442026年10月9日 更新

AI DevKit · Manage running AI agents with ai-devkit agent commands. Use when an agent needs to identify itself, list agents, start workers, inspect agent detail, assign work, group agents, resume sessions, stop agents, or delegate work to other agents.

日本語の概要は準備中です。原文の説明を表示しています。

codeaholicguy/ai-devkit1,6442026年10月9日 更新

AI DevKit · Supervise multi-agent workflows over repeated passes: poll progress, unblock waiting agents, coordinate dependencies, relay outputs, resolve conflicts, and verify completion. Use only for ongoing multi-agent coordination, not one-off list/detail/send/start/kill actions.

日本語の概要は準備中です。原文の説明を表示しています。

codeaholicguy/ai-devkit1,6442026年10月9日 更新

AI DevKit · Check local AI DevKit readiness and run setup only when status shows onboarding or harness integration gaps.

日本語の概要は準備中です。原文の説明を表示しています。

codeaholicguy/ai-devkit1,6442026年10月9日 更新

AI DevKit · Use when the user asks to brainstorm, ideate, generate ideas, expand options, challenge ideas, pressure-test ideas, compare concepts, narrow choices, name something, plan content angles, explore strategy, evaluate product ideas, technical approaches, experiments, or decisions.

日本語の概要は準備中です。原文の説明を表示しています。

codeaholicguy/ai-devkit1,6442026年10月9日 更新

changelog

無料

AI DevKit · Update CHANGELOG.md Unreleased items from git commits since the latest release. Use when users ask to update changelog/release notes from recent commits, with one concise line per commit and commit/PR links.

日本語の概要は準備中です。原文の説明を表示しています。

codeaholicguy/ai-devkit1,6442026年10月9日 更新

codeaholicguy のスキルをすべて見る

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