スキル一覧に戻る
pagerguild

tdd-red-phase

by pagerguild

Claude Code plugin marketplace - Modular plugins for workflow automation, TDD, code review, and development tools

0🍴 0📅 2026年1月15日
GitHubで見るManusで実行

SKILL.md


name: tdd-red-phase description: | TDD Red Phase expert. Activate when:

  • Starting new feature development with TDD
  • User mentions "write test first", "failing test", "red phase"
  • Need to design test cases before implementation
  • Questions about test structure, assertions, test naming Auto-triggers on: test design, test-first development, TDD start

TDD Red Phase: Write Failing Tests First

You are in the RED phase of Test-Driven Development.

Your Goal

Write a failing test that defines the expected behavior before any implementation exists.

Red Phase Rules

  1. Test First: Write the test BEFORE any implementation code
  2. Must Fail: The test MUST fail initially (proves it's not trivially passing)
  3. One Behavior: Each test should verify ONE specific behavior
  4. Descriptive Name: Test name should describe the expected behavior

Test Naming Convention

test_<function>_<scenario>_<expected_result>

Examples:
- test_user_create_valid_input_returns_user
- test_order_calculate_with_discount_applies_percentage
- test_auth_login_wrong_password_returns_401

Test Structure (AAA Pattern)

def test_feature_scenario_expected():
    # Arrange - Set up test data and preconditions
    input_data = {...}

    # Act - Execute the code under test
    result = function_under_test(input_data)

    # Assert - Verify the expected outcome
    assert result == expected_value

Language-Specific Test Files

LanguageTest File PatternExample
Go*_test.gouser_test.go
Pythontest_*.pytest_user.py
TypeScript*.test.tsuser.test.ts
Rusttests/*.rs or inline #[cfg(test)]tests/user.rs

Workflow

  1. Identify the behavior to implement
  2. Write the test that verifies this behavior
  3. Run the test - it MUST fail (red)
  4. Verify failure reason - should fail because code doesn't exist yet

Commands

# Set phase to RED
bash scripts/tdd-enforcer.sh phase red

# Check current phase
bash scripts/tdd-enforcer.sh phase

# Run tests (expect failure)
bash scripts/tdd-enforcer.sh run <file>

After Red Phase

Once your test is written and failing for the right reason:

# Move to GREEN phase
bash scripts/tdd-enforcer.sh phase green

Then write the minimal implementation to make the test pass.

Common Mistakes to Avoid

  • Writing implementation before tests
  • Writing tests that pass immediately (trivial tests)
  • Testing multiple behaviors in one test
  • Vague test names like test_user or test_1

スコア

総合スコア

65/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です