takt/builtins/en/facets/instructions/write-tests-first.md
nrslib e75e024fa8 feat: default-test-first-mini ピースを追加
テストファースト開発ワークフロー(plan → write_tests → implement → review → fix)。
新規インストラクション write-tests-first, implement-after-tests を追加。
piece-categories に Mini カテゴリとテストファーストカテゴリとして登録。
2026-02-22 21:22:11 +09:00

1.7 KiB

Write tests based on the plan before implementing production code. Refer only to files within the Report Directory shown in the Piece Context. Do not search or reference other report directories.

Important: Do NOT create or modify production code. Only test files may be created.

Actions:

  1. Review the plan report and understand the planned behavior and interfaces
  2. Examine existing code and tests to learn the project's test patterns
  3. Write unit tests for the planned features
  4. Write E2E tests if appropriate
  5. Run the build (type check) to verify test code has no syntax errors

Test writing guidelines:

  • Follow the project's existing test patterns (naming conventions, directory structure, helpers)
  • Write tests in Given-When-Then structure
  • One concept per test. Do not mix multiple concerns in a single test
  • Cover happy path, error cases, boundary values, and edge cases
  • Write tests that are expected to pass after implementation is complete

Scope output contract (create at the start):

# Change Scope Declaration

## Task
{One-line task summary}

## Planned changes
| Type | File |
|------|------|
| Create | `src/__tests__/example.test.ts` |

## Estimated size
Small / Medium / Large

## Impact area
- {Affected modules or features}

Decisions output contract (at completion, only if decisions were made):

# Decision Log

## 1. {Decision}
- **Context**: {Why the decision was needed}
- **Options considered**: {List of options}
- **Rationale**: {Reason for the choice}

Required output (include headings)

Work results

  • {Summary of actions taken}

Changes made

  • {List of test files created}

Build results

  • {Build execution results}