How to Evaluate AI Coding Tools and Generate Architecture Diagrams from Documentation
This article presents a practical framework for evaluating AI coding tools across four measurable dimensions—intent understanding, output quality, interaction efficiency, and total cost—instead of asking which tool is the strongest. It then details a document-driven approach to generating system diagrams with natural language, covering input preparation, a three-part prompt structure, plan-then-execute workflows, self-check routines, and engineering workarounds for text-only models via an external vision service. Finally, it distinguishes functional module diagrams from system architecture diagrams, lists common failure modes with mitigations, and offers adoption recommendations for teams.
1. Reframing the Problem: From “Which Is Best” to “How to Evaluate”
When choosing an AI coding tool, many teams start by asking which one is the strongest. In a real engineering context, that question has no decidable answer: the relative strength of different tools depends heavily on task type, context length, engineering standard constraints, and whether multimodal input is supported. A more rigorous framing breaks the question into four measurable dimensions:
- Intent understanding and environment awareness: can the tool read requirement documents, directory structures, and existing code style, and stay consistent across a long context?
- Output quality: code runnability, whether naming and layering are reasonable, whether existing conventions are followed, and whether test coverage can be filled in.
- Interaction efficiency: first-pass usability, number of rework rounds, response latency, and the streaming feedback experience.
- Total cost: subscription or API usage fees, context consumption, and the hidden labor cost introduced by rework.
The conclusion up front: there is no universally optimal tool across all scenarios, only the tool that best matches your task distribution. Build a small benchmark set (10–20 tasks) from your team’s real work and score it on the four dimensions above, rather than relying on a single demo.
2. Making the Evaluation Framework Operational
To make evaluation reproducible, convert subjective impressions into metrics:
- First-pass usability rate = number of outputs adopted without manual correction / total number of tasks.
- Average rework rounds: the number of conversation turns from the first output to a mergeable state.
- Convention compliance: whether naming, directory layout, logging, and exception handling follow team agreements (can be quantified with static check rules).
- Cost per task = (API usage fees + converted labor time) / number of tasks.
A sample scoring table can be maintained with a simple data structure to make side-by-side comparison easy:
{"tasks": [{"id": "T1", "type": "diagram", "first_pass": true, "rounds": 1, "cost": 0.02},{"id": "T2", "type": "refactor", "first_pass": false, "rounds": 3, "cost": 0.05}],"weights": {"quality": 0.4, "speed": 0.3, "cost": 0.3}}
3. Key Practice: Generating System Diagrams from Natural Language
The most valuable lesson in the original material is that producing diagrams can follow the same route as producing code: documentation-driven, style-referenced, and plan-then-execute. Abstracted, this yields a general method.
3.1 Preparing the Inputs
- Requirements side: a structured functional module document (module list, responsibility boundaries, dependencies).
- Style side: a reference diagram used to extract layout, color scheme, hierarchy, and connector style.
- Constraints side: canvas size, fonts, legend placement, and output format (for example, an editable diagram description or a vector format).
3.2 Prompt Structure (Three Parts)
Role: You are a senior system architect; the output must be ready for review.Input: functional module document (below) + reference image (for style transfer).Task:1) First output a structured summary of the module list and dependencies;2) Provide a layout plan (layering/grouping/alignment rules) and a color specification;3) Generate the diagram description, ensuring nodes, connectors, and the legend correspond one to one;Constraints: do not add modules that do not exist in the document; naming must match the document exactly.
3.3 The Value of Plan Mode
Having the model produce a plan first (extract style → align modules → generate layout → self-check) and then execute can significantly reduce rework. For the self-check step, ask the model to verify item by item: whether the module count matches, whether dependency directions are correct, whether there are isolated nodes, and whether the legend covers all connector types.
3.4 Engineering Multimodal Input
When the model in use supports text only, an external visual understanding capability is needed: hand the screenshot to a vision module, convert it into a structured description (layout grid, hexadecimal color values, hierarchy relations), and feed that back to the text model. In configuration, this typically means registering a local service on the tool side and declaring the launch command, arguments, and secret environment variables, for example:
{"command": "npx","args": ["-y", "vision-mcp-server"],"env": {"API_KEY": "YOUR_KEY", "MODE": "VISION"},"type": "stdio"}
Note: secrets should be injected through environment variables or a secret management service, never hard-coded into the repository; screenshots should be redacted before being passed across tools to avoid leaking internal system information.
4. From Functional Module Diagrams to System Architecture Diagrams
The two diagram types have different goals, and confusing them is a common source of errors:
- Functional module diagram: emphasizes “what it does,” groups by business domain, and focuses on responsibility boundaries and user-visible capabilities.
- System architecture diagram: emphasizes “how it is implemented,” includes the access layer, application layer, data layer, middleware, and external dependencies, and focuses on traffic paths, sync/async boundaries, and deployment units.
When generating an architecture diagram, explicitly fill in the prompt with: the layer list, the candidate component categories per layer (for example, load balancer, container platform, message queue, object storage, relational database, cache, logging service, monitoring and alerting), and distinct connector styles for synchronous calls versus asynchronous messages. This avoids diagrams that look good but lack data flow.
5. Common Failure Modes and How to Avoid Them
- Hallucinated modules: the model invents components that do not exist. The mitigation is a hard constraint of “no additions beyond the document,” plus requiring an output mapping table.
- Style drift: colors and layout degrade after several rounds. The mitigation is attaching a style specification summary to every round.
- Connector ambiguity: a missing legend leads to misreadings during review. Require the legend to correspond one to one with connectors.
- Long-context degradation: modules get dropped when the document is too long. Generate chunk by chunk per business domain, then merge.
- Non-editable output: bitmaps cannot be modified afterward. Prefer solutions that can export to a textual diagram description or a vector format.
6. Adoption Recommendations
- Build a team-level prompt template library that fixes the “role—input—task—constraints—self-check” pattern.
- Bring diagram output into the review process: structured summary first, then the diagram, then the self-check list.
- Re-evaluate quarterly with the four-dimension metrics; model capabilities iterate quickly, and a conclusion from six months ago may already be obsolete.
- On cost, focus on “rework rounds” rather than unit price; rework is the largest hidden expense.
Overall, the value of AI coding tools has expanded from “completing code” to “understanding documents, planning steps, and producing reviewable artifacts.” Mastering the evaluation framework and the documentation-driven generation method delivers more stable returns than chasing a single tool ranking.
