Skip to content

Improve complex mechanical/illustrative diagram quality#21

Merged
GeneralJerel merged 2 commits intomainfrom
claude/improve-mechanical-diagrams-9pafB
Mar 23, 2026
Merged

Improve complex mechanical/illustrative diagram quality#21
GeneralJerel merged 2 commits intomainfrom
claude/improve-mechanical-diagrams-9pafB

Conversation

@GeneralJerel
Copy link
Collaborator

Summary

  • Adds mechanical-illustration-skill.txt with guidance for recognizable mechanical diagrams
  • Adds svg-shape-library.txt with geometric primitive recipes for common objects
  • Expands illustrative diagram section in svg-diagram-skill.txt with composition rules and planning protocol
  • Adds master-agent-playbook.txt with centralized state-and-render pattern for interactive diagrams
  • All changes are prompt/skill files only — no runtime code changes

Test plan

  • Run pnpm dev and open http://localhost:3000
  • Ask 'how do cars work?' and verify improved diagram quality
  • Ask 'how do airplanes fly?' and verify proper composition
  • Compare against same prompts on main branch

claude added 2 commits March 23, 2026 16:02
Defines 5 concrete problems with current diagram generation (rough
shapes, floating components, disconnected controls, thin skill
guidance, oversimplified sub-diagrams) and proposes 5 PRs to fix them:

1. Expand illustrative diagram rules in svg-diagram-skill.txt
2. Add diagram planning protocol (pre-generation thinking step)
3. Add progressive rendering pattern for interactive diagrams
4. Create dedicated mechanical-illustration-skill.txt
5. Add SVG shape library with reusable path fragments

All changes are skill/prompt file modifications only — no code changes.

https://claude.ai/code/session_0116PYmVGknEBVfUU8xZT78B
Expands the agent's skill files to produce higher-quality mechanical
and illustrative diagrams (cars, airplanes, engines, etc.):

1. Expand illustrative diagram rules in svg-diagram-skill.txt:
   - Composition grid zones (illustration, annotation margin, sub-diagram)
   - Depth layering order for proper visual stacking
   - Shape construction from geometric primitives (not freehand paths)
   - Force/motion arrow conventions with color coding
   - Annotation hierarchy (primary/secondary/tertiary tiers)
   - Cross-section vs side-view guidance

2. Add diagram planning protocol (pre-generation thinking step):
   - Subject decomposition, educational priority, spatial layout
   - Composition sketch, shape fidelity check, control-to-visual mapping

3. Add progressive rendering pattern for interactive diagrams:
   - Centralized state-and-render JS architecture
   - Element ID convention (viz-{component}-{property})
   - Preset button pattern with slider sync

4. Create mechanical-illustration-skill.txt:
   - Shape construction method with worked car/airplane examples
   - Spatial accuracy rules with grid overlay technique
   - Sub-diagram quality standards (no placeholder rectangles)
   - Interactive control binding template with compute/render pattern

5. Add svg-shape-library.txt with reusable path fragments:
   - Vehicle profiles (sedan, airplane)
   - Mechanical parts (gear, piston, wheel)
   - Physics shapes (airfoil, force arrows)
   - Annotation elements (zoom callout, dimension lines)
   - Control surfaces (rudder, aileron, elevator)

All changes mirrored to both agent and MCP skill directories.

https://claude.ai/code/session_0116PYmVGknEBVfUU8xZT78B
GeneralJerel pushed a commit that referenced this pull request Mar 23, 2026
Approve with suggestions. Key findings:
- Well-structured prompt-only changes (no runtime code modifications)
- 4 complementary skill files forming a coherent diagram improvement system
- Suggestions: monitor token budget, deduplicate agent/mcp skills,
  move issue proposal to GitHub Issue, broaden domain coverage

https://claude.ai/code/session_01NvdQBhgYLjhtKQdAZFcKXx
@GeneralJerel
Copy link
Collaborator Author

Self-Review Findings

Verdict: No merge block — P0=0, P1=2, P2=4, P3=2

ID Sev Category Location Issue
F1 P1 correctness .github/ISSUE_PROPOSAL_mechanical_diagrams.md:15-20 Issue proposal references ./assets/car-diagram-screenshot.png and ./assets/airplane-diagram-screenshot.png but .github/assets/ directory does not exist. Broken images in rendered markdown.
F2 P1 design apps/agent/skills/ (all new files) Adds ~9,150 tokens (75% increase) to the system prompt on every request. load_all_skills() concatenates ALL .txt files unconditionally — mechanical diagram guidance is injected even for non-mechanical queries. Consider conditional loading or trimming the shape library to 6-8 common shapes (as the issue proposal itself suggests).
F3 P2 duplication apps/agent/skills/ + apps/mcp/skills/ All 4 modified/new files are exact byte-for-byte copies across agent and MCP directories. No mechanism prevents drift — edits to one must be manually replicated. Consider symlinks or a CI check.
F4 P2 duplication mechanical-illustration-skill.txt + svg-diagram-skill.txt Significant conceptual overlap: both now cover shape construction rules, 3-tier annotation hierarchy, sub-diagram standards, force arrow conventions, and composition zones. The mechanical skill repeats guidance already in the expanded svg-diagram-skill with fuller examples. Suggest keeping architectural rules in one file and domain-specific examples in the other.
F5 P2 duplication master-agent-playbook.txt + mechanical-illustration-skill.txt The progressive rendering / updateStaterender() pattern appears in both files with nearly identical code examples. Suggest removing the "Interactive Control Binding" section from the mechanical skill and referencing the playbook instead.
F6 P2 scope .github/ISSUE_PROPOSAL_mechanical_diagrams.md The issue proposal describes 5 separate PRs but this single PR implements all 5. The proposal is a stale artifact on merge. Should be a GitHub Issue (closeable) or removed.
F7 P3 style svg-shape-library.txt Several SVG shapes use hardcoded color values (#444, #ddd, #bbb, #999) that don't match the design token palette in svg-diagram-skill.txt (#F1EFE8, #5F5E5A, etc.).
F8 P3 content mechanical-illustration-skill.txt:516-544 "Worked Reference: Car Drivetrain Composition" is a text outline only — no actual SVG. Meanwhile the shape library has full SVG for the sedan. Should cross-reference or include complete SVG.

Context Budget Impact

  • Pre-PR skill text: ~48.9 KB (~12,200 tokens)
  • Post-PR skill text: ~85.5 KB (~21,400 tokens)
  • Delta: +36.6 KB (~9,150 tokens) loaded on every request

Testing Gaps

  • No automated way to verify prompt/skill quality
  • No before/after comparison of diagram outputs in the PR
  • No test that validates total system prompt stays within a token budget
  • No test that agent/MCP skill files remain in sync

Self-review by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants