Inferensys

Prompt

Distributed Monolith Risk Detection Prompt

A practical prompt playbook for using the Distributed Monolith Risk Detection Prompt in production AI-assisted architecture review workflows.
Risk analyst performing AI risk assessment on laptop, risk matrices visible, casual office risk session.
PROMPT PLAYBOOK

When to Use This Prompt

Identify when to deploy the Distributed Monolith Risk Detection Prompt and when a different tool is required.

Use this prompt when you are an architect or technical lead reviewing a microservice decomposition plan, a migration roadmap, or an existing distributed system that feels harder to change than it should. The job-to-be-done is detecting distributed monolith smells—tight coupling, shared databases, chatty communication, and synchronous chains—before they calcify into an operational and delivery bottleneck. You need a structured risk register, not a generic opinion, and you need it grounded in the specific architecture artifacts you provide: service maps, data ownership matrices, API contracts, or deployment diagrams.

The prompt is designed for a reader who already understands distributed systems trade-offs and needs a rigorous, evidence-based review. You must supply concrete context: a list of services, their dependencies, data store assignments, communication protocols, and any known pain points. The prompt works best when you include both the intended design and the actual implementation reality, because the gap between them is where distributed monoliths hide. Do not use this prompt for greenfield system design, for evaluating a monolith that has not yet been decomposed, or for performance profiling—those require different prompts focused on design generation, monolith analysis, or load testing respectively.

Before running this prompt, gather your architecture evidence. If you lack a dependency graph or data ownership map, start with the Service Dependency Graph Coupling Score Prompt or the Cross-Service Data Ownership Analysis Prompt first. After you receive the risk register, use the remediation sequencing guidance to prioritize fixes, then feed the highest-risk items into the Service Boundary Candidate Identification Prompt or the Strangler Fig Migration Step Planning Prompt. Do not treat the output as a final verdict—validate each finding against your team's operational experience and use the risk register as a discussion artifact for an architecture review session with the full engineering team.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Distributed Monolith Risk Detection Prompt delivers value and where it creates false confidence. Use these cards to decide whether to run the prompt, skip it, or pair it with additional evidence.

01

Good Fit: Pre-Migration Architecture Review

Use when: a team has a decomposition plan or a set of proposed service boundaries before extraction begins. The prompt excels at identifying coupling patterns, shared database dependencies, and chatty communication paths that would survive extraction. Guardrail: always pair the prompt output with a static dependency graph from the actual codebase—the prompt reasons about the plan, not the implementation.

02

Bad Fit: Greenfield System Design

Avoid when: no existing system or concrete decomposition proposal exists. The prompt detects distributed monolith smells in a defined architecture, not in abstract design discussions. Without service candidates, data ownership assignments, and integration points to analyze, the output becomes generic advice. Guardrail: use a Service Boundary Candidate Identification Prompt first, then run this prompt on the resulting boundary proposals.

03

Required Input: Concrete Boundary Map

What to watch: running the prompt on vague descriptions like 'we're thinking about microservices' produces low-quality risk registers with false positives and missed coupling patterns. Guardrail: the prompt requires a defined set of service candidates, their data ownership claims, and their communication paths. If these inputs are missing, stop and produce them before invoking the prompt.

04

Operational Risk: False Confidence in Remediation Sequencing

What to watch: the prompt produces remediation sequencing guidance, but this guidance is based on architectural reasoning alone—it does not account for team capacity, business deadlines, or deployment pipeline readiness. Guardrail: treat the remediation sequence as a technical dependency ordering input, not a project plan. Merge it with team velocity data and business priorities before committing to a migration timeline.

05

Bad Fit: Runtime Performance Diagnosis

Avoid when: the goal is diagnosing production latency, throughput bottlenecks, or resource contention. The prompt analyzes structural coupling, not runtime behavior. Guardrail: for runtime diagnosis, use observability prompts that reason from traces, metrics, and logs. This prompt complements runtime analysis by identifying the architectural patterns that cause the performance issues.

06

Required Input: Database Schema and Access Patterns

