tdd-workflow

Enforce a TDD workflow for TypeScript Tetris game logic with fast-check property tests.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/sakataka/tetris-game2 --skill tdd-workflow-sakataka
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tdd-workflow
Source: https://github.com/sakataka/tetris-game2/tree/main/.claude/skills/tdd-workflow
Command: npx skills add https://github.com/sakataka/tetris-game2 --skill tdd-workflow-sakataka

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guidance for Test-Driven Development of Tetris game logic with red-green-refactor, co-located tests, and property-based testing.

Core Features & Use Cases

  • Red-Green-Refactor cycle
  • Co-located tests next to implementation
  • Property-based testing with fast-check
  • 160+ tests coverage

Quick Start

Write a failing test for a new feature, implement minimum code to pass, and refactor for quality. For example, add tests for rotation edge cases and implement accordingly.

Frequently Asked Questions about tdd-workflow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write tests first and then implement game logic?

Test-Driven Development (TDD) starts with writing a failing test before implementation. Write your test for a specific game mechanic—like Tetris rotation—then write minimal code to pass it, and refactor while keeping tests green. This workflow ensures your logic is testable and correct from the start.

Can I use property-based testing with TypeScript and Bun?

Yes. fast-check enables property-based testing in TypeScript projects. With Bun's test runner, you can define properties that generate random test cases, verifying game logic holds across many inputs. This catches edge cases that manual tests might miss.

What's the best way to organize tests alongside game code?

Co-located tests place test files next to implementation files in the same directory. This keeps related logic visible together, makes refactoring easier, and clarifies coverage. For a Tetris game, store rotation tests beside rotation.ts for clarity and maintainability.

How do I achieve 100% test coverage for core game logic?

Enforce coverage targets by writing tests before code (red-green-refactor cycle), using property-based testing to explore edge cases, and measuring coverage with Bun's test tools. Co-located tests make uncovered paths visible, helping you reach and maintain 100% coverage for critical mechanics.

Should I use Result<T,E> patterns in my game logic?

Result<T,E> patterns (success or error returns) make failure modes explicit in game logic. Instead of throwing exceptions, return Results for operations like rotation or placement. This approach integrates cleanly with TDD, improves testability, and reduces surprises in production code.

What's the difference between TDD and writing tests after code?

TDD writes tests first, driving design through test requirements; post-hoc testing adds tests to existing code. TDD catches design issues early, ensures testability by default, and creates living documentation. For game logic, TDD prevents bugs in rotation, placement, and scoring before they ship.