Inferensys

Prompt

Event-Driven Anti-Pattern Detection Prompt

A practical prompt playbook for using the Event-Driven Anti-Pattern Detection Prompt in production AI workflows to scan architecture designs for common pitfalls before they reach production.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

A structured anti-pattern scan for event-driven system designs, identifying failure patterns before they reach production.

This prompt is for architects and platform engineers who need to review event-driven system designs for common anti-patterns before implementation begins. It produces a structured anti-pattern scan covering event-carried state transfer, distributed monolith signals, tight temporal coupling, missing schema registries, and other failure patterns that cause silent data loss and operational fragility in production. The prompt assumes you have a design description, architecture diagram text, or AsyncAPI specification to analyze. It is not a replacement for runtime observability or load testing, and it does not review implementation code.

Use this prompt during architecture review boards, design document evaluations, or as a pre-commit gate for event-driven service proposals. The output is a categorized list of detected anti-patterns, each with a severity rating, a description of the risk, and a concrete remediation recommendation. The prompt is calibrated to flag structural design problems—not style preferences or implementation details. For code-level event handler review, use the Idempotency Design Review Prompt or the Outbox Pattern Implementation Review Prompt instead. For runtime behavior analysis, pair this prompt with the Event-Driven Observability Strategy Prompt.

Before running this prompt, gather the design artifact you want reviewed: an architecture diagram description, an AsyncAPI specification, a design document, or a written summary of the proposed event flow. The prompt works best when the input includes explicit information about event schemas, producer-consumer relationships, delivery guarantees, error handling strategies, and schema evolution plans. If your design document is sparse on these details, the prompt will flag missing information as a risk in itself—which is often the most valuable finding. After receiving the output, validate each flagged anti-pattern against your actual system constraints. Not every flag is a defect; some are acceptable trade-offs. The harness section below describes how to calibrate false positive rates for your organization's risk tolerance.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Event-Driven Anti-Pattern Detection Prompt works, where it fails, and what inputs it assumes before you integrate it into a design review pipeline.

01

Good Fit: Pre-Implementation Design Review

Use when: An architecture diagram, event catalog, or schema draft exists but no code has been written. The prompt excels at catching structural flaws before they become runtime incidents. Guardrail: Always pair the prompt output with a human architect's judgment; the model identifies patterns but cannot assess undocumented business constraints.

02

Bad Fit: Runtime Diagnosis

Avoid when: You are debugging a live production incident with partial logs and metrics. This prompt analyzes static design descriptions, not dynamic system behavior. Guardrail: Route production incidents to observability and runbook prompts instead. Using this prompt on incomplete runtime data will produce speculative, low-confidence output.

03

Required Inputs

What you must provide: A textual description of the event-driven architecture including producers, consumers, topics/queues, event schemas, and intended delivery guarantees. Guardrail: If any of these four elements are missing, flag the output as 'partial analysis' and do not treat it as a complete review. Incomplete inputs produce false negatives.

04

Operational Risk: False Positives

What to watch: The prompt may flag legitimate patterns as anti-patterns when context is missing. For example, event-carried state transfer is sometimes an intentional performance optimization. Guardrail: Calibrate with a known-good architecture first. If the prompt flags more than 30% of a validated design as problematic, adjust the [CONSTRAINTS] or add clarifying context before trusting the output.

05

Operational Risk: Schema Registry Blindness

What to watch: The prompt assumes schema registries are always beneficial and may over-prioritize their absence as a critical finding. Guardrail: Add a [CONSTRAINTS] field specifying whether a schema registry is in use or planned. Without this, the output may distract from more dangerous anti-patterns like tight temporal coupling.

06

Integration Point: CI Pipeline Gate

What to watch: Teams often want to run this as an automated gate in a CI pipeline, but the prompt requires human-readable design documents as input. Guardrail: Do not gate merges on this prompt alone. Use it as an advisory check that generates a review comment. Require a human to confirm or dismiss each finding before the design is approved.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt for scanning event-driven architecture designs against a catalog of common anti-patterns, producing a structured report with severity ratings and remediation guidance.

This prompt template performs a structured anti-pattern scan on an event-driven architecture description. It evaluates the design against known failure modes including event-carried state transfer, tight temporal coupling, missing schema registries, distributed monolith signals, and orphaned subscribers. The output is a machine-readable report suitable for ingestion into architecture review pipelines, decision logs, or CI/CD quality gates. Copy the template below into your AI harness, replace the square-bracket placeholders with actual values, and run it against your architecture documentation or design proposals.

text
You are an event-driven architecture reviewer. Your task is to scan the provided architecture description for common anti-patterns and produce a structured report.

