Inferensys

Prompt

Bounded Context Coupling Assessment Prompt

A practical prompt playbook for using the Bounded Context Coupling Assessment Prompt in production architecture review workflows.
Developer designing multi-agent workflow on laptop, architecture diagram on screen, casual home office setup with afternoon light.
PROMPT PLAYBOOK

When to Use This Prompt

Understand the ideal scenarios, required inputs, and limitations for the Bounded Context Coupling Assessment Prompt.

Domain architects and platform engineers use this prompt to assess coupling between bounded contexts before implementation decisions create irreversible entanglement. The primary job-to-be-done is generating a structured coupling report that identifies relationship types, evaluates translation layer adequacy, detects domain language leakage, and flags context map violations. This is a design-time analysis tool, not a runtime monitoring solution. The ideal user has documented context definitions, integration points, and domain terminology available as input—this prompt cannot invent your domain model for you.

Use this prompt during architecture review sessions, pre-implementation design gates, and modernization planning when you need evidence that your bounded contexts are genuinely independent rather than accidentally coupled through shared language, data contracts, or implicit assumptions. It is particularly valuable when multiple teams own different contexts and you need an objective assessment of whether their integration patterns respect DDD principles. The prompt assumes you have already done the hard work of identifying your bounded contexts and mapping their relationships; it validates those decisions rather than making them from scratch.

This prompt does not replace static analysis of code-level dependencies. It operates at the conceptual and design level, examining how contexts relate through language, contracts, and integration patterns. For implementation-level coupling analysis, pair it with the Component Boundary Leakage Detection Prompt to catch code-level violations or the Dependency Structure Matrix Generation Prompt to visualize actual import dependencies. Do not use this prompt when you lack documented context definitions—the output quality depends entirely on the quality and completeness of your input. If your team has not yet identified bounded contexts or mapped their relationships, start with a Domain-Driven Design discovery process before applying this assessment.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Bounded Context Coupling Assessment Prompt delivers reliable architecture insight and where it falls short.

01

Good Fit: Domain Model Audits

Use when: you have documented bounded contexts with defined aggregates, domain events, and translation layers. The prompt excels at identifying domain language leakage and context map violations. Guardrail: provide the context map and glossary as structured input; do not rely on the model to infer boundaries from code alone.

02

Good Fit: Pre-Migration Boundary Review

Use when: planning a service extraction or strangler fig migration. The prompt identifies coupling points that would become distributed monolith risks. Guardrail: pair the output with a Change Propagation Risk Assessment to quantify the blast radius of each coupling point before sequencing migration work.

03

Bad Fit: Code-Only Reverse Engineering

Avoid when: you lack explicit domain documentation and expect the model to infer bounded contexts from source code alone. The prompt requires semantic understanding of domain intent, not just import graph analysis. Guardrail: use the Circular Dependency Detection Prompt or Dependency Structure Matrix Generation Prompt for code-level coupling; reserve this prompt for design-level review with domain artifacts.

04

Bad Fit: Runtime Coupling Analysis

Avoid when: you need to measure actual runtime call frequency, latency coupling, or health check dependencies between services. This prompt operates at the design and language level, not the operational level. Guardrail: use the Microservice Coupling Heatmap Generation Prompt for runtime coupling; this prompt complements it by addressing semantic coupling that metrics alone miss.

05

Required Inputs: Context Map and Glossary

Risk: without a documented context map, ubiquitous language glossary, and relationship types between contexts, the model hallucinates boundaries that don't match team intent. Guardrail: require at minimum a context map diagram description, a glossary of domain terms per context, and declared relationship types (partnership, shared kernel, customer-supplier, conformist, anticorruption layer, open host service, published language).

06

Operational Risk: False Confidence in Clean Boundaries

Risk: the model may report clean boundaries when domain language leakage exists in undocumented areas or when teams disagree on context ownership. Guardrail: treat the output as a hypothesis for team review, not a compliance report. Validate every flagged coupling point with the context owners before acting on refactoring recommendations. Escalate disagreements to a domain architecture decision record.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A ready-to-use prompt for generating a structured coupling assessment between bounded contexts, with placeholders for your specific domain architecture.

This prompt template is designed to be pasted directly into your AI system. It instructs the model to act as a domain architecture reviewer, analyzing the relationships between your defined bounded contexts. The output is a structured report that identifies coupling types, evaluates translation layers, and flags violations of your context map. Before running, you must replace the square-bracket placeholders with your specific architecture documentation, such as your context map, domain vision statement, and the list of contexts to analyze.

