agentsclimarketplace

Message loader gated on database ready

Skill kjuhwa/skills-hub/skills/backend/message-loader-gated-on-database-ready

Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.

Install
npx -y skills add kjuhwa/skills-hub --skill message-loader-gated-on-database-ready

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Gate i18n/seed loading on database readiness + per-tenant distributed lock so the first instance wins initialization in a multi-replica rollout.

SKILL.md

2.0 KB, 364 tokens by cl100k_base, as published. Nobody here has run it

Message/Seed Loader with Readiness Gate + Per-Tenant Lock

Shape

Three layered gates before a loader runs:

  1. Service dependency gate — wait for upstream services (e.g., account) to register in discovery. In Lucida this is @WaitForServices("account").
  2. Database readiness gate — poll until expected tenant databases exist (MIN_DATABASE_COUNT). Retry loop: N attempts × delay (e.g., 100 × 10 s).
  3. Per-tenant distributed lock — acquire meta:init:<tenantId> via the Mongo lock pattern before seeding. Other replicas exit early when they find data already present.

Steps

  1. Define a startup runner (ApplicationRunner / event listener) that calls the loader per tenant.
  2. Before work: check a cheap "already seeded" marker (e.g., collection count > 0). Skip if present.
  3. Wrap the seed block in the distributed lock; double-check the marker inside the lock (read-after-lock).
  4. On timeout at any gate, log with the specific stage (stage=waitDb|stage=acquireLock|stage=seed) so operators know whether to extend the timeout or investigate.
  5. Emit a Kafka "loaded" event (e.g., MessageLoadedTopicAvro) so downstream services can flip from fallback to real data.

Counter / Caveats

  • Don't gate on upstream service health alone — the account service being UP does not mean its Kafka org-created events have been consumed locally.
  • Retry count × delay should exceed the slowest legitimate cold start (cold MongoDB + first-pod schema init).
  • Do not use this pattern for fast-changing config; it is for one-shot bootstrap only.

What ships with it: 1 file

690 B alongside SKILL.md

Keep looking

Skills are one crate of 327,069. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.