What to watch: shared database dependencies are the most common distributed monolith smell, but the prompt cannot detect them without schema information. Guardrail: provide table-level ownership mappings, foreign key relationships, and read/write access patterns per proposed service. Without this data, the prompt will miss the highest-severity coupling risks.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt with square-bracket placeholders for detecting distributed monolith risks in a microservice decomposition plan or existing system.

This prompt template is designed to be copied directly into your AI harness, IDE, or orchestration layer. It accepts a system description, architecture artifacts, and evaluation constraints, then produces a structured risk register. Every placeholder is enclosed in square brackets and must be replaced with concrete values before execution. The template assumes you have already gathered the necessary context—deployment diagrams, service inventories, database schemas, and communication patterns—and are ready to run a structured risk assessment.

text
You are an experienced distributed systems architect reviewing a microservice decomposition plan or existing system for distributed monolith smells. Your goal is to produce a structured risk register that identifies coupling patterns, shared dependencies, and communication anti-patterns that would negate the benefits of a service-oriented architecture.

## INPUT
[SYSTEM_DESCRIPTION]
[ARCHITECTURE_DIAGRAMS_OR_ARTIFACTS]
[SERVICE_INVENTORY]
[DATABASE_SCHEMAS_OR_DATA_STORE_DESCRIPTIONS]
[COMMUNICATION_PATTERNS_AND_PROTOCOLS]

## OUTPUT_SCHEMA
Return a valid JSON object with this exact structure:
{
  "assessment_summary": "string (2-3 sentence executive summary)",
  "risk_register": [
    {
      "risk_id": "string (unique identifier, e.g., DM-001)",
      "risk_category": "string (one of: SharedDatabase, ChattyCommunication, TightCoupling, SynchronousChain, DataOwnershipViolation, DeploymentCoupling, SchemaCoupling, IdentityCoupling, DistributedTransaction, ObservabilityGap)",
      "severity": "string (Critical | High | Medium | Low)",
      "affected_services": ["string"],
      "description": "string (specific pattern observed and why it's problematic)",
      "evidence": "string (concrete reference to the input artifacts that demonstrates this risk)",
      "remediation": "string (specific, actionable recommendation)",
      "remediation_effort": "string (Small | Medium | Large | X-Large)",
      "remediation_sequencing_priority": "integer (1 = address first, higher numbers = later)"
    }
  ],
  "coupling_heatmap": {
    "service_pairs": [
      {
        "service_a": "string",
        "service_b": "string",
        "coupling_score": "number (0-100, where 100 is maximum coupling)",
        "primary_concern": "string"
      }
    ]
  },
  "remediation_roadmap": {
    "phases": [
      {
        "phase": "integer",
        "objective": "string",
        "risks_addressed": ["string (risk_ids)"],
        "estimated_effort": "string",
        "success_criteria": "string"
      }
    ]
  },
  "false_positive_notes": ["string (any patterns that look risky but are justified in this context)"]
}

## CONSTRAINTS
- Only flag risks that are supported by evidence in the provided artifacts. Do not speculate about risks that might exist in a different system.
- If a shared database is justified by low-latency transactional requirements and the services are owned by the same team, note this in false_positive_notes rather than flagging it as Critical.
- Distinguish between synchronous chains that are architecturally necessary (e.g., authentication) and those that are accidental coupling.
- For each risk, the remediation must be specific to the affected services, not generic advice.
- If the input is incomplete or ambiguous, list what additional information would be needed in a separate "information_gaps" field at the top level of the output.

## RISK_LEVEL
[HIGH] This assessment may influence architecture decisions, extraction sequencing, and team assignments. Flag uncertainty explicitly. Do not present speculation as certainty.

## EXAMPLES
[OPTIONAL_FEW_SHOT_EXAMPLES]