text
You are a domain architecture reviewer specializing in Domain-Driven Design (DDD). Your task is to analyze the coupling between the bounded contexts described in the provided documentation. You will produce a structured assessment report that identifies relationship types, evaluates the adequacy of translation layers, and detects domain language leakage.

## Input Documentation
### Context Map
[CONTEXT_MAP_DOCUMENTATION]

### Domain Vision Statement
[DOMAIN_VISION_STATEMENT]

### Bounded Contexts to Analyze
[LIST_OF_BOUNDED_CONTEXTS]

### Specific Context Relationships to Review (Optional)
[SPECIFIC_RELATIONSHIPS_TO_REVIEW]

## Assessment Instructions
For each relationship between the specified bounded contexts, perform the following analysis:

1.  **Identify the Relationship Type:** Classify the relationship according to the DDD context map patterns (e.g., Partnership, Shared Kernel, Customer-Supplier, Conformist, Anticorruption Layer, Open Host Service, Published Language, Separate Ways).
2.  **Evaluate Translation Layer Adequacy:** For each relationship, assess the translation layer. Is it present? Is it sufficient to prevent domain concept leakage? Is it bidirectional where necessary?
3.  **Detect Domain Language Leakage:** Identify any instances where a concept, term, or event from one bounded context's ubiquitous language appears in another context without explicit translation. Provide specific examples from the documentation.
4.  **Flag Context Map Violations:** Check for any behavior that contradicts the declared relationship type in the context map (e.g., a Conformist context implementing its own independent logic, or a Partnership lacking a well-defined translation interface).

## Output Schema
Return your analysis as a JSON object with the following structure:
{
  "assessment_report": {
    "analyzed_contexts": ["string"],
    "coupling_relationships": [
      {
        "source_context": "string",
        "target_context": "string",
        "declared_relationship_type": "string",
        "actual_relationship_type": "string",
        "relationship_type_confidence": "high | medium | low",
        "translation_layer_assessment": {
          "is_present": true,
          "adequacy": "adequate | partially_adequate | inadequate | not_applicable",
          "notes": "string"
        },
        "domain_language_leakage": [
          {
            "leaked_term": "string",
            "source_context": "string",
            "target_context": "string",
            "evidence": "string"
          }
        ],
        "context_map_violations": [
          {
            "violation_type": "string",
            "description": "string",
            "evidence": "string"
          }
        ],
        "overall_coupling_health": "healthy | warning | critical"
      }
    ],
    "summary_of_findings": "A concise summary of the most critical coupling issues and risks."
  }
}

## Constraints
- Base your analysis strictly on the provided documentation. Do not infer or assume relationships not explicitly stated or clearly implied by the context map.
- If the documentation is insufficient to assess a specific point, set the confidence to "low" and note the missing information.
- For every violation or leakage flagged, you must provide direct evidence from the input documentation.

To adapt this template, replace the placeholders with your actual architecture artifacts. The [CONTEXT_MAP_DOCUMENTATION] should be a textual description or a structured representation of your context map. The [LIST_OF_BOUNDED_CONTEXTS] can be a simple list of names. If you want to focus the analysis, provide a subset of relationships in [SPECIFIC_RELATIONSHIPS_TO_REVIEW]; otherwise, the model will analyze all pairwise relationships. The output is a strict JSON schema, making it suitable for direct ingestion into an architecture dashboard or CI/CD pipeline. For high-stakes architecture decisions, always have a senior architect review the AI-generated assessment before accepting any refactoring recommendations.

IMPLEMENTATION TABLE

Prompt Variables

Each placeholder must be populated for the prompt to produce reliable output. Incomplete inputs degrade assessment quality.

PlaceholderPurposeExampleValidation Notes

[CONTEXT_MAP]

Defines the bounded contexts, their relationships, and the translation layers between them

Context A (Order Management) maps to Context B (Fulfillment) via a shared kernel containing OrderId and CustomerId

Must be a valid JSON object with context names as keys and relationship definitions as values. Parse check required.

[UBIQUITOUS_LANGUAGE_GLOSSARY]

Provides the canonical terms for each bounded context to detect language leakage

Order Management: Order, LineItem, Customer. Fulfillment: Shipment, PickList, Carrier

Must contain at least two contexts with distinct term lists. Null allowed if assessment is structural-only.

[DEPENDENCY_GRAPH]