## INPUT
Architecture Description:
[ARCHITECTURE_DESCRIPTION]

Supporting Artifacts (optional):
[SUPPORTING_ARTIFACTS]

## OUTPUT SCHEMA
Return a JSON object with the following structure:
{
  "scan_summary": {
    "total_anti_patterns_found": <integer>,
    "critical_count": <integer>,
    "warning_count": <integer>,
    "info_count": <integer>
  },
  "findings": [
    {
      "id": "AP-<incrementing-number>",
      "anti_pattern": "<name from catalog below>",
      "severity": "critical|warning|info",
      "location": "<specific component, service, or interaction path>",
      "evidence": "<quote or describe the design element that triggers this finding>",
      "impact": "<what breaks, degrades, or becomes unmaintainable>",
      "remediation": "<concrete design change or mitigation>",
      "false_positive_risk": "low|medium|high",
      "requires_human_review": <true|false>
    }
  ],
  "false_positive_notes": [
    "<explanation for any finding with high false_positive_risk>"
  ]
}

## ANTI-PATTERN CATALOG
Scan for these anti-patterns. Only report findings where evidence exists in the input.

1. **Event-Carried State Transfer**: Events that carry full entity state rather than domain intent, causing consumers to reconstruct remote state and creating hidden coupling to producer internal models.

2. **Tight Temporal Coupling**: Design that assumes events arrive within specific time windows, uses synchronous request-response over event channels, or lacks timeout and staleness handling.

3. **Missing Schema Registry**: Events defined without a schema registry, versioned schema store, or contract enforcement mechanism, leading to unversioned payloads and breaking changes without detection.

4. **Distributed Monolith Signal**: Services that emit fine-grained CRUD events mirroring database operations rather than business-domain events, indicating the system is a distributed monolith rather than a truly event-driven architecture.

5. **Orphaned Subscriber**: Subscribers with no clear ownership, no alerting on consumer lag, or no documented recovery procedure when the subscriber fails permanently.

6. **Circular Event Flow**: Events that trigger downstream processing which eventually produces events consumed upstream, creating feedback loops without termination conditions.

7. **Missing Correlation Context**: Events lacking trace IDs, causation IDs, or correlation identifiers, making distributed debugging and observability impossible.

8. **No Dead Letter Strategy**: Absence of dead letter queues, poison message handling, or unprocessable message routing for any event channel.

9. **Implicit Ordering Dependency**: Consumers that depend on event arrival order without explicit sequence numbers, timestamps, or ordering guarantees documented in the design.

10. **Missing Idempotency Design**: Event handlers without idempotency keys, deduplication storage, or at-least-once delivery handling, risking duplicate processing on retry.

11. **Event Type Explosion**: Proliferation of fine-grained event types that mirror internal implementation details rather than stable business events, creating versioning and maintenance burden.

12. **Synchronous Bridge Over Events**: Using event infrastructure to implement synchronous request-response patterns, defeating the decoupling benefits of asynchronous messaging.

## CONSTRAINTS
- Only report findings where the architecture description provides sufficient evidence.
- Do not invent anti-patterns not present in the input.
- For each finding rated critical, set requires_human_review to true.
- If a finding could be a false positive due to missing context, set false_positive_risk to high and explain in false_positive_notes.
- If the architecture description is insufficient to complete a thorough scan, return a partial scan with a note in scan_summary indicating coverage gaps.
- Do not recommend specific vendor products unless the input already references them.

## RISK LEVEL
[RISK_LEVEL]

## EXAMPLES
[EXAMPLES]

Adaptation guidance: Replace [ARCHITECTURE_DESCRIPTION] with the full text of the design document, ADR, or architecture diagram description you want to scan. Use [SUPPORTING_ARTIFACTS] for related event schemas, AsyncAPI specs, or sequence diagrams that provide additional context. Set [RISK_LEVEL] to the review context: "production-blocking" for pre-deployment gates, "advisory" for design reviews, or "exploratory" for early-stage architecture sketching. The [EXAMPLES] placeholder accepts few-shot examples of correct findings to calibrate severity judgment for your organization's risk tolerance. If your architecture spans multiple bounded contexts, run the scan once per context to keep findings scoped and actionable.

Validation and integration: Before integrating this prompt into a CI/CD pipeline, run it against a golden dataset of known architecture descriptions with labeled anti-patterns. Measure precision and recall per anti-pattern type. Pay special attention to false positive rates on Event-Carried State Transfer and Distributed Monolith Signal, which are the most context-sensitive detections. For production use, route findings with requires_human_review: true or severity: critical to an architecture review queue rather than auto-blocking deployments. Store scan results alongside the architecture version they reference so findings remain traceable as the design evolves.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the prompt needs to work reliably. Validate these before sending to the model to prevent false positives and missed anti-patterns.

