sync-construction-async-property-ui-render-gate-pattern
Installation
SKILL.md
Sync Construction, Async Property
The initialization of the client is synchronous. The async work is stored as a property you can await, while passing the reference around.
When to Apply This Pattern
Use this when you have:
- Async client initialization (IndexedDB, server connection, file system)
- Module exports that need to be importable without
await - UI components that want sync access to the client
- SvelteKit apps where you want to gate rendering on readiness
Signals you're fighting async construction:
await getX()patterns everywhere- Top-level await complaints from bundlers
- Getter functions wrapping singleton access
- Components that can't import a client directly