---
name: review-requirements
description: Review the REQUIREMENTS.md document's contents using a structured 3-tier severity checklist.
argument-hint: "Relative path of the requirements document to review (default: docs/REQUIREMENTS.md)"
---

Read and review the contents of the target REQUIREMENTS.md document in the workspace using a structured checklist with three severity levels (問題, 要確認, 提案).

## Review Checklist

### 1. 問題 (Issue/Problem - High Severity)

*Critical errors, logic flaws, or gaps that must be corrected.*

*   **構成要素の不足 (Missing Core Sections)**: Check if required sections are present: "機能一覧" and "画面一覧".
*   **設計・セキュリティ情報の混入 (Rule Violation)**: Check if specific implementation details, database schema designs, code snippets, or security mitigation designs are mixed into the requirements definition. (These should be moved to `DESIGN.md`, `ARCHITECTURE.md` or `SECURITY.md`).
*   **要件の矛盾・不整合 (Contradicting Requirements)**: Ambiguities or logical clashes between the feature list and screen list.
*   **コンセプトとの乖離 (Inconsistency with CONCEPT.md)**: Features or requirements that go beyond or mismatch the scope defined in `docs/CONCEPT.md`.

### 2. 要確認 (Needs Confirmation/Clarification - Medium Severity)

*Items that require clarification or validation.*

*   **機能要件の定義の具体性 (Vagueness in Feature Rules)**: Input validations, logic branch boundaries, or business logic conditions that are undefined or vague in the feature descriptions.
*   **非機能要件の記載 (Non-Functional Requirements Location)**: Performance goals or accessibility specs that should be marked for moving to `ARCHITECTURE.md`.
*   **画面構成・画面遷移の曖昧さ (Screen Transitions)**: Missing or confusing relations between screens in the screen list.

### 3. 提案 (Suggestion/Recommendation - Low Severity)

*Constructive ideas to improve clarity, aesthetics, or user experience.*

*   **画面遷移図の追加 (Screen Flow Diagram)**: Suggest using a Mermaid flowchart to illustrate screen transitions.
*   **機能一覧の表形式化 (Feature Table)**: Recommendations to format feature lists with ID, Name, Overview, Input, Output, and priority fields in a table.

---

## Execution Flow

1. **Locate Target File**:
   *   If a file path is provided as an argument, use it as the target.
   *   If no argument is provided, default to `docs/REQUIREMENTS.md`.
2. **Read Content**:
   *   Read the file content.
3. **Conduct Review**:
   *   Analyze the document line-by-line or section-by-section against the checklist.
4. **Save Report to File**:
   *   Save the formatted review report to `.review/[relative-path-to-target-document]` relative to the project root (e.g., `.review/docs/REQUIREMENTS.md`).
   *   Ensure the directories inside `.review/` are created automatically if they do not exist.
   *   If the report file already exists, overwrite it with the new review content.
5. **Output Report**:
   *   Present the structured review report in the chat and notify the user of the path to the saved file.

---

## Output Report Format

Output the review report using the following structure:

```markdown
# Document Review Report: [file basename]

Review of: `[relative/path/to/file]`

## Executive Summary

| Severity | Count | Key Focus |
| --- | --- | --- |
| 🔴 問題 (High) | 0 | Critical issues requiring immediate correction |
| 🟡 要確認 (Medium) | 0 | Items requiring user confirmation or alignment |
| 🟢 提案 (Low) | 0 | Suggestions for readability and quality |

---

## Detailed Findings

### 🔴 問題 (High Severity)
*List critical issues.*

- **[Short Summary of Issue]**
  - **Location**: Line X-Y / Section name
  - **Original Text**: `[original text]`
  - **Description**: [Why it is a problem]
  - **Recommended Action**: [Specific, actionable fix]

### 🟡 要確認 (Medium Severity)
*List items needing confirmation.*

- **[Short Summary]**
  - **Location**: Line X-Y / Section name
  - **Original Text**: `[original text]`
  - **Description**: [What needs confirmation and why]
  - **Recommended Action**: [Specific clarification questions or options]

### 🟢 提案 (Low Severity)
*List suggestions.*

- **[Short Summary]**
  - **Location**: Line X-Y / Section name
  - **Original Text**: `[original text]`
  - **Description**: [How it could be improved]
  - **Recommended Action**: [Concrete suggested text or structure]
```
