# Command Extraction

## Context

Module: {{MODULE_NAME}}
Feature docs: {{FEATURE_DOCS}}

## Instructions

Read ALL feature docs and extract command (write operation) definitions.

1. Read ALL feature docs at the paths above
2. For each feature, identify operations that change state
3. For each operation, extract:
   - Command name (following naming convention)
   - Input parameters
   - Business rules and validations
   - Error scenarios
   - Process flow (step-by-step)

## Naming Convention

See [naming.md](naming.md) for the full canonical verb vocabulary.

Key mappings:

| Feature Operation    | Command Name   |
| -------------------- | -------------- |
| "Create X" / "Add X" | `createX`      |
| "Update X"           | `updateX`      |
| "Delete X"           | `deleteX`      |
| "Deactivate X"       | `deactivateX`  |
| "Activate X"         | `activateX`    |
| "Reactivate X"       | `reactivateX`  |
| "Set default X"      | `setDefaultX`  |
| "Assign X to Y"      | `assignXToY`   |
| "Remove X from Y"    | `removeXFromY` |
| "Revoke X from Y"    | `revokeXFromY` |
| "Move X"             | `moveX`        |
| "Log X"              | `logX`         |

**Banned verbs**: `archive`, `unarchive`, `disable`, `enable`, `add...To...`, `unlink`

## Extraction Rules

### Business Rules

- Extract explicit validation rules from feature scenarios
- Extract implicit rules from test cases ("should not allow X when Y")
- Map each rule to an error scenario

### Error Scenarios

- For each business rule violation, define an error code
- Follow SCREAMING_SNAKE_CASE convention
- Categories: NOT_FOUND, DUPLICATE, LOCKED/INACTIVE, INVALID_STATE, NO_OP

### Process Flow

- Extract step-by-step flow from feature scenarios
- Identify branching points (conditional logic)
- Map to validate → query → mutate pattern

## Output Format

Return your extraction as a structured markdown report:

### Commands

For each command:

#### <commandName>

- **Source features:** list of feature files
- **Target model:** ModelName
- **Inputs:**

| Param | Type | Required | Description |
| ----- | ---- | -------- | ----------- |

- **Business Rules:**

| Rule | Error Code | Error Message |
| ---- | ---------- | ------------- |

- **Process Flow:** numbered steps
- **Permissions:** list
