Example of a Prompt

Agent: Document Agent

<aside> <img src="notion://custom_emoji/be6005d7-8302-4c8e-93fe-03d0d3d71970/12f3c107-d7a8-8009-8054-007a9b09b0b8" alt="notion://custom_emoji/be6005d7-8302-4c8e-93fe-03d0d3d71970/12f3c107-d7a8-8009-8054-007a9b09b0b8" width="40px" />

@Order List Monthly Report Screen_Requirements Specification I would like to design a daily batch to aggregate data for display on the screen. Please output it according to the @Batch Design Template format.

</aside>

Template

## 1. Basic Information

| Item          | Content                    |
| ------------- | -------------------------- |
| Batch ID      | \\[Unique batch identifier] |
| Batch Name    | \\[Name of batch process]   |
| Author        | \\[Author name]             |
| Creation Date | \\[Creation date]           |
| Last Updated  | \\[Last updated date]       |
| Version       | \\[Document version]        |

## 2. Overview

### 2.1 Purpose

\\[Briefly describe the purpose and role of this batch process]

### 2.2 Process Overview

\\[Describe the overall flow and main functions of the batch process]

### 2.3 Execution Frequency

- Execution Timing: \\[Daily/Weekly/Monthly/Other]
- Execution Time: \\[HH:MM]
- Schedule Details: \\[Cron expression or specific conditions]

## 3. Prerequisites and Dependencies

### 3.1 Prerequisites

\\[List the prerequisites required to execute the batch]

### 3.2 Dependent Systems/Batches

\\[Other systems or batch processes this batch depends on]

### 3.3 Execution Order Constraints

\\[Constraints regarding execution order with other batches]

## 4. Input Information

### 4.1 Input Files

| File Name    | Format               | Location | Description    |
| ------------ | -------------------- | -------- | -------------- |
| \\[File name] | \\[CSV/XML/JSON etc.] | \\[Path]  | \\[Description] |

### 4.2 Input Parameters

| Parameter Name | Data Type | Required | Default Value | Description    |
| -------------- | --------- | -------- | ------------- | -------------- |
| \\[Parameter]   | \\[Type]   | \\[Y/N]   | \\[Default]    | \\[Description] |

### 4.3 Database Input

| Table Name    | Main Columns | Retrieval Conditions | Description    |
| ------------- | ------------ | -------------------- | -------------- |
| \\[Table name] | \\[Columns]   | \\[WHERE conditions]  | \\[Description] |

## 5. Process Flow

### 5.1 Overall Flowchart

Create the flowchart for this process using Mermaid according to the following legend.

```mermaid
flowchart TD
    subgraph Legend
        A((Start/End Node)) 
        B[Process Step/Action]
        C{Branch/Condition}
        D[[Database Operation]]
        E[[File Input/Output]]
        F[/Error Handling/]
        G((Subprocess/Function Call))
        H[(Database)]
        
        style A fill:#e0e0e0,stroke:#333,stroke-width:2
        style B fill:#2196f3,stroke:#0d47a1,stroke-width:2,color:#fff
        style C fill:#ff9800,stroke:#e65100,stroke-width:2,color:#fff
        style D fill:#43a047,stroke:#1b5e20,stroke-width:2,color:#fff
        style E fill:#ffd600,stroke:#fbc02d,stroke-width:2,color:#333
        style F fill:#d32f2f,stroke:#b71c1c,stroke-width:2,stroke-dasharray: 5 5,color:#fff
        style G fill:#8e24aa,stroke:#4a148c,stroke-width:2,color:#fff
        style H fill:#0097a7,stroke:#006064,stroke-width:2,color:#fff

        noteA[Start/End]
        noteB[Main Process]
        noteC[Condition]
        noteD[DB Operation]
        noteE[File I/O]
        noteF[Error Handling]
        noteG[Subprocess]
        noteH[Database]
        
        A-->|Example|noteA
        B-->|Example|noteB
        C-->|Example|noteC
        D-->|Example|noteD
        E-->|Example|noteE
        F-->|Example|noteF
        G-->|Example|noteG
        H-->|Example|noteH
    end

5.2 Process Steps

  1. \[Description of Step 1]
  2. \[Description of Step 2]
  3. \[Description of Step 3]

5.3 Main Algorithms

\[Description of complex logic or important algorithms]

6. Output Information

6.1 Output Files

File Name Format Output Location Description
\[File name] \[CSV/XML/JSON etc.] \[Path] \[Description]

6.2 Database Updates

Table Name Operation Type Main Columns Update Conditions Description
\[Table name] \[INSERT/UPDATE/DELETE] \[Columns] \[WHERE conditions] \[Description]

6.3 Log Output

Log Level Output Content Output Condition
INFO \[Log content] \[Output condition]
WARNING \[Log content] \[Output condition]
ERROR \[Log content] \[Output condition]

7. Error Handling

7.1 Expected Errors

Error Code Error Content Response Method
\[Code] \[Content] \[Response]

7.2 Retry Settings

7.3 Abnormal Termination Handling

\[Details of handling abnormal termination, notification methods, rollback procedures, etc.]

8. Performance Requirements

8.1 Processing Time

8.2 Resource Requirements

8.3 Concurrency

\[Whether concurrent execution is possible, methods of exclusive control, etc.]

9. Monitoring and Operations

9.1 Monitoring Items

Monitoring Item Threshold Alert Condition Response Method
\[Item] \[Threshold] \[Condition] \[Response]

9.2 Operation Procedures

9.3 Backup and Recovery

\[Backup methods, recovery procedures]

10. Security Requirements

10.1 Access Permissions

\[Permissions required for execution, access control]

10.2 Handling Confidential Data

\[Handling of confidential data, encryption requirements, etc.]

11. Change History

Date Version Author Change Details
\[Date] \[Version] \[Author] \[Change details]

## Output Image

```markdown
# Daily Aggregation Batch Design Document for Order List Monthly Report Screen

