---
description: Standard workflow for implementing new features, including testing, verification, and documentation updates.
---

# Feature Implementation & Verification Workflow

Follow this process whenever a new feature is requested.

## 1. Implementation Phase
1.  **Analyze Request**: Understand the user's requirements.
2.  **Plan Changes**: Create or update the `implementation_plan.md`.
3.  **Execute**: Write the code to implement the feature.

## 2. Verification Phase (E2E Testing)
Once the feature is implemented, you must verify it works as expected.

1.  **Run Existing Tests**: Ensure no regressions.
    ```powershell
    npx playwright test
    ```
2.  **Manual Verification**: If Playwright tests are not sufficient or applicable yet, perform manual verification steps (or use the browser tool to simulate it).
3.  **Fix Bugs**: If any issues are found (either in automated tests or manual verification), fix them immediately. Repeat this step until the feature is stable.

## 3. Documentation Phase
After the feature is stable and working:

1.  **Update Requirements**: Modify `specs/requirements.md` to reflect the newly added functionality and any changes to existing logic. This is the source of truth.
2.  **Update Test Plan**:
    *   **File**: `specs/gymflow-test-plan.md`
    *   **Action**: Update this file with new test scenarios. Use the **Playwright-test-generator** agent to help identify gaps or create new detailed scenarios based on the updated requirements.

## 4. Test Generation Phase
1.  **Generate New Tests**:
    *   **Agent**: Use the `playwright-test-generator` agent.
    *   **Workflow**:
        *   Invoke the agent.
        *   Provide it with the updated `specs/requirements.md` and `specs/gymflow-test-plan.md`.
        *   Ask it to generate Playwright tests for the new scenarios.
    *   **File Path Convention**: `tests/<feature-name>/<scenario>.spec.ts`.
    *   **Verify**: Ensure the new tests pass reliably.

## 5. Finalize
1.  **Cleanup**: Remove any temporary debug logs or unused files.
2.  **Notify User**: Inform the user that the feature is complete, verified, and documented.
