@workspace Analyze the code in the workspace and create a mermaid sequence diagram that illustrates the 
Layout and Structure: Arrange participants (actors/systems) horizontally from left to right based on their order of interaction Position the initiating actor/system on the far left Group related systems next to each other Maintain consistent spacing between lifelines
Participant Styling: Use distinct colors for different types of participants: User/External Actors: Light Orange (#FFE4B5) API/Controllers: Light Blue (#ADD8E6) Services: Light Green (#90EE90) Databases: Light Yellow (#FFFFE0) External Services: Light Purple (#E6E6FA) Use clear, descriptive names for participants Add stereotypes to indicate participant types («API», «Service», etc.)
Message Representation: Use appropriate arrow types: Solid arrows (→) for synchronous calls Dotted arrows (–>) for asynchronous calls Open arrows (->) for responses Bold arrows (=>) for critical path operations Keep messages short but descriptive Include important parameters in message labels Show return values where significant
Flow Organization: Break long sequences into logical segments using dividers Use activation boxes to show processing time Include alt/opt/loop fragments for conditional flows Show parallel processing using par fragments Highlight error paths using alt fragments
Documentation and Clarity: Add notes for complex logic or important conditions Include timing information where relevant Show retry/timeout mechanisms Document error handling paths Add sequence numbers for key steps
Optimization: Focus on main success scenario first Show alternative paths separately if too complex Limit diagram to one main business transaction Collapse repetitive sequences into loop fragments Hide unnecessary technical details
Additional Details: Include HTTP methods for API calls Show important status codes/responses Indicate async/await patterns clearly Mark critical validation points Show transaction boundaries Please generate a sequence diagram that captures the main flow while maintaining readability and providing sufficient detail for understanding the interaction pattern
Install Prompt
Add this prompt to your Amazon Q CLI prompt library:
1. Download to local prompt library:
mkdir -p .amazonq/cli-prompts && curl -o .amazonq/cli-prompts/draw-like-a-pro-sequence-diagrams-for-a-system-flow.md https://promptz.dev/prompts/architecture/draw-like-a-pro-sequence-diagrams-for-a-system-flow/2. Use with Q CLI:
q prompts use draw-like-a-pro-sequence-diagrams-for-a-system-flow