To adapt this template, start by replacing [SYSTEM_DESCRIPTION] with a concise narrative of what the system does and its current architectural state. The [ARCHITECTURE_DIAGRAMS_OR_ARTIFACTS] placeholder should contain textual descriptions of deployment diagrams, sequence diagrams, or dependency graphs—if you have actual diagrams, describe them in prose. [SERVICE_INVENTORY] expects a list of services with their responsibilities, while [DATABASE_SCHEMAS_OR_DATA_STORE_DESCRIPTIONS] should describe which services access which data stores and whether any databases are shared. For [COMMUNICATION_PATTERNS_AND_PROTOCOLS], describe whether services communicate via synchronous HTTP, gRPC, asynchronous messaging, or shared databases. The [OPTIONAL_FEW_SHOT_EXAMPLES] placeholder can be populated with 1-2 example risk entries that demonstrate your expected severity calibration and evidence style. If you are assessing a proposed design rather than an existing system, add a [DESIGN_STAGE] field set to "proposed" so the model adjusts its certainty language accordingly.

Before using this prompt in production, validate that the output JSON conforms to the schema using a JSON Schema validator. Pay particular attention to the risk_category enum—if the model introduces a new category, either update the schema or add a post-processing step to map it to an allowed value. For high-stakes architecture reviews, run this prompt against multiple models and compare the risk registers for consensus. Disagreements between models on severity or risk presence are themselves useful signals that warrant human architect review. Never treat the output as a final decision; it is a structured input to an architecture review meeting where experienced engineers validate findings against operational reality.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Distributed Monolith Risk Detection Prompt. Each placeholder must be populated before execution to ensure reliable risk analysis and remediation sequencing.

PlaceholderPurposeExampleValidation Notes

[SYSTEM_ARCHITECTURE_DESCRIPTION]

Full description of the microservice decomposition plan or existing system topology

We have 12 services: user-service, order-service, inventory-service, payment-service, notification-service, shipping-service, catalog-service, auth-service, analytics-service, reporting-service, audit-service, gateway-service. User-service owns the users and profiles databases. Order-service owns orders and order_items tables but reads from users database for customer lookups. Payment-service calls order-service synchronously for every payment attempt. All services share a common logging database.

Must contain service names, data ownership boundaries, communication patterns, and shared infrastructure. Minimum 200 words for reliable analysis. Reject if only service names without interaction descriptions.

[COUPLING_PATTERNS_TO_CHECK]

Specific coupling anti-patterns the analysis should prioritize

shared_database, synchronous_chain_calls, data_duplication_without_ownership, shared_libraries_with_business_logic, coordinated_deployment_requirements, shared_domain_models

Use comma-separated values from the approved coupling pattern taxonomy. Null allowed if all patterns should be checked. Validate against allowed enum: shared_database, synchronous_chain_calls, data_duplication_without_ownership, shared_libraries_with_business_logic, coordinated_deployment_requirements, shared_domain_models, chatty_interfaces, distributed_transactions, shared_infrastructure, cross_service_authentication_coupling.

[DATA_STORE_INVENTORY]

Map of databases, schemas, tables, and which services access them

users_db: owned by user-service, read by order-service, payment-service, notification-service. orders_db: owned by order-service, read by shipping-service, analytics-service. inventory_db: owned by inventory-service, no external reads. shared_logging_db: written by all 12 services, read by audit-service, reporting-service.

Must specify ownership per data store and all cross-service access patterns. Schema-level granularity preferred. Reject if only database names without access patterns. Parse check: each data store must have at least one owner and a list of consumers.

[COMMUNICATION_MAP]

Service-to-service interaction inventory with protocol, direction, and frequency

order-service -> payment-service: synchronous REST POST /payments, per order. payment-service -> order-service: synchronous REST GET /orders/{id}, per payment. inventory-service -> order-service: async Kafka inventory.reserved event. notification-service consumes: order.placed, payment.completed, shipping.dispatched from Kafka.

Must include protocol (REST, gRPC, message queue, event bus), direction, and trigger condition. Async vs sync must be explicit. Parse check: each entry must have source, target, protocol, and trigger.

[DEPLOYMENT_COORDINATION_LOG]

Records of which services must be deployed together and why

