This prompt is designed for engineering leads, QA architects, and technical reviewers who need to verify that a system architecture diagram—whether a formal UML diagram, an informal whiteboard sketch, or a generated flowchart—faithfully represents a written specification. The core job is to detect missing components, incorrect connections, and label mismatches before a design review or implementation gate. It is not a general diagram-explanation tool, a code-generation prompt, or a replacement for human architectural judgment. Use it when you have a concrete specification document and a diagram artifact that must be reconciled.
Prompt
Diagram-Claim-to-Specification Compliance Check Prompt

When to Use This Prompt
Define the job, required inputs, and operational boundaries for verifying architecture diagrams against written specifications.
The prompt expects two primary inputs: a [SPECIFICATION] containing the written description of the system architecture, and a [DIAGRAM_DESCRIPTION] that describes the visual artifact in structured text. If you are working with an image directly, you must first pass it through a vision-capable model to produce a textual description of components, connections, labels, and containment. The output is a structured compliance report with three sections: a component-presence check listing every specified component and whether it appears in the diagram, a connection-accuracy check comparing specified relationships against drawn edges, and a label-alignment score that flags terminology drift between the spec and the diagram. Each finding includes a severity level and a specific reference to the relevant spec section or diagram region.
Do not use this prompt when the specification is ambiguous, still in draft, or intentionally underspecified—the prompt will produce false positives by treating missing detail as non-compliance. It is also unsuitable for diagrams that use purely iconic or pictorial notation without textual labels, as the label-matching logic depends on extractable text. For regulated environments where a missed connection could have safety or compliance implications, always route the output through a human reviewer and maintain an audit trail of the prompt's findings alongside the reviewer's disposition. If the diagram format is informal—hand-drawn, photographed, or using non-standard notation—add a [NOTATION_GUIDE] input that maps visual conventions to spec terminology before running the check.
Use Case Fit
Where the Diagram-Claim-to-Specification Compliance Check prompt works, where it fails, and the operational preconditions required before putting it into a verification pipeline.
Good Fit: Formal Specs with Explicit Component Lists
Use when: you have a written specification that explicitly names components, ports, protocols, or data flows. The prompt excels at checking presence/absence of named entities. Guardrail: preprocess the spec to extract a canonical component list before running the check, so the model compares against a structured inventory rather than reinterpreting the spec each time.
Bad Fit: Informal Whiteboard Sketches Without a Written Spec
Avoid when: the diagram is a rough brainstorming artifact and no written specification exists. The prompt will hallucinate compliance criteria or overfit to visual conventions that carry no formal meaning. Guardrail: gate execution on the presence of a spec document with version and author metadata. If absent, route to a human-led review instead.
Required Inputs: Diagram + Spec + Notation Legend
Risk: without a notation legend, the model guesses whether a dashed line means 'async message,' 'dependency,' or 'optional flow.' Guessing breaks compliance accuracy. Guardrail: always include a notation key mapping visual symbols to spec semantics. If the diagram uses an informal notation, provide a short glossary of shapes, line styles, and their intended meanings before invoking the prompt.
Operational Risk: Implied Relationships vs. Explicit Spec Statements
Risk: the spec may imply a connection without stating it explicitly, while the diagram draws it. The model may flag a false positive 'extra connection' or miss a true compliance gap. Guardrail: add a pre-check step that classifies each spec requirement as 'explicit' or 'implied,' and adjust the compliance scoring threshold separately for each class. Implied requirements should never trigger a hard failure without human review.
Operational Risk: Label Drift Between Diagram and Spec
Risk: the diagram labels a component 'Auth Service' while the spec calls it 'Authentication Module.' A naive string match fails, and the model may incorrectly flag a missing component. Guardrail: run a terminology alignment pass before compliance checking. Use a synonym map or embedding-based fuzzy match to normalize labels, and surface unresolved aliases for human confirmation rather than auto-failing them.
Pipeline Integration: Human Review Thresholds
Risk: treating every flagged discrepancy as a blocking defect overwhelms reviewers and slows architecture iteration. Guardrail: define severity tiers. Missing critical-path components block. Label mismatches warn. Implied-relationship gaps are informational. Route only blocking and warning items to human review, and auto-close informational items with a log entry for audit trails.
Copy-Ready Prompt Template
A reusable prompt template for checking architecture diagram claims against written specifications.
This prompt template is designed to be copied directly into your application or testing environment. It accepts a diagram description, a written specification, and a set of configurable constraints to produce a structured compliance report. The template uses square-bracket placeholders for all dynamic inputs, making it straightforward to wire into a prompt assembly pipeline or a manual review workflow. Before using it, ensure you have a reliable method for converting visual diagrams into a textual description—whether through a multimodal model, manual annotation, or a structured diagram-as-code format.
textYou are a technical compliance analyst. Your task is to verify whether a described architecture diagram complies with a written specification. ## INPUT ### Diagram Description [DIAGRAM_DESCRIPTION] ### Written Specification [SPECIFICATION_TEXT] ## CONSTRAINTS - [COMPLIANCE_RULES] - Tolerance for informal notation: [NOTATION_TOLERANCE] - Required confidence threshold for each finding: [CONFIDENCE_THRESHOLD] ## OUTPUT SCHEMA Return a valid JSON object with the following structure: { "components": [ { "spec_component": "string (component name from specification)", "diagram_presence": "present | absent | implied", "diagram_label": "string or null", "label_alignment_score": 0.0-1.0, "notes": "string" } ], "connections": [ { "spec_connection": "string (source -> target as described in spec)", "diagram_presence": "present | absent | implied | contradicted", "diagram_representation": "string or null", "accuracy_flag": "exact_match | direction_mismatch | protocol_mismatch | missing", "notes": "string" } ], "overall_compliance_score": 0.0-1.0, "critical_gaps": ["string"], "requires_human_review": true | false } ## INSTRUCTIONS 1. Parse the specification to extract an exhaustive list of required components and their connections. 2. For each component, check if it appears in the diagram description. Account for synonyms, abbreviations, and informal labels. Do not penalize missing visual elements if the specification marks them as optional. 3. For each connection, verify the source, target, direction, and protocol or data type if specified. Flag any contradiction, even if a similar connection exists. 4. Score label alignment by comparing the diagram's label for a component against the specification's canonical term. 5. If the diagram uses informal notations (e.g., hand-drawn symbols, generic boxes), interpret them generously according to the tolerance level provided. 6. Set `requires_human_review` to `true` if any component is missing, any connection is contradicted, or the overall compliance score falls below the confidence threshold. 7. Do not invent components or connections not present in the specification.
To adapt this template, replace each square-bracket placeholder with values from your application context. [DIAGRAM_DESCRIPTION] should be a structured text representation of the diagram, not a raw image file. If you are using a multimodal model to generate this description upstream, validate its output for hallucinated components before passing it here. [COMPLIANCE_RULES] can include domain-specific requirements such as 'all databases must be behind a firewall' or 'no single point of failure is permitted.' The [NOTATION_TOLERANCE] field accepts values like 'strict' (only formal UML), 'moderate' (accepts common informal symbols), or 'lenient' (any reasonable interpretation). Always set [CONFIDENCE_THRESHOLD] to a value between 0.0 and 1.0 to gate the requires_human_review flag.
This prompt is designed for a single-turn verification task. It does not maintain state across multiple diagrams. For batch processing, wrap this template in an orchestration layer that handles rate limiting, retries on malformed JSON, and result aggregation. The output schema is intentionally flat to simplify parsing and downstream logging. If your compliance workflow requires audit-ready evidence, store the full prompt, the raw model response, and the parsed JSON together. For high-risk systems, always route outputs with requires_human_review: true to a qualified reviewer before accepting the compliance verdict.
Prompt Variables
Required inputs for the Diagram-Claim-to-Specification Compliance Check Prompt. Each placeholder must be populated before the prompt is assembled and sent. Validation notes describe how to verify the input is well-formed before execution.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[DIAGRAM_DESCRIPTION] | Structured text description of the diagram elements, including nodes, edges, labels, and spatial relationships | Node A (Load Balancer) connects to Node B (App Server) via HTTPS. Node B connects to Node C (Database) via TCP. Label on edge: 'port 5432' | Must contain at least one node and one connection. Parse check: confirm entity and relationship extraction succeeds. Null not allowed. |
[SPECIFICATION_TEXT] | The written specification or requirements document against which the diagram is checked | Section 3.2: The load balancer shall terminate TLS and forward to app servers on port 8080. Section 3.3: App servers shall connect to the primary database on port 5432. | Must contain at least one verifiable requirement. Parse check: confirm requirement extraction yields at least one atomic spec clause. Null not allowed. |
[COMPONENT_CATALOG] | List of expected components from the specification with their required properties | Load Balancer: must terminate TLS, must expose port 443. App Server: must listen on port 8080. Database: must be primary, must accept connections on port 5432. | Optional but strongly recommended. If null, the prompt will infer expected components from [SPECIFICATION_TEXT] alone, which reduces precision. Schema check: each entry must have a name and at least one property. |
[CONNECTION_RULES] | Expected connections between components as defined in the specification | Load Balancer -> App Server: protocol HTTPS, target port 8080. App Server -> Database: protocol TCP, target port 5432. | Optional. If null, connection rules are inferred from [SPECIFICATION_TEXT]. Schema check: each rule must specify source, target, and at least one constraint. Missing rules reduce connection-accuracy flag precision. |
[NOTATION_GLOSSARY] | Mapping of informal diagram notation to canonical terms used in the specification | Box = Component, Arrow = Data Flow, Dashed Line = Optional Connection, Cloud Icon = External Service | Optional. If null, the prompt assumes standard notation. Parse check: each entry must map one notation symbol to one canonical term. Critical when diagrams use domain-specific or ad-hoc visual conventions. |
[TOLERANCE_CONFIG] | Thresholds for flagging partial matches, implied relationships, and label similarity | Label similarity threshold: 0.85 (fuzzy match). Implied connection confidence floor: 0.7. Missing component severity: warning above 0.5, error above 0.8. | Optional. If null, use defaults: label similarity 0.8, implied connection confidence 0.6, severity split at 0.5/0.8. Schema check: each threshold must be a float between 0.0 and 1.0. |
[OUTPUT_SCHEMA] | Expected structure for the compliance check output | JSON with fields: component_presence[], connection_accuracy[], label_alignment_scores[], implied_relationships[], overall_compliance_score | Required. Must define at least component_presence and connection_accuracy arrays. Schema check: validate against JSON Schema before prompt assembly. Missing schema causes unstructured output. |
[ABSTENTION_RULES] | Conditions under which the prompt should refuse to evaluate a claim rather than guess | Abstain if: diagram notation cannot be parsed into components, specification contains only aspirational language with no verifiable requirements, more than 30% of labels are illegible. | Optional. If null, the prompt may produce low-confidence results instead of abstaining. Parse check: each rule must be a clear boolean condition. Recommended for production use to prevent hallucinated compliance assessments. |
Implementation Harness Notes
How to wire the Diagram-Claim-to-Specification Compliance Check Prompt into a reliable verification application.
This prompt is designed to be called as a single step within a larger compliance verification pipeline. It expects a pre-extracted set of claims from a diagram (produced by an upstream multimodal extraction step) and a clean text copy of the specification. The harness must enforce this contract: the prompt does not perform OCR, image segmentation, or PDF parsing itself. Those responsibilities belong to dedicated upstream tools. The harness should validate that both [DIAGRAM_CLAIMS] and [SPECIFICATION_TEXT] are non-empty and properly structured before making the model call. For high-stakes engineering compliance, always route outputs to a human review queue rather than treating the model's verdict as final.
The implementation should wrap the prompt in a function that accepts a structured DiagramClaimSet (an array of objects with claim_id, claim_text, source_element like 'Box A' or 'Arrow B->C', and claim_type such as 'component_presence', 'connection', or 'label') and a SpecificationDocument (with sections containing section_id and text). The function constructs the prompt by serializing these inputs into the [DIAGRAM_CLAIMS] and [SPECIFICATION_TEXT] placeholders. After the model responds, the harness must parse the JSON output and run a validation suite: check that every input claim_id appears in the output, that compliance_status is one of the allowed enum values (compliant, non_compliant, ambiguous, not_specified), and that any specification_reference points to a valid section_id from the input. Failed validations should trigger a retry with the validation errors appended to the [CONSTRAINTS] block, up to a maximum of two retries before escalating to human review.
Model choice matters here. Use a model with strong structured output capabilities and a large context window, as specifications can be lengthy. GPT-4o, Claude 3.5 Sonnet, and Gemini 1.5 Pro are suitable candidates. Enable structured output mode (JSON mode or tool calling with a strict schema) rather than relying on free-text parsing. For logging, capture the full prompt, the raw model response, the parsed output, and the validation results in an immutable audit record. This is critical for compliance workflows where you must prove what the model was shown and how it arrived at its verdict. The harness should also compute and log a simple alignment coverage metric: the percentage of input claims that received a non-null specification_reference. A low coverage score may indicate a poorly written specification or a diagram that has drifted significantly from the documented requirements. Do not silently accept low coverage; flag it for review.
Common failure modes to instrument for include: the model hallucinating specification sections that don't exist (caught by the section ID validator), the model misinterpreting informal diagram notations like dashed lines or color coding (mitigated by ensuring the upstream claim extractor explicitly describes these conventions in the claim text), and the model failing to distinguish between a component being explicitly absent from the spec versus the spec being silent on the matter (enforced by the not_specified vs non_compliant distinction in the output schema). Your eval set should include diagram-spec pairs with known discrepancies, including missing components, incorrect connections, and terminology mismatches where the diagram uses a synonym for a spec term. Measure precision and recall on non_compliant flag detection, and pay special attention to false negatives where a real discrepancy is missed. If the prompt is part of a CI/CD pipeline for architecture reviews, gate the pipeline on a clean compliance report with zero non_compliant flags, but allow a human override for ambiguous items with documented justification.
Common Failure Modes
What breaks first when verifying diagram claims against written specifications, and how to guard against it.
Implied Relationships Missed
What to watch: The model treats only explicitly drawn connectors as relationships, missing implied connections from spatial proximity, nesting, or shared labels. A component placed inside a boundary box may be assumed unrelated to that boundary. Guardrail: Add an explicit instruction to enumerate both explicit connectors and spatial-containment relationships. Require the output to flag 'implied but not drawn' relationships separately.
Label-to-Spec Term Mismatch
What to watch: Diagram labels use abbreviations, synonyms, or informal names that don't match specification terminology. The model either fails to align them or hallucinates a mapping. 'Auth Service' in the diagram may not match 'Authentication Module' in the spec. Guardrail: Require a label-to-spec-term alignment table in the output. Flag any diagram label without a high-confidence spec match as 'unresolved' rather than guessing.
Visual Parsing Errors on Informal Diagrams
What to watch: Hand-drawn diagrams, whiteboard photos, or low-contrast screenshots cause OCR failures, missed components, or misread connector arrows. The model may silently skip unreadable regions. Guardrail: Pre-process with a dedicated vision extraction step that produces a structured intermediate representation. Add a 'readability confidence' field per component and route low-confidence regions to human review before compliance checking.
Specification Scope Creep
What to watch: The model checks the diagram against the entire specification document rather than the specific section or version intended. It flags 'missing' components that belong to a different subsystem or an outdated spec revision. Guardrail: Constrain the prompt with a specific specification section reference and version identifier. Require the output to cite the exact spec section used for each compliance check.
False-Positive Compliance on Missing Components
What to watch: The model assumes a component exists because the specification mentions it, even when the diagram omits it. It reports compliance when it should flag an absence. Guardrail: Require explicit 'component presence' checks as a separate pass before connection verification. Output a distinct 'missing from diagram' list with spec citations. Never infer diagram presence from spec presence.
Directionality and Cardinality Misread
What to watch: Arrow direction, multiplicity markers (1..*, 0..1), and data flow direction are misread or ignored. A bidirectional spec requirement matched against a unidirectional diagram arrow passes without flagging. Guardrail: Add a dedicated connection-accuracy check that compares direction, cardinality, and protocol labels independently. Require the output to enumerate each connection with its direction and cardinality from both diagram and spec.
Evaluation Rubric
Criteria for testing whether the Diagram-Claim-to-Specification Compliance Check Prompt produces reliable, actionable results before shipping. Use these tests to catch common failure modes in diagram-to-spec verification workflows.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Component Presence Recall | All components explicitly named in the specification are identified in the diagram output, with no false negatives | Missing component in output list that appears in specification; component counted as absent when visually present | Run against 10 spec-diagram pairs with known component lists; require recall >= 0.95 |
Component Hallucination Rate | No components are reported as present in the diagram that are not visible or reasonably inferable from the diagram | Fabricated component names; components from similar diagrams appearing in output; inference treated as confirmed presence | Inject diagrams with known component counts; require precision >= 0.98; flag any invented component name |
Connection Accuracy | All connections between components are correctly identified with directionality and multiplicity matching the specification | Missing required connection; reversed direction; wrong multiplicity; connection reported where none exists | Use 10 hand-labeled diagram-spec pairs; require connection-level F1 >= 0.90; spot-check directionality separately |
Label-to-Spec Term Alignment | Diagram labels are correctly mapped to specification terms, including synonyms, abbreviations, and hierarchical names | Unmapped label left as unknown; incorrect synonym expansion; abbreviation resolved to wrong spec term | Provide mapping table for 20 known label-to-term pairs; require exact-match or approved-alias rate >= 0.95 |
Implied Relationship Detection | Relationships implied by spatial proximity, containment, or grouping are flagged as inferred with confidence scores | Implied relationship reported as explicit; missing confidence score; overconfident assertion without visual evidence | Test on diagrams with 5 known implied-only relationships; require all flagged as inferred with confidence < 1.0 |
Informal Notation Handling | Common informal notations such as hand-drawn boxes, arrows, clouds, and stick figures are interpreted without hallucination | Informal element misinterpreted as formal UML; cloud boundary treated as exact; stick figure labeled as specific actor type | Use 5 diagrams with informal notations; require no hallucinated formal semantics; check for appropriate uncertainty language |
Cross-Format Consistency | Claims about diagram elements are consistent when the same diagram is provided in multiple formats such as PNG, SVG, and PDF | Different component counts across formats; connection direction changes; label extraction varies by format | Provide same diagram in 3 formats; require component count variance = 0 and connection count variance <= 1 |
Empty or Minimal Diagram Handling | Empty diagrams or diagrams with only a title produce an empty component list and a note about insufficient content | Hallucinated components in empty diagram; false connections; failure to report insufficient-content condition | Test with 3 empty or near-empty diagrams; require empty output arrays and presence of insufficient-content flag |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single diagram image and a short specification text block. Skip formal schema validation. Accept free-text output describing component presence, connection accuracy, and label alignment. Focus on getting the model to reason visually before adding structure.
Watch for
- The model inventing components not visible in the diagram
- Overly broad instructions causing the model to summarize instead of checking compliance
- Missing explicit instruction to flag absent components rather than only listing present ones

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us