sequence-checking

Validate integer event sequences inline for idempotent microservice handlers.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill sequence-checking
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sequence-checking
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/microservice/query/sequence-checking
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill sequence-checking

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ensures event handlers correctly handle duplicates and out-of-order events so message listeners can reliably complete or abandon messages without causing infinite retries or data corruption.

Core Features & Use Cases

  • Inline guard pattern: A single in-handler check that returns true for already-processed events and false for gaps, avoiding external helper classes.
  • Creation vs update handling: Creation handlers use existence checks while update handlers apply the sequence guard and then update the entity sequence.
  • Use case: Add robust idempotency to microservice query handlers processing ordered aggregate events from a service bus.

Quick Start

Use the sequence-checking skill to add an inline guard comparing the entity sequence to the event sequence minus one, return true for duplicates and false for gaps, and ensure the entity behavior updates the sequence after processing.

Frequently Asked Questions about sequence-checking

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle duplicate events in a C# microservice without causing infinite retries?

Preventing out-of-order event processing requires an inline sequence validation guard that returns false for detected gaps, forcing the handler to abandon the message until the missing events arrive and are processed in sequence.

What is the best way to add idempotency to event sourcing handlers processing ordered aggregate events?

The best way to add idempotency to event sourcing handlers is using an inline guard pattern that checks existence for creation handlers and validates the integer sequence for update handlers to complete or abandon service bus messages reliably.

Why does my service bus listener keep retrying out-of-order messages and causing data corruption?

Service bus listeners retry out-of-order messages and risk data corruption when missing an inline sequence guard to abandon gaps and complete duplicates, which ensures the entity behavior updates the sequence only after successful processing.

Do I need an external helper class to validate event sequences in microservice query handlers?

You do not need an external helper class to validate event sequences, because the inline sequence guard pattern performs a single in-handler check that directly evaluates the integer sequence and manages duplicates and gaps.

Can I use inline sequence validation for both creation and update event handlers in C#?

You can use inline sequence validation for both handler types, where creation handlers use existence checks and update handlers apply the sequence guard, requiring the entity behavior to update the sequence after successful processing.