Specifies the import, call, or reference dependencies between components in each context

Order Service imports Fulfillment Client. Payment Gateway calls Order Service for amount verification.

Must be a directed graph in adjacency list or matrix format. Each edge must reference a declared context from [CONTEXT_MAP].

[INTEGRATION_PATTERNS]

Describes the communication style and data flow between contexts

Synchronous REST call, async event via OrderPlaced message on Kafka, shared database table orders.customer_prefs

Must enumerate each integration point with protocol, direction, and payload type. Schema check for known patterns.

[ASSESSMENT_CRITERIA]

Defines the coupling dimensions to evaluate and their severity thresholds

Domain language leakage: HIGH severity. Shared database: CRITICAL severity. Translation layer adequacy: MEDIUM severity.

Must be a list of criteria with severity levels. Each criterion must be evaluable from the provided inputs. Null allowed for default criteria.

[OUTPUT_SCHEMA]

Specifies the required structure for the coupling report

JSON schema with fields: context_pair, coupling_type, severity, evidence, recommendation

Must be a valid JSON Schema or a structured field list. Parse check required. If null, default report format is used.

[EXEMPTION_RULES]

Declares intentional coupling that should not be flagged as violations

Shared kernel for OrderId is exempt. Direct DB read for reporting context is exempt.

Must be a list of exemption statements with a rationale for each. Null allowed if no exemptions exist.

[CONSTRAINTS]

Sets boundaries for the assessment scope and output behavior

Do not flag test-only dependencies. Limit report to top 20 findings. Require source file path for every evidence citation.

Must be a list of actionable constraints. Each constraint must be enforceable by a downstream validator. Null allowed for default constraints.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Bounded Context Coupling Assessment Prompt into an architecture review workflow with validation, retry, and human review gates.

This prompt is designed to be integrated into a structured architecture review pipeline, not run as a one-off chat interaction. The implementation harness should treat the prompt as a deterministic analysis step that receives a formalized domain model as input and produces a machine-readable coupling report as output. The primary integration points are: a pre-processing stage that assembles the bounded context inventory and relationship evidence, the LLM call itself, a post-processing validation layer that checks structural completeness and domain language consistency, and a human review gate for high-severity findings before they become action items. The harness must assume that the model will occasionally produce plausible-sounding but incorrect relationship classifications, so validation and human review are mandatory, not optional.

Begin by defining a strict input schema for the [CONTEXT_MAP] and [UBIQUITOUS_LANGUAGE_GLOSSARY] placeholders. The context map should be a structured JSON or YAML object listing each bounded context, its canonical name, its published domain events, its exposed API contracts, and its declared upstream/downstream relationships with relationship types (e.g., Partnership, Customer-Supplier, Conformist, Anticorruption Layer, Open Host Service, Published Language, Shared Kernel, Separate Ways). The glossary should map each context to a list of its core domain terms with definitions. Feed this structured input into the prompt template, replacing the placeholders programmatically. For the LLM call, use a model with strong reasoning capabilities and a low temperature setting (0.1–0.2) to maximize consistency across runs. Enable structured output mode if the model supports it, targeting the [OUTPUT_SCHEMA] defined in the prompt. If the model does not support native structured output, append a strict JSON-only instruction and implement a retry loop with a JSON parser as the first validation gate.

The post-processing validation layer must perform at least four checks before the output reaches a human reviewer. First, validate that every bounded context listed in the input context map appears in the output report's contexts array and that no hallucinated contexts were added. Second, for every reported relationship, verify that the from and to context names exist in the input and that the declared_type matches the input context map's declared relationship; flag any mismatch as a potential model error. Third, scan the domain_language_leakage array and cross-reference each flagged term against the input glossary to confirm the term actually belongs to the claimed source context; a term that appears in multiple glossaries by design is not a leak. Fourth, check that every translation_layer_assessment entry references a relationship that exists in the output and that the adequacy field is one of the allowed enum values. Any validation failure should trigger a retry with the original prompt plus the specific validation error message appended as a correction instruction. Limit retries to three attempts before escalating to human review with the failure log attached.