order-service and payment-service: coordinated deployment required when order schema changes (last 6 months: 4 coordinated deploys). user-service and auth-service: coordinated deployment for authentication token format changes (last 6 months: 2 coordinated deploys). All other services deploy independently.

Must include service pairs/groups, reason for coordination, and frequency evidence. Null allowed if no coordination data exists. If null, prompt will flag this as a data gap and request deployment history before final analysis.

[TRANSACTION_BOUNDARY_REQUIREMENTS]

Business operations requiring consistency guarantees across services

Place Order: must be atomic across order-service (create order) and inventory-service (reserve stock). Process Payment: must be atomic across payment-service (capture payment) and order-service (update order status). Generate Invoice: must be consistent across order-service, payment-service, and reporting-service.

Each entry must name the business operation and list all services that must participate in the consistency boundary. Null allowed if no cross-service transactions exist. If null, prompt will verify this claim against the communication map for contradictions.

[REMEDIATION_CONSTRAINTS]

Organizational, technical, or timeline constraints that limit remediation options

No database technology changes allowed in next 6 months. Team structure is fixed: 4 stream-aligned teams, 1 platform team. Order-service team has 2 engineers and cannot take on additional ownership. Payment-service is PCI-compliant and cannot share database access. Migration must be incremental with zero-downtime requirement.

Must specify constraint type (technical, organizational, regulatory, timeline) and impact on remediation options. Null allowed if no constraints. Parse check: each constraint must have a type label and a concrete limitation statement.

[OUTPUT_SCHEMA]

Expected structure for the risk register and remediation plan output

{"risks": [{"id": "string", "pattern": "string", "severity": "critical|high|medium|low", "affected_services": ["string"], "evidence": "string", "remediation": {"approach": "string", "sequencing": "string", "prerequisites": ["string"], "estimated_effort": "string"}}], "summary": {"total_risks": "integer", "critical_count": "integer", "distributed_monolith_score": "float"}}

Must be valid JSON Schema or example structure. Validate with JSON parse before prompt execution. Reject if schema is not parseable. If null, default schema from playbook will be used.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Distributed Monolith Risk Detection prompt into an architecture review pipeline with validation, retries, and human review gates.

This prompt is designed to operate as a batch analysis step inside an architecture review workflow, not as a real-time chat interaction. The typical integration pattern is: collect system artifacts (deployment diagrams, service dependency graphs, database schemas, API specifications, and communication traces), assemble them into the [SYSTEM_ARTIFACTS] placeholder, and submit the prompt through an API call to a model capable of structured output. The output is a risk register JSON object that downstream tooling can parse, store, and display. Because the analysis covers architectural decisions that may influence refactoring roadmaps and resource allocation, the harness must include validation, retry logic, and a human review step before any findings are treated as actionable.

Validation and retry strategy. The prompt requests a specific JSON schema with risks, coupling_patterns, shared_database_dependencies, chatty_communication_paths, and remediation_sequence fields. Implement a schema validator that checks the response against this contract immediately after the model returns. If validation fails, retry up to two times with the same prompt, appending the validation error to the [CONSTRAINTS] section as a correction instruction. After three failed attempts, log the failure, capture the raw response for debugging, and escalate to a human reviewer rather than silently accepting a malformed output. For high-stakes reviews, add a confidence threshold check: if the model includes a confidence field below 0.7 for any individual risk item, flag that item for mandatory human review even if the schema is valid.

Model selection and tool use. This prompt benefits from models with strong reasoning capabilities and large context windows, as system artifacts can be extensive. GPT-4o, Claude 3.5 Sonnet, and Gemini 1.5 Pro are suitable starting points. The prompt does not require function calling or external tools during execution, but you may choose to wire it into a RAG pipeline if your system artifacts are stored in a documentation repository. In that case, retrieve relevant architecture decision records, dependency graphs, and database schemas before assembling the prompt, and include source references in the [SYSTEM_ARTIFACTS] section so the model can cite specific documents in its findings.

