Back to list
bigdegenenergy

tdd

by bigdegenenergy

CLI tool that audits repositories for agent-readiness and outputs human + machine-readable reports

0🍴 0📅 Jan 23, 2026

SKILL.md


name: tdd description: Test-Driven Development patterns and red-green-refactor workflow. Auto-triggers when writing tests first, implementing TDD, or discussing test coverage.

Test-Driven Development

The Red-Green-Refactor Cycle

  1. RED: Write a failing test that defines expected behavior
  2. GREEN: Write minimal code to make the test pass
  3. REFACTOR: Improve code quality while keeping tests green

Critical Rules

  • Never write production code without a failing test first
  • Only write enough code to make the current test pass
  • Refactor only when tests are green
  • Run tests after every change

Test Structure (AAA Pattern)

// Arrange - Set up test data and conditions
// Act - Execute the code under test
// Assert - Verify the expected outcome

Test Naming Convention

test_[unit]_[scenario]_[expected_result]

Examples:
- test_calculateTotal_emptyCart_returnsZero
- test_userLogin_invalidPassword_throwsAuthError
- test_parseDate_invalidFormat_returnsNull

Test Doubles

TypePurposeUse When
StubReturns canned dataTesting with specific inputs
MockVerifies interactionsChecking method calls
FakeWorking implementationNeed realistic behavior
SpyRecords callsObserving side effects

Coverage Targets

  • Unit tests: >90% line coverage
  • Integration tests: Critical paths covered
  • E2E tests: Happy paths + key error scenarios

Anti-Patterns to Avoid

  • Testing implementation details (test behavior, not internals)
  • Overly specific assertions (leads to brittle tests)
  • Test interdependence (each test must be isolated)
  • Testing trivial code (getters/setters)
  • Ignoring flaky tests (fix or remove immediately)

TDD for Different Contexts

API Endpoints

  1. Test request validation
  2. Test business logic
  3. Test response format
  4. Test error handling

UI Components

  1. Test rendering with props
  2. Test user interactions
  3. Test state changes
  4. Test accessibility

Database Operations

  1. Test CRUD operations
  2. Test constraints/validation
  3. Test transactions
  4. Test edge cases (null, empty)

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

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

+20
LICENSE

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

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

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

0/5
Issue管理

オープンIssueが50未満

+5
言語

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

+5
タグ

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

0/5

Reviews

💬

Reviews coming soon