PlaceholderPurposeExampleValidation Notes

[ARCHITECTURE_DESCRIPTION]

The full text or diagram description of the event-driven architecture under review

We use Kafka with 12 topics. Order Service publishes OrderPlaced, Payment Service consumes it and publishes PaymentProcessed...

Must be non-empty and at least 200 characters. Reject if only a diagram URL without text description.

[EVENT_CATALOG]

List of all event types with their producer, consumer, schema location, and payload summary

OrderPlaced (Producer: OrderService, Consumers: PaymentService, NotificationService, Schema: /schemas/order-placed.avsc)

Must contain at least one event type. Each entry must have producer and at least one consumer. Null consumers allowed only for future events with explicit note.

[SYSTEM_BOUNDARIES]

Map of service ownership, deployment units, and data stores per service

OrderService owns orders_db, PaymentService owns payments_db, both deployed as separate k8s deployments

Must list at least two services. Each service must declare its data stores. Shared database access must be explicitly flagged.

[REVIEW_SCOPE]

Specific anti-pattern categories to scan for, or 'ALL' for comprehensive scan

ALL or [EventCarriedStateTransfer, DualWrite, TemporalCoupling, MissingSchemaRegistry]

Must be a valid array of anti-pattern categories or the string ALL. Unknown categories must be rejected before model call.

[KNOWN_CONSTRAINTS]

Documented constraints that might look like anti-patterns but are intentional design choices

PaymentService dual-writes to its own DB and publishes event because we cannot use outbox pattern due to legacy DB constraints

Can be empty string. If provided, each constraint must include rationale. Used to calibrate false positive detection.

[SCHEMA_REGISTRY_INFO]

Details about schema registry usage, if any: technology, enforcement level, compatibility rules

Confluent Schema Registry with FULL compatibility, all topics enforce schema validation on produce and consume

Can be null if no registry exists. If provided, must specify enforcement level (none, produce-only, full). Used to assess schema governance gaps.

[OUTPUT_FORMAT]

Desired output structure for anti-pattern findings

JSON array with fields: anti_pattern, severity, location, evidence, recommendation, false_positive_risk

Must specify a valid output schema. Default to structured JSON with severity levels if not provided. Reject unstructured prose requests.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the anti-pattern detection prompt into an architecture review pipeline with validation, retries, and human approval gates.

The Event-Driven Anti-Pattern Detection Prompt is designed to operate as a gated analysis step within a broader architecture review workflow, not as a standalone chatbot query. In production, you should wrap this prompt in a harness that controls input assembly, output validation, retry logic, and human review routing. The prompt expects a structured architecture description as input—typically a markdown document, an ADR draft, or a system design brief that describes event flows, schema decisions, and messaging topology. Before calling the model, your harness should validate that the input contains sufficient detail: at minimum, a description of event types, producer-consumer relationships, and serialization or schema choices. If the input is too sparse, the harness should reject the request early and ask for more context rather than producing a low-confidence anti-pattern scan full of false positives.

After the model returns its structured output, the harness must validate the response schema before the results reach a reviewer. The prompt template includes an [OUTPUT_SCHEMA] placeholder that should be populated with a JSON Schema definition requiring fields such as anti_patterns (an array of findings), severity, evidence, and recommendation. Your harness should parse the model output and check that every required field is present, that severity values fall within an allowed enum (e.g., CRITICAL, HIGH, MEDIUM, LOW), and that each finding includes a specific evidence reference tied to the input. If validation fails, the harness should retry with the same input and a repair instruction appended, up to a configurable maximum (we recommend 2 retries). After two failed validation attempts, escalate to a human review queue with the raw output and validation errors attached. This prevents silent acceptance of malformed analysis while avoiding infinite retry loops that waste tokens.

For model selection, use a model with strong reasoning capabilities and reliable structured output support—GPT-4o, Claude 3.5 Sonnet, or equivalent. The prompt's anti-pattern detection task requires nuanced pattern matching across architectural descriptions, and weaker models tend to produce either overly generic findings or miss subtle coupling signals. Set the temperature low (0.0–0.2) to maximize consistency across runs, especially if you plan to compare anti-pattern scans over time as the architecture evolves. If your architecture documents are long, consider splitting the input into sections (event catalog, topology diagram description, schema definitions) and running the prompt once with the full assembled context rather than chunking, because many anti-patterns—such as distributed monolith signals—only become visible when you see the full producer-consumer graph together.