Human review and downstream integration. Every risk item in the output should be surfaced in a review UI that allows an architect to accept, reject, or annotate each finding. Store the raw model output, the reviewer's decisions, and the final approved risk register in a versioned artifact store. This creates an audit trail for governance and allows you to measure the prompt's precision and recall over time. Avoid wiring the output directly into automated refactoring tools or ticket creation systems without human approval—the cost of acting on a false positive (e.g., splitting a service that should remain together) is high. The remediation_sequence field provides a suggested ordering, but sequencing decisions should always be reviewed against team capacity, business priorities, and operational constraints that the model cannot fully assess.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structure, types, and validation rules for each field in the distributed monolith risk detection output. Use this contract to parse, validate, and integrate the model response into your architecture review pipeline.

Field or ElementType or FormatRequiredValidation Rule

risk_register

Array of objects

Must be a non-empty array. If no risks found, return a single object with risk_id 'NONE' and severity 'INFO'.

risk_register[].risk_id

String (kebab-case)

Must match pattern ^[a-z]+(-[a-z]+)*$. Must be unique within the array.

risk_register[].pattern

Enum string

Must be one of: 'shared_database', 'chatty_communication', 'distributed_transaction', 'tight_coupling', 'data_duplication', 'orchestration_bottleneck', 'sync_dependency'.

risk_register[].severity

Enum string

Must be one of: 'CRITICAL', 'HIGH', 'MEDIUM', 'LOW'. CRITICAL risks require immediate remediation before further extraction.

risk_register[].affected_services

Array of strings

Must contain at least 2 service names. Each name must be a non-empty string. No duplicate service names within a single risk entry.

risk_register[].evidence

String

Must be a non-empty string describing the specific coupling mechanism observed. Must reference concrete API calls, database tables, or message topics.

risk_register[].remediation_sequence

Array of objects

Must contain at least 1 step. Each step must have 'order' (integer, starting at 1), 'action' (non-empty string), and 'rollback_condition' (non-empty string).

metadata.generated_at

ISO 8601 datetime string

Must parse as a valid datetime. Used for audit trail and comparison across review cycles.

PRACTICAL GUARDRAILS

Common Failure Modes

Distributed monolith detection prompts fail in predictable ways. These are the most common failure modes and the guardrails that catch them before they reach a decision document.

01

False Negatives on Shared Databases

What to watch: The prompt misses services that share a database but access disjoint tables, treating them as independent. This happens when the model focuses on schema-level coupling and ignores runtime connection pooling, shared credentials, or a single point of failure. Guardrail: Require the prompt to enumerate every database connection string and credential scope per service before scoring coupling. Flag any service pair that shares a database instance, even with separate schemas.

02

Chatty Communication Overlooked

What to watch: The prompt correctly identifies coarse-grained API dependencies but misses excessive fine-grained calls—services making dozens of requests to complete one logical operation. The model often treats each call as independent and fails to aggregate them into a chatty-pattern risk. Guardrail: Add a pre-processing step that counts cross-service call frequency per business transaction. Feed aggregated call counts into the prompt as a structured input, not raw logs.

03

Deployment Coupling Blind Spot

What to watch: The prompt analyzes runtime and data coupling but ignores deployment coupling—services that must be released together, share a CI/CD pipeline, or use coordinated versioning. These are distributed monolith smells that static architecture analysis misses. Guardrail: Require the prompt to request deployment pipeline topology as a required input. If unavailable, flag deployment coupling as an unassessed risk rather than assuming independence.

04

Remediation Sequencing Overconfidence

What to watch: The prompt produces a remediation sequence that looks logical but ignores organizational constraints—team capacity, migration windows, or dependent roadmap commitments. The model optimizes for technical coupling reduction without weighting operational feasibility. Guardrail: Add a constraint block requiring the prompt to score each remediation step on team readiness, downtime window, and rollback complexity. Re-rank the sequence by a weighted composite score, not pure coupling reduction.

05

Boundary Definition Drift Across Services

