Mermaid Diagram Update Prompt¶
Use this prompt at the end of any session where you've added or modified contracts, events, or contract builders. Paste it into Claude Code (or any AI assistant) to update the Mermaid ERD documentation.
ERD File¶
Foundry Database Schema Diagram
Prompt¶
I've made changes to contracts, events, or builders in this session. Update the Mermaid ERD in docs/architecture/database-schema-diagram.md to reflect those changes.
Instructions:
1. Identify all contracts, events, and contract builders that were added or modified in this session (check git diff against main).
2. For each modified/new CONTRACT:
- Find or add the entity in the Mermaid erDiagram block in docs/architecture/database-schema-diagram.md.
- Update the entity with the correct property names, types, and PK/FK markers.
- Add or update relationship lines to other entities.
3. For each removed CONTRACT:
- Remove the entity and its relationship lines from the diagram.
4. Verify all relationships between entities are accurate.
Exporting to Figma¶
The Mermaid ERD in docs/architecture/database-schema-diagram.md is the source of truth. To export a visual copy to Figma:
Using the Mermaid in Figma plugin (recommended)¶
- Open the Figma file (LBS Foundry - Database Schema)
- Go to the Foundry ERD page
- Run the Mermaid in Figma plugin (Plugins > Mermaid in Figma)
- Paste the
erDiagramblock fromdocs/architecture/database-schema-diagram.md - Click generate — the plugin renders the diagram directly onto the canvas
- Delete the previous version if one exists
Alternative: Mermaid Live Editor¶
- Open Mermaid Live Editor
- Paste the
erDiagramblock fromdocs/architecture/database-schema-diagram.md - Export as SVG (or PNG for a quick preview)
- In the Figma file, go to the Foundry ERD page
- Drag the exported SVG/PNG onto the canvas (or use File > Place image)
Note: The Figma copy is a static snapshot for visual reference. Always update
docs/architecture/database-schema-diagram.mdfirst, then re-export to Figma.