State and event management: state scope, a caching layer for server data, view state in the URL, the global store, an event catalog, adapters, webhook signatures and idempotency, the transactional outbox, and event deduplication. Load when working with state, events, webhooks, or analytics.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of State And Events?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/the-up-state-and-events)
---
name: state-and-events
description: "State and event management: state scope, a caching layer for server data, view state in the URL, the global store, an event catalog, adapters, webhook signatures and idempotency, the transactional outbox, and event deduplication. Load when working with state, events, webhooks, or analytics."
---
# State and Events
- Keep state in the narrowest scope: state that concerns a single component stays local; move only state that several distant components share to the global store.
- Separate server data from client state: keep it in the project's data fetching and caching layer, and don't copy it into the global store.
- Keep shareable view state (filters, pagination, tabs) in the URL; don't store derivable values as state.
- Don't scatter global state; manage it in a defined store layer, typed and with defined actions.
- If there are events, separate them by source and use a single central layer for each type: internal domain events, third-party integration events (incoming webhooks, outgoing calls), client-side events (in-app events, analytics), and server-side events.
- Define event names and payload schemas, typed and versioned, in a single catalog. Don't tie business logic directly to third-party SDKs; use adapters.
- For incoming webhooks, verify the signature, respond quickly, and queue the heavy work. Make webhooks, event handlers, and queue jobs idempotent by event ID.
- Use a transactional outbox so that events that must be published together with a database change aren't lost.
- If the same event is sent from both the client and the server (for example a pixel and a conversions API), deduplicate it with a shared event ID.