# Query Extraction

## Context

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

## Instructions

Read ALL feature docs and extract read-only query definitions.

1. Read ALL feature docs at the paths above
2. For each feature, identify read operations needed by external consumers
3. For each read operation, extract:
   - Query name (following naming convention)
   - Input parameters
   - Output shape
   - Business logic (filtering, aggregation, conversion)

## Query Identification

Queries are read-only operations for external consumers. Look for:

- **Lookups**: "Get X by Y", "Find X where Z"
- **Conversions**: "Convert X to Y", "Calculate X"
- **Aggregations**: "Total X", "Count X by Y"
- **Listings**: "List all X", "List X by status"

See [CQRS read rule](../../erp-kit-shared/references/commands.md#command-side-reads-cqrs-separation) for when to use queries vs command-side reads.

## Naming Convention

| Operation           | Query Name               |
| ------------------- | ------------------------ |
| Get single entity   | `get{Entity}`            |
| List by status      | `list{Status}{Entities}` |
| List all            | `list{Entities}`         |
| Search with filters | `search{Entities}`       |
| Calculate/convert   | `calculate{Result}`      |
| Aggregate           | `get{Aggregate}`         |

## Output Format

Return your extraction as a structured markdown report:

### Queries

For each query:

#### <queryName>

- **Source features:** list of feature files
- **Inputs:**

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

- **Output:** type (single/list/aggregate) and shape description
- **Business logic:** description of filtering, aggregation, or transformation
