Backend & APIs
AuraScore 81/100

Shop-Floor MES and ERP Sync API Specification

Define transactional, idempotent event-driven APIs connecting core ERP with plant-floor MES.

Use this template when building mission-critical backend interfaces between Enterprise Resource Planning (ERP) and Manufacturing Execution Systems (MES). It outputs a transactional API specification covering work orders, material tracking, and quality release gates.

Template

Role: Staff Integration & Backend Engineer specializing in manufacturing transactional systems and mission-critical APIs.

Context

  • Manufacturing Execution System: {{mes_core_engine}}
  • Enterprise Resource Planning platform: {{erp_system_target}}
  • Work order transaction volume: {{daily_work_order_volume}} orders/day
  • Traceability standard: {{traceability_compliance_level}}
  • State store for deduplication: {{idempotency_storage_backend}}
  • Maximum sync retry budget: {{sync_failure_retry_limit}} attempts

Task

Author an enterprise-grade backend API specification for bidirectional synchronization between {{erp_system_target}} and {{mes_core_engine}}, guaranteeing exactly-once processing semantics for work orders, bills of materials, and production sign-offs.

Method

  1. Design the transactional outbox pattern to decouple event production in {{erp_system_target}} from consumption in {{mes_core_engine}}.
  2. Define the REST and gRPC service contracts for work order dispatch, material consumption, and yield reporting.
  3. Construct the idempotency key structure and distributed locking strategy using {{idempotency_storage_backend}}.
  4. Formulate the two-phase commit or saga orchestration workflow for handling split-line production order updates.
  5. Detail the audit logging schema required to satisfy {{traceability_compliance_level}}.
  6. Establish error categorization and dead-letter queue (DLQ) retry topologies capped at {{sync_failure_retry_limit}} retries.
  7. Specify compensation transactions for rollback scenarios when shop-floor execution fails quality validation.
  8. Outline API rate limiting, mutual authentication, and latency Service Level Objectives (SLOs).

Constraints

  • MUST implement strictly idempotent endpoints using persistent correlation IDs.
  • MUST NOT drop or reorder state transitions (Planned -> Released -> In-Progress -> Completed).
  • Audit log payloads MUST be immutable and cryptographically signed to meet {{traceability_compliance_level}}.
  • Response latency for line-side material scan endpoints MUST remain under 120ms at p99.

Output format

  1. System Interaction Sequence (step-by-step transaction sequence for order lifecycle)
  2. OpenAPI 3.1 & Protocol Buffer Endpoint Definitions (complete endpoint signatures and payload schemas)
  3. Idempotency & Concurrency Strategy (key layout, locking mechanics, deduplication window)
  4. Saga Orchestration & Rollback Matrix (state-by-state failure handling table)
  5. Compliance & Audit Enforcement Specification (payload hashing and audit fields)

Self-review

  • Are all state transitions between {{erp_system_target}} and {{mes_core_engine}} covered with rollback compensation logic?
  • Does the deduplication design prevent double-booking of materials under network retries up to {{sync_failure_retry_limit}}?
  • Are regulatory mandates from {{traceability_compliance_level}} completely satisfied in the schema definitions?
AuraScore breakdown
81/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-backend-apis
manufacturing-industrial
mes
erp
rest-api