data-consistency
Use when designing or building anything that crosses a service's database boundary — a reference to another service's entity, a domain event, a consumer, a…
от FuzeOne★ 18 звёзд на GitHub
Установить data-consistency в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
data-consistency
The procedure behind governance/data-consistency-standard.md. The standard says what; this says how to decide and what to produce. Every artifact below is checked by a gate (standard §11) once that gate lands; until then it is checked in review.
1. Start from the data contract
Open (or create) the service's data-contract.json beside its openapi.yaml and validate it against governance/data-contract.schema.json. Every decision below ends up as a line in it. If the change does not alter any field of the data contract, this skill probably does not apply.
2. Decision tree
"I need to store an id from another service"
- It is a reference. Store it as a native
uuid, validate it withassertRef(L0) at the boundary, and add areferences[]entry. - Validation level:
- Default L1 (
assertRefExistsagainst the localref_index),mode: "warn". - Flip that reference to
mode: "enforce"once the projection's lag is reliably inside its budget. - Use L2 (verify-on-write RPC) only when acting on a stale reference moves money or grants access — and write the
reason.
- Default L1 (
- On-delete policy — ask "when the target is deleted, what should happen to my row?":
- the row has no meaning without the target →
cascade - the row stands alone and the link is optional →
nullify - the row is a historical/financial record →
retain(and make the UI render "deleted ") - the target must not be deleted while this exists →
restrict(rare; write thereason, and expose the in-use endpoint)
- the row has no meaning without the target →
- Make sure you consume the target's
*.deletedtopic and implement the policy in both soft and hard form.
"Other services need to know this changed"
- Emit a domain event through the outbox, in the same transaction as the write. Never call the producer directly.
- Use envelope v2. Bump
aggregateVersionon every change.created/updatedcarry the full public snapshot. - Add the topic to
emits[]and freeze its schema in the contract PR (contract-designer).
"I need to react to another service's event"
- Build the consumer on the shared runtime: inbox dedupe, version guard, DLQ. Do not hand-roll idempotency.
- Add the topic to
consumes[]. - Write the replay test: the same events delivered twice, out of order, and replayed from scratch all produce identical state.
"This operation changes data in more than one service"
- First ask whether the boundary is wrong — if these services always change together, merge them.
- Otherwise it is a saga: local transaction per service, an event per step, a compensating action for every step that can fail after an earlier one committed.
- two or three linear steps → choreography;
- branching or more than three steps → an orchestrator owning the state machine.
- No 2PC; no "write to both and hope".
"A screen needs data from several services"
| The screen is… | Do this |
|---|---|
| A single entity's detail view | Compose in the BFF: parallel fan-out, timeouts, batch by id, token pass-through, missing[] on partial failure. |
| A list over one service's data | Call that service's list endpoint directly (pagination standard + §8 sort/filter). |
| A list that filters, sorts or paginates on fields from more than one service | Projection owned by this UI's BFF. Add a projections[] entry. |
| Search/facets across services | Projection into OpenSearch, in addition to the Postgres one. |
Which BFF owns it: the BFF of the UI that shows the screen — never a generic one, and never a new service per view. A shared view-service only when two BFFs need the identical projection.
3. Building a projection
- Name it after the view, not the source (
org_member_rows, notusers_copy). - Columns: the ones shown, sorted or filtered on, plus
<source>_versionper source aggregate andupdated_at. Nothing else — the detail view fetches the full entity from its owner. - Index every declared sort key as
(sort_key, id)for keyset pagination. - Handlers are versioned upserts. A
deletedevent removes or flags the row according to the view's semantics. - Expose the checkpoint + lag metric, and a
rebuildcommand that truncates and replays. - The list endpoint follows standard §8 — declared sortable/filterable fields, signed cursors,
meta.watermark— and honorsX-Fuze-Min-Version.
4. UI side (frontend-engineer)
- Lists bind their sort/filter/cursor state to the URL and call one BFF list endpoint. Never
Promise.allover two services' clients to build a table. - Commands go to the owner. Use the returned
{entity, version}to patch the cache optimistically, and sendX-Fuze-Min-Versionon the following list read. - Render dangling references and
missing[]entries as explicit states. Treatmeta.staleas "keep the optimistic overlay".
5. Verification (test-engineer)
- References: a write with a reference to a nonexistent
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл data-consistency?
Use when designing or building anything that crosses a service's database boundary — a reference to another service's entity, a domain event, a consumer, a multi-service operation, a delete that others depend on, or a UI screen/list that combines data from more than one service. Covers single-writer ownership, the transactional outbox, idempotent/order-guarded consumers, sagas, declaring references with a validation level and on-delete policy, choosing between BFF composition and a projection (CQRS read model), the list sort/filter/cursor contract, and read-your-writes. Standard: governance/data-consistency-standard.md (baseline §4.4); declared per service in data-contract.json.
Как установить скилл data-consistency?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл data-consistency запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…