Skip to content

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:

  1. Open the Figma file (LBS Foundry - Database Schema)
  2. Go to the Foundry ERD page
  3. Run the Mermaid in Figma plugin (Plugins > Mermaid in Figma)
  4. Paste the erDiagram block from docs/architecture/database-schema-diagram.md
  5. Click generate — the plugin renders the diagram directly onto the canvas
  6. Delete the previous version if one exists

Alternative: Mermaid Live Editor

  1. Open Mermaid Live Editor
  2. Paste the erDiagram block from docs/architecture/database-schema-diagram.md
  3. Export as SVG (or PNG for a quick preview)
  4. In the Figma file, go to the Foundry ERD page
  5. 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.md first, then re-export to Figma.