The human review gate should be triggered automatically for any report that contains severity: critical findings, translation_layer_assessment.adequacy: inadequate, or more than three domain_language_leakage entries. Present the reviewer with a diff view showing the input context map, the model's raw output, the validation results, and a summary of flagged items. The reviewer can approve the report as-is, correct specific findings, or reject the entire analysis and request a re-run with adjusted inputs. Store every approved report as a versioned artifact in the architecture decision log, including the prompt version, model version, input snapshot, and reviewer identity. For teams running this assessment periodically, implement a drift detection harness that compares the current report against the previous approved report and surfaces new coupling points, resolved leakages, or changed relationship types as a change log for the architecture review meeting.

Avoid wiring this prompt directly into an automated enforcement gate, such as a CI/CD pipeline blocker, without human review. The model can misclassify intentional shared kernels as violations, flag domain terms that are legitimately shared by design, or miss subtle coupling introduced through implicit conventions rather than explicit API calls. Use the prompt as a discovery and analysis tool that feeds human judgment, not as a policy enforcement engine. When integrating with existing architecture tooling, prefer to call this prompt from a scheduled workflow or an architecture review bot that posts findings to a dedicated channel, rather than blocking pull requests or deployments.

IMPLEMENTATION TABLE

Expected Output Contract

The JSON structure, field types, and validation rules that downstream systems should enforce when processing the Bounded Context Coupling Assessment output.

Field or ElementType or FormatRequiredValidation Rule

assessment_id

string (UUID v4)

Must match UUID v4 regex. Generate if not provided in [INPUT].

assessed_contexts

array of strings

Must contain exactly 2 elements matching the [CONTEXT_A] and [CONTEXT_B] placeholders. No empty strings.

overall_coupling_score

number (0.0 - 1.0)

Must be a float between 0.0 and 1.0 inclusive. Higher means tighter coupling. Check range.

relationship_type

string (enum)

Must be one of: Partnership, Shared Kernel, Customer-Supplier, Conformist, Anti-Corruption Layer, Open Host Service, Published Language, Separate Ways, Big Ball of Mud. Case-sensitive.

translation_layer_adequacy

string (enum)

Must be one of: Adequate, Inadequate, Not Applicable. If relationship_type is Anti-Corruption Layer, cannot be Not Applicable.

domain_language_leakage

array of objects

Each object must have fields: leaked_term (string), source_context (string matching one assessed_context), target_context (string matching the other assessed_context), severity (enum: Low, Medium, High). Array can be empty.

context_map_violations

array of objects

Each object must have fields: violation_type (string), description (string), evidence (string). Array can be empty. If non-empty, description and evidence cannot be empty strings.

recommendations

array of strings

Must contain at least 1 recommendation if overall_coupling_score > 0.7 or translation_layer_adequacy is Inadequate. Each string must be non-empty and under 500 characters.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when this prompt runs against real architecture documentation and how to guard against each failure.

01

Hallucinated Context Relationships

What to watch: The model invents coupling relationships, translation layers, or domain events that don't exist in the provided documentation. This is especially common when context maps are incomplete or when the model fills gaps with plausible but fictional integration patterns. Guardrail: Require the model to cite specific document sections or diagram elements for every identified relationship. Add a validation step that cross-references each claimed coupling against an explicit source reference. If no source exists, flag the finding as 'unverified' rather than presenting it as fact.

02

Domain Language Leakage False Positives

What to watch: The model flags shared terminology as 'leakage' when the terms are actually part of a deliberate shared kernel or when identical words carry different meanings in different bounded contexts. This produces noise that undermines trust in the assessment. Guardrail: Include explicit definitions of shared kernel boundaries in the input context. Add a pre-check that distinguishes between accidental language duplication and intentional shared vocabulary. Require the model to justify each leakage claim with evidence of semantic conflation, not just string matching.

03

Translation Layer Adequacy Overestimation

What to watch: The model rates anti-corruption layers and translation mechanisms as adequate based on their documented existence rather than their actual implementation quality. A documented ACL that doesn't fully isolate domain concepts gets a passing grade. Guardrail: Include specific evaluation criteria for translation layer effectiveness: bidirectional mapping completeness, domain event isolation, and schema independence. Require the model to identify gaps in each dimension rather than making a binary adequate/inadequate judgment.

04

Context Map Violation Blindness to Implicit Coupling

What to watch: The model misses coupling that occurs through shared databases, temporal ordering dependencies, or organizational handoffs because these aren't represented in formal context maps. The assessment looks clean while real coupling persists. Guardrail: Expand the input to include data storage mappings, event choreography descriptions, and team interaction patterns. Add explicit checks for database-per-context violations, shared table access, and implicit sequencing assumptions between contexts.

05

Relationship Type Misclassification at Scale

