staff-engineering-skills-consistency-models
Installation
SKILL.md
Consistency Models Trap
You wrote data. You read it back. You got the old value. Before writing any code that reads after writing, ask: could the read hit a different instance than the write?
The Three Consistency Gaps
Almost every consistency bug has the same shape: data written to system A, read from system B, and B hasn't caught up.
| Gap | What happens | Typical delay |
|---|---|---|
| Replica lag | Write to primary, read hits replica | 10-500ms (async replication) |
| Cache staleness | Write to database, read hits cache | Seconds to minutes (TTL-based) |
| Index delay | Write to database, search reads index | 1-30s (Elasticsearch, Algolia) |
Detection: Write-Then-Read Patterns
Stop and check consistency if you see: