mcpField
T
test-first

test-first

github.com/s-hiraokuTesting & quality1769 installsUpdated 3w ago
Repository

About test-first

A test-first development skill for developers using the Red-Green-Refactor cycle. It covers test structure, coverage of edge cases, and practices for reliable, maintainable tests.

Key features

  1. 01Red-Green-Refactor workflow
  2. 02Happy-path and edge-case coverage
  3. 03Arrange-Act-Assert structure
  4. 04Independent, descriptive tests
  5. 05Fast unit test guidance

Use cases

  1. 01Start a feature with a failing test
  2. 02Check boundary and error behavior
  3. 03Organize tests around one concept
  4. 04Keep unit tests maintainable

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/s-hiraoku/synapse-a2a --skill test-first

After installing, type/test-firstin Claude Code to confirm it loaded.

Details

From the project README

Test-First Development Skill

Test-First Development (TDD) ensures that code is written to satisfy specific, predefined requirements, leading to higher quality and better design.

TDD Workflow

  1. Red: Write a failing test for a small piece of functionality.
  2. Green: Write the minimum amount of code required to make the test pass.
  3. Refactor: Clean up the code while ensuring the tests remain green.

Test Design Principles

1. Comprehensive Coverage
  • Normal Cases: Test the expected "happy path" behavior.
  • Boundary Values: Test inputs at the edges of valid ranges (e.g., 0, max_int, empty strings).
  • Edge Cases: Test unusual or extreme conditions (e.g., network timeout, disk full, null values).
  • Error Handling: Verify that the system fails gracefully and returns appropriate error messages.
2. Structure (Arrange-Act-Assert)

Follow the AAA pattern for clear and maintainable tests:

  • Arrange: Set up the necessary preconditions and inputs.
  • Act: Execute the function or method being tested.
  • Assert: Verify that the outcome matches the expectation.

Best Practices

  • One Assertion per Test: Aim to test a single concept per test case.
  • Descriptive Naming: Name tests clearly (e.g., test_should_reject_invalid_api_key).
  • Independence: Ensure tests do not depend on each other or on a specific execution order.
  • Fast Execution: Keep unit tests fast to encourage frequent execution.

Comments

Markdown supported