Why Section-by-Section?
There are three reasons this approach is mandatory:- Token limits: Claude has a ~32,000 token output limit per response. A comprehensive diagram easily exceeds that in one shot.
- Quality: Generating everything at once leads to rushed decisions and inconsistent spacing.
- Maintainability: Section-by-section JSON with descriptive IDs is far easier to debug and modify.
The Three-Phase Workflow
1. Create the base file
Start with the JSON wrapper and the first section of elements:The first section typically contains the entry point or trigger.
2. Add one section per edit
Each section gets its own dedicated pass. Take your time with it. Think carefully about:
- Layout and spacing within the section
- How this section connects to what’s already there
- Visual balance relative to other sections
elements array to append the new section’s elements.3. Use descriptive string IDs
Use human-readable IDs like:
"trigger_rect""arrow_fan_left""code_snippet_api_request""timeline_dot_1"
4. Namespace seeds by section
To avoid seed collisions:
- Section 1 uses 100xxx (100001, 100002, etc.)
- Section 2 uses 200xxx (200001, 200002, etc.)
- Section 3 uses 300xxx, and so on
5. Update cross-section bindings
When a new section’s element needs to bind to an element from a previous section (e.g., an arrow connecting sections), edit both elements:Update the previous section’s element at the same time you add the new arrow.
- The arrow’s
startBindingorendBindingreferences the other element’s ID - The other element’s
boundElementsarray includes a reference to the arrow
Are cross-section arrows bound correctly?
Are cross-section arrows bound correctly?
Verify that arrows connecting different sections have:
- Valid
startBinding/endBindingwith correctelementId - Corresponding entries in the bound elements’
boundElementsarrays
Is spacing balanced?
Is spacing balanced?
Check that:
- No sections are cramped while others have too much whitespace
- Similar elements have consistent spacing
- Visual weight is distributed evenly
Do all IDs and bindings reference existing elements?
Do all IDs and bindings reference existing elements?
Search for any orphaned references:
elementIdin bindings points to real elements- All
boundElementsentries reference arrows that exist
Now run the render-view-fix loop. This is where you’ll catch visual issues that aren’t obvious from JSON:
See the Render & Validate guide for the complete process.
Planning Section Boundaries
Plan your sections around natural visual groupings from your diagram plan. A typical large diagram might split into:Example: Section-by-Section Workflow
Here’s a concrete example of building a 4-section diagram:Multi-Zoom Architecture
Comprehensive diagrams operate at multiple zoom levels simultaneously. For large diagrams, ensure you include all three levels:Level 1: Summary Flow
A simplified overview showing the full pipeline at a glance. Often placed at the top or bottom. Example:Input → Processing → Output or Client → Server → Database
Level 2: Section Boundaries
Labeled regions that group related components. These create visual “rooms” that help viewers understand what belongs together. Example: Grouping by responsibility (Backend / Frontend), by phase (Setup / Execution / Cleanup), or by team (User / System / External)Level 3: Detail Inside Sections
Evidence artifacts, code snippets, and concrete examples within each section. This is where the educational value lives. Example: Inside a “Backend” section, show the actual API response format, not just a box labeled “API Response”Troubleshooting
Arrow not connecting across sections
Arrow not connecting across sections
Check:
- Arrow’s
endBinding.elementIdmatches the target element’sid - Target element’s
boundElementsincludes{"id": "arrow_id", "type": "arrow"} - Both elements exist in the
elementsarray
Sections feel unbalanced
Sections feel unbalanced
After adding all sections, adjust:
- Element sizes (width/height) to rebalance visual weight
- Spacing between sections (200-400px recommended)
- Font sizes for hierarchy consistency
Can't find where an element is defined
Can't find where an element is defined
Use descriptive IDs! Search for the ID string in your JSON. If using random IDs like
"x7k2m9", you’ll waste time hunting.Next Steps
Render & Validate
Learn the mandatory render-view-fix loop
Element Templates
Copy-paste templates for all element types