Files
leistungsbilanz-ts/docs/spec/08-codex-prompts.md
T
2026-05-03 19:15:46 +02:00

5.1 KiB

Codex Prompt Templates

Use these prompts step by step. Do not ask Codex to build the whole application in one pass.

Prompt 1: Audit Existing Codebase

Audit the existing codebase against the specification files in this repository.

Focus on the distribution board circuit list editor.

Do not write code yet.

Produce a concise audit report with:

1. current data model summary
2. current UI/editor behavior summary
3. current project device handling
4. conflicts with the new specification
5. modules/files that can be kept
6. modules/files that should be refactored
7. modules/files that should be replaced
8. recommended implementation plan

Important target model:
- a circuit is not the same thing as one device row
- a circuit contains zero, one or multiple device rows
- sections are configurable grouping separators
- equipment identifiers are stable and never automatically renumbered
- protection and cable data belong to the circuit, not to individual devices

Wait for confirmation before making code changes.

Prompt 2: Implement Core Model

Implement Phase 1 only.

Goal:
Create the core circuit list model and basic table display according to the specification.

Required:
- sections
- circuits
- circuit device rows
- project devices
- manual rows
- reserve circuits
- row total power calculation
- circuit total power calculation
- equipment identifier generation as highest existing number + 1
- no automatic renumbering

Do not implement advanced drag-and-drop yet.
Do not implement sync dialog yet.
Do not implement future cable/protection sizing yet.

Before coding, propose the files you will change and the migration/data-model changes.

Prompt 3: Spreadsheet-Like Editing

Implement Phase 2 only.

Goal:
Make the circuit list table spreadsheet-like.

Required:
- static text cells by default
- inline editing on double click, Enter, typing and F2
- Enter confirms edit
- Escape cancels edit
- Tab and Shift+Tab navigate editable cells
- Arrow keys navigate cells when not editing
- Ctrl+Plus inserts a row
- Ctrl+Shift+Plus also inserts a row
- Delete behavior must be safe
- duplicate equipment identifiers must be visually warned

Do not change the domain model unless required.
Do not implement unrelated features.

Prompt 4: Project Device Sidebar and Drag Insert

Implement Phase 3 only.

Goal:
Add the project device sidebar and drag insertion into the circuit list.

Required:
- searchable project device sidebar
- draggable project device items
- drop onto valid section/free placeholder creates a new circuit
- drop onto existing circuit adds the device to that circuit
- inserted row remains linked to the project device
- displayName is prefilled but remains local after insertion
- invalid drop zones must be rejected or require confirmation
- existing equipment identifiers must not change

Do not implement multi-row drag yet.
Do not implement sync dialog yet.

Prompt 5: Drag-and-Drop Restructuring

Implement Phase 4 only.

Goal:
Support restructuring by drag and drop.

Required:
- dragging from circuit handle moves entire circuit
- dragging from device area moves only the device row
- device rows can move between circuits
- device rows can move to the free placeholder to create a new circuit
- moving rows recalculates affected circuit totals
- no automatic renumbering
- visual drop indicator
- valid and invalid drop target feedback

Then add multi-row selection and multi-row drag:
- Ctrl+click
- Shift+click
- selected rows move together
- internal order is preserved

Prompt 6: Filtering, Sorting, Columns

Implement Phase 5 only.

Goal:
Add Excel-like filtering, sorting and column configuration.

Required:
- filter menu per column header
- filter by values present in the column
- sort ascending/descending per column
- sorting works inside sections
- sorting moves complete circuits as blocks
- sorting must not split devices away from their circuit
- sorting must not renumber
- column visibility configuration
- column reorder by drag and drop
- reset default column layout

Prompt 7: Undo / Redo

Implement Phase 6 only.

Goal:
Add undo/redo for structural and destructive operations.

Required undo/redo support:
- insert circuit
- insert device
- delete circuit
- delete device
- move circuit
- move device
- multi-row move
- renumber section
- edit equipment identifier
- edit cell value
- synchronize linked project device fields
- disconnect linked project device

Keep the implementation maintainable.
Do not introduce global state management unless it is justified.

Prompt 8: Linked Device Synchronization

Implement Phase 7 only.

Goal:
Add controlled synchronization from project devices to linked circuit list rows.

Required:
- track linked rows
- track overridden fields
- when editing a project device, show affected linked rows
- show distribution board, circuit identifier and row display name
- show changed fields with old and new values
- displayName excluded by default
- user can apply changes to one, selected or all linked rows
- user can exclude fields
- user can disconnect linked rows

Do not silently overwrite local values.