One-click install
npx skills add https://github.com/EpicenterHQ/epicenter --skill query-layer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-layer
Source: https://github.com/EpicenterHQ/epicenter/tree/main/.agents/skills/query-layer
Command: npx skills add https://github.com/EpicenterHQ/epicenter --skill query-layer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured approach to connecting UI components with backend services by using a reactive query layer that simplifies data fetching, caching, and state management.

Core Features & Use Cases

  • Call services with injected settings/config to decouple business logic from environment
  • Transform service errors into user-facing error types for stable UI behavior
  • Manage TanStack Query cache for optimistic updates and consistent data
  • Support dual interfaces: reactive (.options) for components and imperative (.execute()) for workflows
  • Runtime dependency injection to select service implementations based on settings

Quick Start

Define your queries and mutations with defineQuery/defineMutation using runtime service selection to enable reactive UI and imperative workflows.

Frequently Asked Questions about query-layer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decouple UI components from backend services in a reactive architecture?

A reactive query layer bridges UI and services by injecting runtime configuration into pure services, decoupling business logic from the environment. This isolates data fetching and state management from UI components.

How does error transformation work at the query boundary for UI components?

Error transformation at the query boundary converts raw service errors into normalized, user-facing error types. This ensures stable UI behavior by presenting consistent error states to the interface layer.

What is the best way to manage TanStack Query cache for optimistic updates?

Managing TanStack Query cache through a dedicated query layer allows structured handling of optimistic updates and consistent data. It enforces cache management rules directly at the data fetching boundary.

Can I use both reactive and imperative interfaces for data fetching workflows?

Yes, this query layer supports dual interfaces: a reactive .options() method for UI components and an imperative .execute() method for programmatic workflows. This allows flexible data fetching across different contexts.

How do I select service implementations dynamically based on configuration settings?

Runtime dependency injection selects service implementations dynamically based on injected settings. This allows the query layer to switch service providers seamlessly without altering the core business logic.

How to define queries and mutations with runtime service selection?

You define queries and mutations using defineQuery and defineMutation functions. These leverage runtime dependency injection to select services, enabling both reactive UI and imperative workflows.