## 1. Basic Information

| Item         | Content                                      |
| ------------ | -------------------------------------------- |
| Batch ID     | order-monthly-report-daily-summary           |
| Batch Name   | Order Monthly Report Daily Aggregation Batch |
| Author       | Takaaki Fujino                               |
| Created Date | 2025/08/14                                   |
| Last Updated | 2025/08/14                                   |
| Version      | 1.0                                          |

## 2. Overview

### 2.1 Purpose

To create aggregated data daily for the order list monthly report screen (administrator dashboard), enabling faster data analysis and load distribution.

### 2.2 Processing Overview

- Aggregate order details, sales, status distribution, etc. for the previous day from the EC-CUBE order database and store them in a dedicated summary table.
- Also perform aggregation by day, status, customer/product.
- The screen/API will reference the pre-aggregated data.

### 2.3 Execution Frequency

- Execution Timing: Daily (recommended at 2:00 AM)
- Execution Time: 02:00
- Schedule Details: cron expression `0 2 * * *`

## 3. Prerequisites and Dependencies

### 3.1 Prerequisites

- Order tables and related master data must be correctly updated by the day.
- The batch execution user must have the necessary DB access permissions.

### 3.2 Dependent Systems/Batches

- Order data update batch (cannot execute while other batches are stopped)
- Sales and customer-related master data

### 3.3 Execution Order Constraints

- Execute after sales reflection/cancellation is completed

## 4. Input Information

### 4.1 Input Files

No file input for this batch (DB only)

### 4.2 Input Parameters

| Parameter Name | Data Type | Required | Default Value | Description      |
| -------------- | --------- | -------- | ------------- | ---------------- |
| target\\_date   | DATE      | Y        | Previous day  | Aggregation date |

### 4.3 Database Input

| Table Name         | Main Columns                            | Retrieval Condition        | Description          |
| ------------------ | --------------------------------------- | -------------------------- | -------------------- |
| dtb\\_order         | order\\_id, customer\\_id, status, total  | order\\_date = target\\_date | Order data           |
| dtb\\_order\\_detail | order\\_id, product\\_id, price, quantity | order\\_date = target\\_date | Order details        |
| mtb\\_order\\_status | status\\_id, name                        | All                        | Order status master  |
| dtb\\_customer      | customer\\_id, name                      | All                        | Customer information |
| dtb\\_product       | product\\_id, name                       | All                        | Product information  |

## 5. Processing Flow

### 5.1 Overall Flow Diagram

```mermaid
flowchart TD
    A((Batch Start))
    B[Determine Aggregation Date]
    C[Retrieve Orders, Details, Masters]
    D{Check for Order Data}
    E[Aggregation Processing - Each Analysis Item]
    F[Insert/Update Aggregation Results to Dedicated Table]
    G[/Error Handling/]
    H((Batch End))

    A --> B --> C --> D
    D -- Yes --> E --> F --> H
    D -- No --> H
    E --Error--> G --> H

5.2 Processing Steps

  1. Determine aggregation target date (previous day)
  2. Retrieve order data, details, status master, customer, and product information
  3. Check for existence of target data
  4. Aggregate total sales, number of orders, count by status, daily sales, customer/product ranking
  5. Insert/Update aggregation results to dedicated summary table
  6. Log and notify in case of errors

5.3 Main Algorithms

6. Output Information

6.1 Output Files

No file output in principle (DB storage. CSV export is handled by the screen function)

6.2 Database Update

Table Name Operation Type Main Columns Update Condition Description
dtb\_order\_monthly\_summary INSERT/UPDATE Aggregation date, sales, count, by status, ranking Current date Monthly report aggregation summary

6.3 Log Output

Log Level Output Content Output Condition
INFO Aggregation start/end/result count Every time
ERROR DB connection error, etc. On exception

7. Error Handling

7.1 Expected Errors

Error Code Error Content Countermeasure
1001 DB connection failure Retry and notification
1002 Data retrieval failure Record error and continue

7.2 Retry Settings

7.3 Processing on Abnormal Termination

8. Performance Requirements

8.1 Processing Time

8.2 Resource Requirements

8.3 Concurrency

9. Monitoring and Operation

9.1 Monitoring Items

Monitoring Item Threshold Alert Condition Response Method
Error count 1 or more Warning at 1 or more Investigation/re-execution
Processing time Over 15 min On timeout Investigation

9.2 Operation Procedure

9.3 Backup and Recovery

10. Security Requirements

10.1 Access Permissions

10.2 Confidential Data Handling

11. Change History

Date Version Author Change Content
2025/08/14 1.0 Dummy Newly created