What to watch: When assessing many bounded contexts, the model starts misclassifying partnership relationships as customer-supplier, or conflates conformist patterns with anti-corruption layers. Accuracy degrades as context count increases. Guardrail: Process bounded context pairs individually rather than in a single large assessment. Use a consistent relationship taxonomy with clear distinguishing criteria for each type. Add a consistency check that flags when the same context pair receives different relationship classifications across multiple runs.

06

Missing Upstream-Downstream Directionality

What to watch: The model identifies that two contexts are coupled but fails to correctly determine which context is upstream and which is downstream, leading to inverted influence analysis and wrong remediation recommendations. Guardrail: Require explicit directionality evidence for every coupled pair: which context defines the interface, which context depends on the other's model, and which team controls the integration contract. Flag any relationship where directionality is ambiguous for human review rather than guessing.

IMPLEMENTATION TABLE

Evaluation Rubric

Score each dimension on a pass/fail basis before shipping this prompt into your architecture review workflow. Run these tests against a representative sample of bounded context pairs from your domain model.

CriterionPass StandardFailure SignalTest Method

Context Identification Accuracy

All bounded contexts in [CONTEXT_MAP] are correctly identified and named in the output

Output references a context not present in the input map, or misses a context that is present

Diff output context names against input [CONTEXT_MAP] keys; flag any additions or omissions

Relationship Type Classification

Every context pair receives exactly one relationship type from the allowed taxonomy: Partnership, Shared Kernel, Customer-Supplier, Conformist, Anticorruption Layer, Open Host Service, Published Language, Separate Ways, Big Ball of Mud

Output uses an undefined relationship type, assigns multiple types to one pair, or defaults to a generic label like 'Related'

Validate each relationship field against the allowed enum; reject any value not in the set

Translation Layer Adequacy Assessment

For every Customer-Supplier or Anticorruption Layer relationship, the output includes a specific translation mechanism or explicitly states 'None identified' with a risk flag

Output omits translation assessment for a context pair that requires one, or describes a mechanism without naming the implementation artifact

Parse each relationship entry; check that required translation fields are non-null for applicable relationship types

Domain Language Leakage Detection

Every reported leakage instance includes the specific term, the source context, the target context where it appears, and a concrete example from [ARTIFACTS]

Output claims leakage without citing a term, or cites a term that is genuinely shared by design in a Shared Kernel relationship

Extract all leakage claims; verify each has a term, source, target, and example; cross-check Shared Kernel pairs for false positives

Context Map Violation Flagging

Each violation includes the rule broken, the context pair involved, and a severity of Low, Medium, or High with rationale grounded in [ARCHITECTURE_RULES]

Output flags a violation without naming the rule, assigns severity without rationale, or misses a documented rule violation present in the input

Parse violation entries; check rule reference exists in [ARCHITECTURE_RULES]; verify severity rationale is non-empty and references specific evidence

Output Schema Compliance

Output is valid JSON matching the [OUTPUT_SCHEMA] exactly, with all required fields present and no extra top-level keys

Output is not parseable JSON, missing required fields like 'context_pairs' or 'violations', or contains unexpected top-level keys

Validate output against [OUTPUT_SCHEMA] using a JSON schema validator; reject on any schema mismatch

Source Grounding Completeness

Every assertion about coupling, leakage, or violation includes a reference to a specific artifact from [ARTIFACTS] or a named context from [CONTEXT_MAP]

Output makes a claim like 'Context A depends on Context B' without citing the import, API call, schema reference, or event subscription that proves it

Scan all coupling and violation claims; verify each has a non-empty source reference field that maps to an artifact or context in the input

Abstention on Insufficient Evidence

When [ARTIFACTS] lacks evidence to assess a context pair, the output marks the relationship as 'Unassessable' with a reason rather than guessing

Output assigns a relationship type or flags a violation for a context pair with zero supporting evidence in [ARTIFACTS]

Identify context pairs with no artifact references in the output; verify they are marked 'Unassessable' and not assigned a relationship type

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single bounded context pair and lighter validation. Remove the [CONTEXT_MAP] placeholder and manually paste the domain descriptions directly into the prompt. Skip the schema validation harness and review the output manually.

Watch for

  • Overly broad relationship classifications when context descriptions are incomplete
  • Missing translation layer adequacy checks when only high-level context summaries are provided
  • False confidence in coupling assessments without source-grounding to actual code or documentation
Prasad Kumkar

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.