What to watch: The prompt applies inconsistent boundary criteria across the system—using data ownership for one service pair, deployment independence for another, and team alignment for a third. This produces a risk register where scores aren't comparable. Guardrail: Lock the evaluation dimensions in the prompt template as a fixed rubric applied uniformly to every service pair. Require the output to include the dimension scores, not just the final risk level.

06

Shared Library and Client Coupling Missed

What to watch: The prompt focuses on service-to-service communication and misses coupling through shared libraries, common client SDKs, or monorepo build artifacts. Services that import the same domain model library are coupled even if they never call each other directly. Guardrail: Require the prompt to analyze import graphs and shared dependency versions as a separate coupling dimension. Flag any shared library that contains domain logic or serialization formats as a distributed monolith vector.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality of the Distributed Monolith Risk Detection output before integrating it into a review pipeline or sharing it with stakeholders. Each criterion includes a pass standard, a failure signal, and a test method.

CriterionPass StandardFailure SignalTest Method

Risk Register Completeness

Output contains at least one risk entry for each coupling pattern category (e.g., shared database, chatty communication, synchronous chains) mentioned in the input context.

Output omits an entire category of coupling pattern that is clearly present in the provided system description.

Parse the output JSON. Assert that the risks array contains objects with a category field. Check that the set of unique category values covers all patterns identifiable in a pre-annotated golden input.

Coupling Pattern Specificity

Each risk entry identifies a concrete service pair, endpoint, or database table, not just a general pattern name.

A risk entry describes a generic problem like 'shared database' without naming the specific database or the services involved.

For each object in the risks array, assert that the source and target fields are populated with specific service names, and that the evidence field contains a concrete artifact name (e.g., table name, endpoint path).

Remediation Sequencing Logic

The remediation_sequence array is ordered by dependency, where removing one coupling risk enables the next step.

The sequence suggests extracting a service before its shared database dependency is resolved, or the ordering has no clear dependency rationale.

Parse the remediation_sequence array. For each step, check that its depends_on field references a valid prior step ID. Assert no circular dependencies exist in the sequence.

Shared Database Dependency Detection

All explicitly mentioned shared databases in the input are flagged with a risk score of 'high' or 'critical'.

A shared database mentioned in the input is missing from the risk register or is incorrectly scored as 'low'.

Provide a golden input describing two services sharing a single database. Assert that the output's risks array contains an entry with category: shared_database and severity in ['high', 'critical'].

Chatty Communication Path Identification

Output identifies synchronous call chains of depth 3 or greater as a high-risk pattern.

A call chain of A->B->C->D is flagged as 'low' risk or is not identified at all.

Provide a golden input with a defined call graph. Parse the output and assert that a risk entry exists with category: chatty_communication and severity: high when the call chain depth exceeds 2.

Output Schema Validity

The output is valid JSON that strictly conforms to the defined [OUTPUT_SCHEMA].

The output is missing required fields like risks, remediation_sequence, or summary, or contains fields with incorrect data types.

Validate the raw model output against the [OUTPUT_SCHEMA] using a JSON schema validator. Assert no validation errors are returned.

Remediation Actionability

Each step in the remediation_sequence contains a concrete technical action (e.g., 'Extract the [TABLE_NAME] table into a new [SERVICE_NAME] service') rather than vague advice.

A remediation step says 'Reduce coupling' without specifying what to change or where.

For each step in the remediation_sequence, assert that the action string contains a specific technical verb (e.g., 'extract', 'migrate', 'introduce') and a specific system component name.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single architecture document or diagram description as [SYSTEM_DESCRIPTION]. Remove structured output requirements initially and ask for a narrative risk assessment. Focus on the core coupling patterns and shared database smells.

Simplify the prompt to: "Review this system design for distributed monolith risks: [SYSTEM_DESCRIPTION]. Identify coupling patterns, shared dependencies, and chatty communication paths."

Watch for

  • Missing structured risk register format makes comparison across reviews difficult
  • Model may conflate intentional co-location with accidental coupling
  • No severity scoring means teams can't prioritize findings
  • Overly broad instructions produce vague warnings instead of actionable signals
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.