This prompt is for architects and platform engineers who need to evaluate integration patterns where multiple services read from or write to the same database tables. The job-to-be-done is producing a structured risk report that identifies schema ownership conflicts, migration coordination needs, and the specific coupling type (read-only vs. read-write) for each shared table. Use this when you are auditing an existing system, reviewing a proposed architecture, or preparing for a database migration that crosses service boundaries. The ideal user has access to service-to-table mappings, schema definitions, and deployment context for the services involved.
Prompt
Shared Database Coupling Risk Prompt

When to Use This Prompt
Understand the job, the reader, and the constraints before running a shared database coupling risk analysis.
Do not use this prompt when you need a real-time operational health check, a performance analysis of query patterns, or a security audit of data access controls. This prompt focuses on architectural coupling risk, not runtime behavior. It is also not a replacement for a full data governance review or a compliance audit. The prompt works best when you can provide concrete inputs: a list of services, the database tables they access, the type of access (read or write), and any known schema ownership assignments. Without these inputs, the model will produce generic advice that lacks the specificity needed for architectural decisions.
Before running this prompt, gather your service inventory and table access matrix. If you are evaluating a proposed design rather than an existing system, clearly mark which services and access patterns are planned versus implemented. The output should be treated as an architectural analysis artifact, not a final ruling. For high-risk systems—those handling financial transactions, healthcare data, or safety-critical operations—always have a senior architect review the findings and validate them against operational reality. The prompt identifies coupling patterns; human judgment decides which risks are acceptable and what remediation is warranted.
Use Case Fit
Where the Shared Database Coupling Risk Prompt works, where it fails, and what you must have in place before running it.
Good Fit: Pre-Migration Risk Assessment
Use when: evaluating an existing system before a decomposition or microservice extraction effort. The prompt excels at identifying hidden coupling points where multiple services read or write the same tables. Guardrail: Feed the prompt a concrete schema or data catalog, not a vague description of the system.
Good Fit: Architecture Review Gate
Use when: enforcing a governance checkpoint that no new service introduces shared-table access without explicit review. The prompt can act as an automated first-pass reviewer. Guardrail: Combine the prompt output with a human architecture review for any risk rated HIGH or CRITICAL.
Bad Fit: Runtime Traffic Analysis
Avoid when: you need to analyze live database traffic, query logs, or wire-protocol traces. This prompt reasons over declared schemas and documentation, not runtime behavior. Guardrail: Use observability tools for runtime coupling; use this prompt for design-time and static analysis.
Required Input: Schema Ownership Map
What to watch: running the prompt without clear ownership metadata produces vague, unactionable results. The model needs to know which team or service owns each table. Guardrail: Provide a structured input mapping tables to owning services, or instruct the prompt to flag missing ownership as a finding.
Operational Risk: False Confidence in Read-Only Sharing
What to watch: the prompt may understate the risk of read-only sharing, especially when read consumers depend on internal schema details. Guardrail: Add a constraint in the prompt to treat read-only coupling as a distinct risk category, and require a migration plan if the schema is not covered by a stable API contract.
Operational Risk: Incomplete Schema Input
What to watch: a partial schema view leads to missed coupling points and a false sense of safety. The prompt cannot flag what it cannot see. Guardrail: Validate that the input covers all databases in the scope of review, and add a prompt instruction to list any tables that appear to be referenced but are not fully defined in the input.
Copy-Ready Prompt Template
A reusable prompt template for evaluating shared database coupling risk across services, with placeholders for system context, schema details, and output constraints.
This prompt template is designed to produce a structured risk report when multiple services or modules share direct access to the same database tables. It forces the model to identify schema ownership conflicts, classify read-write versus read-only sharing, and surface the coordination costs of schema migrations. Use this template when you have a concrete list of services and the database objects they touch. Do not use it for abstract architecture philosophy discussions or for systems where database access is already mediated by a single API layer.
textYou are an architecture reviewer specializing in integration patterns and database coupling. Your task is to analyze a set of services that share access to a common database and produce a risk report. ## INPUT [SYSTEM_CONTEXT] [SCHEMA_MAP] ## INSTRUCTIONS 1. For each database table or schema object listed in [SCHEMA_MAP], identify every service that accesses it. 2. Classify each access pattern as READ_ONLY, READ_WRITE, or SCHEMA_OWNER. A service is SCHEMA_OWNER if it is the designated source of truth for that table's schema migrations. 3. Flag any table that has more than one READ_WRITE service or zero SCHEMA_OWNER services as a HIGH coupling risk. 4. Flag any table where a non-owner service performs writes as a MEDIUM coupling risk. 5. For each HIGH or MEDIUM risk, describe the specific failure mode: migration conflicts, data corruption, unclear ownership, or coordination overhead. 6. Produce a coordination cost estimate (LOW, MEDIUM, HIGH) for any schema migration that touches a shared table, based on the number of consuming services. ## OUTPUT_SCHEMA Return a valid JSON object with this structure: { "analysis_date": "string", "tables": [ { "table_name": "string", "accessing_services": [ { "service_name": "string", "access_pattern": "READ_ONLY | READ_WRITE | SCHEMA_OWNER" } ], "risk_level": "LOW | MEDIUM | HIGH", "risk_description": "string or null if LOW", "migration_coordination_cost": "LOW | MEDIUM | HIGH", "remediation_suggestion": "string or null if LOW" } ], "summary": { "total_tables": "number", "high_risk_count": "number", "medium_risk_count": "number", "low_risk_count": "number", "overall_recommendation": "string" } } ## CONSTRAINTS - Only report on tables present in [SCHEMA_MAP]. Do not invent additional tables. - If a service accesses a table through a documented API rather than direct database connection, note this but still include it with access_pattern READ_ONLY or READ_WRITE as appropriate. - If [SCHEMA_MAP] is incomplete, note missing information in the summary rather than guessing. - Do not recommend specific vendor tools unless they are already mentioned in [SYSTEM_CONTEXT]. ## RISK_LEVEL [RISK_LEVEL]
Adaptation notes: Replace [SYSTEM_CONTEXT] with a paragraph describing the overall system, its services, and the database technology in use. Replace [SCHEMA_MAP] with a structured list of tables and the services that access them—this can be a markdown table, a JSON array, or a bulleted list. The [RISK_LEVEL] placeholder should contain any organization-specific risk thresholds or definitions; if you have none, replace it with 'Use standard definitions as described in the instructions.' For high-stakes production databases, add a [HUMAN_REVIEW] constraint requiring that any HIGH risk finding be explicitly flagged for manual approval before the report is considered final.
Prompt Variables
Required inputs for the Shared Database Coupling Risk Prompt. Each placeholder must be populated with concrete, source-grounded data before execution. Incomplete or guessed inputs produce unreliable risk scores.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[DATABASE_SCHEMA] | Full DDL or schema representation of the database under review, including all tables, columns, indexes, and constraints | CREATE TABLE orders (id UUID PRIMARY KEY, user_id UUID, status VARCHAR, ...); CREATE TABLE billing (id UUID, order_id UUID REFERENCES orders(id), ...); | Parse check: must be valid SQL DDL or equivalent schema definition. Null not allowed. Minimum 2 tables required for coupling analysis. |
[SERVICE_OWNERSHIP_MAP] | Mapping of each database table or schema to the service or team that owns it for write operations | orders -> order-service (Team Alpha), billing -> billing-service (Team Beta), audit_log -> shared-read (monitoring-service) | Schema check: must be a valid JSON object mapping table names to service identifiers. Every table in [DATABASE_SCHEMA] must appear. Null not allowed. |
[ACCESS_PATTERN_MATRIX] | Matrix of which services read from or write to which tables, including connection strings or service account identifiers | order-service: WRITE orders, READ orders; billing-service: WRITE billing, READ orders; reporting-service: READ orders, READ billing | Schema check: must be a valid JSON object with read and write arrays per service. Every service in [SERVICE_OWNERSHIP_MAP] must appear. Cross-reference with ownership map for consistency. |
[INTEGRATION_CONTEXT] | Description of the system's integration patterns, including whether sharing is intentional, historical, or accidental | The orders and billing tables were split during a monolith decomposition in Q3 2024. billing-service reads orders to validate order status before processing payments. This read coupling was intentional but not documented. | Free text. Must include rationale for any cross-service table access. Null allowed if no sharing exists, but prompt will produce empty report. |
[MIGRATION_HISTORY] | Recent schema migration logs or changelog showing which teams modified which tables and when | 2025-01-15: Team Alpha added 'tax_exempt' column to orders; 2025-02-03: Team Beta added index on orders.status for query performance; 2025-02-10: Team Alpha renamed orders.payment_ref to orders.billing_ref | Parse check: must be a list of timestamped migration records with team and table identifiers. Null allowed if no migration history available, but coordination risk assessment will be incomplete. |
[CONSTRAINT_BOUNDARY_RULES] | Architectural rules defining acceptable and unacceptable coupling patterns for this system | Rule 1: No service may write to a table owned by another service. Rule 2: Read-only access to another service's table requires an approved data contract. Rule 3: Shared-nothing is the target state for all new services. | Free text or structured policy document. Must define at least one explicit rule. Null not allowed. Vague rules produce vague risk assessments. |
[OUTPUT_SCHEMA] | Desired structure for the risk report, including required fields and severity classifications | {"shared_tables": [{"table": string, "owners": [string], "readers": [string], "writers": [string], "risk_level": "critical|high|medium|low", "conflict_type": "write-write|read-write|schema-dependency"}]} | Schema check: must be a valid JSON Schema or example object. Must include risk_level and conflict_type fields. Null not allowed. |
Implementation Harness Notes
How to wire the Shared Database Coupling Risk Prompt into an application or review workflow.
The Shared Database Coupling Risk Prompt is designed to be integrated into a pre-commit or pull-request review pipeline, not as a one-off chat query. The primary input is a structured representation of your service-to-table mapping, which you must extract from your infrastructure-as-code, ORM configurations, or a live data catalog. The prompt's value comes from its ability to cross-reference this mapping against a set of architectural rules, so the harness must provide a clean, machine-readable [SERVICE_DB_MAP] and a defined [COUPLING_POLICY].
To wire this into an application, build a pre-processing step that scans your repository or infrastructure state to generate the [SERVICE_DB_MAP] JSON. This map should list each service, the database tables it accesses, and the access mode (READ or READ_WRITE). The harness should then call the LLM with the prompt template, the generated map, and your organization's [COUPLING_POLICY] (e.g., 'no two services may write to the same table'). Post-processing must validate the output against the [OUTPUT_SCHEMA]—a JSON object containing a list of violations, each with a severity, services_involved, table_name, and rationale. If the model's output fails schema validation, implement a retry loop (up to 2 attempts) that feeds the validation error back into the prompt as additional [CONSTRAINTS].
For high-stakes environments, do not treat this prompt's output as a blocking gate without human review. The harness should publish the validated risk report as a comment on the relevant pull request or architecture decision record. Log every invocation, including the full prompt, the raw model response, and the final validated output, to an observability platform. This creates an audit trail for architectural decisions. Avoid running this prompt on every commit; instead, trigger it only when files defining database access patterns (e.g., Hibernate mappings, Alembic migration files, or Terraform IAM policies for databases) are modified, preventing noise and alert fatigue.
Common Failure Modes
What breaks first when analyzing shared database coupling and how to guard against it.
False Positives from Read-Only Sharing
What to watch: The prompt flags services as dangerously coupled when they only perform read-only queries against shared tables without owning schema. This inflates risk scores and wastes remediation effort. Guardrail: Require the prompt to classify each shared table access as read-only or read-write before scoring risk. Validate that read-only consumers without migration coordination needs are downgraded in severity.
Missing Implicit Coupling Through Views and Stored Procedures
What to watch: The analysis only scans direct table access and misses coupling through shared views, materialized views, or stored procedures that encapsulate cross-service logic. Guardrail: Extend the prompt to inventory views, functions, and procedures in the schema. Require source-grounding for every access path, not just table-level references. Flag any shared procedural logic as high-severity coupling.
Schema Ownership Ambiguity
What to watch: The prompt cannot determine which service owns a table when multiple services perform writes, leading to vague recommendations that satisfy no one. Guardrail: Require the prompt to output an explicit ownership assignment for every shared table, with a confidence indicator. When ownership is genuinely ambiguous, escalate to human review rather than guessing. Include a field for recommended owner based on write frequency and domain alignment.
Migration Coordination Blind Spots
What to watch: The prompt identifies coupling but fails to surface the specific migration coordination needed—which services must deploy in what order, which schema changes are breaking, and what rollback dependencies exist. Guardrail: Add a required output section for migration sequencing. For each shared table, list the deployment order of dependent services and flag any circular migration dependencies that require coordinated releases.
Environment Drift Between Analysis and Reality
What to watch: The prompt analyzes schema from a static definition or a single environment, but production has diverged due to unreplicated migrations, hotfixes, or environment-specific configurations. Guardrail: Require the prompt to note the source of schema evidence and its freshness. Add a validation step that compares schema across environments before finalizing the risk report. Flag any discrepancies as high-priority findings.
Overlooking Temporal Coupling in Async Workflows
What to watch: The prompt treats all database sharing as structural coupling and misses temporal coupling—where services depend on data being written by another service within a specific time window, creating silent failures under load or latency spikes. Guardrail: Add a temporal coupling check that identifies read-after-write dependencies, timeout assumptions, and polling patterns against shared tables. Flag any access pattern where a service assumes data freshness without explicit coordination.
Evaluation Rubric
Criteria for evaluating the quality and safety of the Shared Database Coupling Risk Report before integrating it into an architecture review workflow or CI/CD gate.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Schema Ownership Conflict Detection | Every shared table is assigned exactly one designated owner service; conflicts where multiple services claim write access are flagged. | A table with write access from two services is listed as 'Shared' without an ownership conflict warning. | Parse output JSON; for each table with |
Read-Only vs Read-Write Classification | Every service-table pair is classified as | A service-table pair has | Validate output schema; assert |
Migration Coordination Risk Flagging | Tables with multiple read-write consumers include a | A table shared by three write-capable services has | Filter output for tables where |
Source Grounding for Each Claim | Every identified shared table includes a | A shared table entry has | Iterate over |
Risk Severity Classification | Each shared table is assigned a | A table with 5 write-sharing services and PII data is classified as | Define a test case with known high-risk attributes; run prompt; assert |
No Hallucinated Tables | Every table listed in the report exists in the provided schema files or configuration; no invented table names. | Report includes a table name not present in the input [SCHEMA_DEFINITIONS]. | Extract all table names from output; diff against a pre-parsed list of valid table names from input; assert diff is empty. |
Actionable Remediation Suggestions | Each | A | Filter for |
Output Schema Validity | The entire response is valid JSON matching the expected [OUTPUT_SCHEMA] without extra fields or missing required fields. | Response is valid JSON but missing the | Run JSON Schema validation against the defined [OUTPUT_SCHEMA]; assert no validation errors. |
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
Add a strict output schema with required fields: table_name, owner_service, consumer_services, access_type, schema_conflicts, migration_coordination_risk, and recommended_action. Include a risk scoring rubric (Low/Medium/High/Critical) with definitions. Add source-grounding requirements: every shared table must cite the schema files or migration histories that prove the coupling. Wire the prompt into a CI/CD pipeline that runs on schema change PRs.
Prompt snippet
code[OUTPUT_SCHEMA] { "shared_tables": [ { "table_name": "string", "owner_service": "string", "consumer_services": ["string"], "access_type": "READ_ONLY | READ_WRITE", "schema_conflicts": ["string"], "migration_coordination_risk": "LOW | MEDIUM | HIGH | CRITICAL", "evidence": "string (schema file path or migration reference)", "recommended_action": "string" } ], "risk_summary": "string", "requires_human_review": "boolean" } Analyze schemas from [SCHEMA_REPOSITORY_PATH] for shared database coupling.
Watch for
- Silent format drift when the model omits optional fields
- False positives from tables that share names but exist in separate database instances
- Missing evidence citations that make findings unverifiable in code review

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