# Screen Extraction

## Context

App: {{APP_NAME}}
Actor docs: {{ACTOR_DOCS}}
Business flow docs: {{BUSINESS_FLOW_DOCS}}
Story docs: {{STORY_DOCS}}

## Available Modules

The following modules are available in erp-kit. Use this to understand which entities exist and what operations are available.

{{MODULE_OVERVIEW}}

To inspect a specific module's model (domain description, state transitions, invariants, commands), run:

```bash
npx erp-kit doc module <module-name> model <model-name>
```

## Instructions

1. Read ALL actor docs at the paths above
2. Read ALL business flow docs at the paths above
3. Read ALL story docs at the paths above
4. Identify screens needed for each business flow and story
5. For screens that display or edit module entities, use `erp-kit doc module <name> model` to understand the entity's domain
6. Return results as a structured markdown report

## Extraction Rules

### Screen Identification

For each business flow step that involves UI:

1. Identify what the user sees or interacts with
2. Classify the screen type
3. Extract fields, columns, and actions

### Screen Types

| Screen Type   | When to Use                                          |
| ------------- | ---------------------------------------------------- |
| ListView      | User browses a list of entities (table with columns) |
| Form (create) | User fills in fields to create a new entity          |
| Form (edit)   | User modifies fields of an existing entity           |
| DetailView    | User views details of a single entity with actions   |

### Screen Content

For each screen, extract:

- **Name**: kebab-case, noun-focused (e.g., `supplier-list`, `supplier-detail`, `supplier-form`)
- **Type**: ListView / Form / DetailView
- **Fields/Columns**: what data is displayed or edited
- **Actions**: navigation actions (create, edit, back) and mutation actions (save, delete, activate)
- **Stories**: which stories reference this screen

### Deduplication

- Screens can be shared across multiple stories and flows
- If two flows need the same entity list view, create one screen doc referenced by both
- Create/edit forms for the same entity are separate screens (different field requirements)

## Naming Convention

- Screen filename: kebab-case, noun-focused
- Pattern: `<entity>-list.md`, `<entity>-detail.md`, `<entity>-create-form.md`, `<entity>-edit-form.md`

## Output Format

Return your findings as a structured markdown report:

### Screens

For each screen:

- **Screen:** `<screen-name>`
- **Type:** ListView / Form / DetailView
- **Module source:** which module's model provides the data (if applicable)
- **Fields/Columns:** bulleted list of fields with types
- **Actions:** bulleted list of actions
- **Referenced by stories:** which stories use this screen
- **Referenced by flows:** which business flows need this screen

### Summary

- Total screens extracted
- Screens by type (table: ListView, Form, DetailView counts)