Logging and observability are critical because this prompt influences architectural decisions that have long-term cost and reliability implications. Your harness should log the prompt version, model identifier, input hash, output validation status, retry count, and final disposition (accepted, repaired, or escalated). Store these logs alongside the architecture document version so that future reviewers can trace which anti-pattern scan corresponded to which design iteration. If your organization maintains a design review checklist or approval workflow, integrate the validated anti-pattern output as a required artifact before architecture sign-off. This creates an audit trail showing that event-driven risks were explicitly considered, not assumed away.

Finally, calibrate for false positives before trusting the output in production. Run the prompt against a set of known-clean architecture descriptions (designs you've already reviewed and confirmed do not exhibit the target anti-patterns) and measure the false positive rate. If the prompt flags issues in clean designs, adjust the [CONSTRAINTS] section to add calibration guidance—for example, instructing the model to require at least two distinct evidence signals before reporting a finding, or to distinguish between 'pattern present' and 'pattern risk exists but mitigated.' This calibration step is essential because an over-eager anti-pattern detector erodes trust and creates review fatigue. Once calibrated, the harness can route CRITICAL findings for mandatory human review while allowing LOW-severity findings to be acknowledged as informational, keeping the review process focused on genuine architectural risks.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structured JSON output the model must produce when scanning an event-driven design for anti-patterns. Each field includes a concrete validation rule for automated harness checks.

Field or ElementType or FormatRequiredValidation Rule

anti_patterns

array of objects

Must be a non-empty array if findings exist; empty array allowed only when no anti-patterns are detected

anti_patterns[].name

string

Must match one of the known anti-pattern labels: Event-Carried State Transfer, Distributed Monolith Signal, Tight Temporal Coupling, Missing Schema Registry, Eventual Inconsistency Assumption, Fire-and-Forget Without DLQ, Sync-over-Async Wrapper

anti_patterns[].severity

string

Must be exactly one of: critical, high, medium, low. Critical findings require a human review flag in the harness

anti_patterns[].location

string

Must reference a specific component, service, topic, or event name from the [DESIGN_ARTIFACT] input; null not allowed

anti_patterns[].evidence

string

Must contain a direct quote or concrete reference from the [DESIGN_ARTIFACT]; generic statements without source grounding fail validation

anti_patterns[].recommendation

string

Must be an actionable, specific fix; recommendations like 'improve design' or 'add monitoring' without concrete steps fail the specificity check

confidence_score

number

Must be a float between 0.0 and 1.0; scores below 0.7 trigger a low-confidence retry or human review path in the harness

false_positive_risks

array of strings

Must list at least one scenario where a finding could be a false positive; empty array triggers a calibration warning in eval

PRACTICAL GUARDRAILS

Common Failure Modes

Anti-pattern detection prompts are prone to over-flagging normal patterns, missing context-dependent issues, and generating vague findings. These cards cover the most common failure modes and how to build guardrails into your detection harness.

01

False Positives on Intentional Coupling

What to watch: The prompt flags every shared schema or synchronous call as a 'distributed monolith' without distinguishing intentional, bounded coupling from accidental tight coupling. Guardrail: Include a [SYSTEM_BOUNDARY_CONTEXT] input that defines which services are intentionally co-deployed or share a release cycle, and instruct the model to suppress anti-pattern flags for those boundaries.

02

Vague Anti-Pattern Descriptions

What to watch: The model returns findings like 'Event-Carried State Transfer detected' without citing the specific fields, event types, or consumer that creates the risk. Guardrail: Require a structured output schema with fields for evidence_location, affected_event_type, and consumer_impact. Add a validator that rejects findings with empty evidence fields and requests regeneration.

03

Ignoring Domain and Scale Context

What to watch: The prompt applies the same severity to all anti-patterns regardless of system scale, throughput, or data sensitivity. A minor schema smell in a low-throughput internal service gets the same urgency as a data-loss risk in a payment pipeline. Guardrail: Include a [CONTEXT_PROFILE] input with throughput, latency requirements, and data classification. Instruct the model to calibrate severity based on this profile and flag when context is insufficient.

04

Missing Temporal Coupling Nuance

What to watch: The prompt treats all time-bound dependencies as 'Tight Temporal Coupling' without distinguishing between hard real-time requirements, acceptable latency windows, and brittle timeout chains. Guardrail: Require the model to classify temporal coupling into hard, soft, or brittle categories with explicit timeout and retry analysis. Add an eval check that fails the output if all temporal findings are the same severity.

05

Schema Registry Blindness

What to watch: The prompt flags 'Missing Schema Registry' even when the team uses a registry that isn't explicitly named in the input, or when the schema is managed through a different governance mechanism like CI/CD-enforced contract tests. Guardrail: Add a [SCHEMA_GOVERNANCE] input field that captures the team's actual schema management approach. Instruct the model to only flag missing registry if no equivalent governance mechanism is described.

06

Over-Prioritization of Style Over Substance

What to watch: The prompt produces a long list of low-impact naming and style findings that bury critical data-loss or ordering risks. Reviewers experience alert fatigue and miss the findings that matter. Guardrail: Require a criticality field in each finding with values BLOCKER, WARNING, or INFO. Add a harness check that fails the output if more than 30% of findings are BLOCKER without explicit justification, forcing the model to prioritize.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the anti-pattern detection prompt before integrating it into your architecture review pipeline. Each criterion targets a specific failure mode common in event-driven design analysis.

CriterionPass StandardFailure SignalTest Method

Event-Carried State Transfer Detection

Output correctly identifies when an event payload contains full entity state instead of a domain event reference, with at least one concrete example from the input.

Prompt misses obvious state transfer in a payload with 10+ fields or flags a minimal event ID as state transfer.

Run against a golden set of 5 event schemas: 2 with clear state transfer, 2 clean domain events, 1 borderline. Require 100% recall on the 2 positives.

Distributed Monolith Signal Identification

Output flags tight coupling patterns such as synchronous request-response over events, shared databases between services, or event chains that require sequential processing across 3+ services.

Prompt fails to detect a chain of 4 services that must process events in strict order or mislabels a legitimate pub-sub fan-out as a distributed monolith.

Inject a known distributed monolith topology description. Verify the output names at least 2 specific coupling signals and suggests decoupling strategies.

Temporal Coupling Classification

Output distinguishes between hard temporal coupling (timeout-dependent processing) and soft temporal coupling (eventual consistency with SLA) with correct severity assignment.

Prompt classifies a 30-second processing SLA as hard temporal coupling or ignores a 500ms timeout dependency between two services.

Provide 3 scenarios with varying time sensitivity. Check that severity labels match a pre-defined rubric: hard coupling for sub-second dependencies, soft for minute-level SLAs.

Schema Registry Gap Detection

Output identifies missing schema registry references, unversioned event types, or absent compatibility enforcement when event producers and consumers are described.

Prompt overlooks an input that describes 3 services publishing events with no schema registry, no version fields, and no compatibility strategy.

Feed a system description that omits all schema governance. Require the output to flag at least one schema registry gap and recommend a versioning approach.

False Positive Rate Calibration

Output does not flag well-designed patterns as anti-patterns. Specifically, it should not misclassify legitimate event sourcing, proper CQRS read models, or correct pub-sub decoupling.

Prompt flags an event-sourced aggregate with 20 event types as event type explosion or labels a proper dead letter queue as an anti-pattern.

Run against 3 known-clean architectures. Require zero high-severity anti-pattern flags. Allow low-severity notes only if they include explicit caveats about context.

Actionable Remediation Guidance

Each flagged anti-pattern includes at least one concrete, implementable remediation step tied to the specific input context, not generic advice.

Output provides only textbook definitions of anti-patterns without mapping remediation to the specific services, event names, or coupling points in the input.

Spot-check 3 flagged anti-patterns. Each must reference at least one named service, event type, or coupling point from the input in its remediation text.

Severity Ranking Consistency

Output assigns severity levels (Critical, High, Medium, Low) that match a pre-defined rubric: Critical for data loss or correctness risks, High for scaling blockers, Medium for maintainability issues, Low for style concerns.

Prompt assigns Critical severity to a missing schema registry while labeling a data-loss-prone outbox gap as Medium.

Run the same input 3 times with temperature 0. Check that severity assignments for the top 3 findings are identical across runs.

Output Schema Compliance

Output strictly follows the defined [OUTPUT_SCHEMA] with all required fields present, correct types, and no extra fields.

Output is missing the anti_pattern_id field, uses a string where an array is expected for affected_services, or adds an undocumented confidence_score field.

Validate output against the JSON Schema definition. Require zero schema violations. Automate this check in CI before the prompt enters the review pipeline.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single architecture diagram or description as [INPUT]. Remove the structured output schema requirement and ask for a bulleted list of anti-patterns instead. Drop the severity scoring and evidence citation fields to reduce token cost during early exploration.

code
Analyze this event-driven architecture for anti-patterns:
[ARCHITECTURE_DESCRIPTION]

List each anti-pattern found with a one-line explanation.

Watch for

  • Overly broad classifications that flag normal patterns as anti-patterns
  • Missing false positive calibration without severity scoring
  • No structured output means harder to diff across iterations
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.