ddd-data-layer-advanced

Structures Ledger Wallet data layers where one API response serves multiple domain entities.

615|491|Updated Jan 4, 2022
One-click install
npx skills add https://github.com/LedgerHQ/ledger-live --skill ddd-data-layer-advanced
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ddd-data-layer-advanced
Source: https://github.com/LedgerHQ/ledger-live/tree/main/.cursor/skills/ddd-data-layer-advanced
Command: npx skills add https://github.com/LedgerHQ/ledger-live --skill ddd-data-layer-advanced

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Designing a data layer where a single API response feeds several domain entities often leads to duplicated fetching logic, inconsistent validation, and tangled cross-package dependencies in the Ledger Wallet monorepo. This Skill provides canonical guidance for orchestrating that pattern correctly.

Core Features & Use Cases

  • Cross-Entity Orchestration: Guides structuring domain/api layers so one API response hydrates multiple entities using RTK Query, createAsyncThunk, or both.
  • Response Validation: Covers validating shared API responses before distributing data across domain packages.
  • Multi-Package Testing: Directs how to write tests that span multiple domain/entity packages.
  • Use Case: When adding a new Ledger Live feature whose backend endpoint returns account, transaction, and token data in one payload, use this Skill to design the Redux data layer without duplicating fetch logic across entity packages.

Quick Start

Ask the assistant to apply the ddd-data-layer-advanced skill when creating or reviewing a cross-entity data layer that uses RTK Query or createAsyncThunk in the Ledger Wallet repository.

Frequently Asked Questions about ddd-data-layer-advanced

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

FAQPage Schema
How do I share one API response across multiple Redux entities?

Use a single RTK Query endpoint or createAsyncThunk to fetch the response once, validate it, then distribute the normalized slices to each entity's reducer or cache. This Skill provides the canonical pattern for that orchestration in the Ledger Wallet codebase.

Should I use RTK Query or createAsyncThunk for cross-entity data fetching?

Both are supported, and the Skill covers orchestration with either or a combination of the two. The choice depends on whether you need RTK Query's caching and invalidation or the manual control of createAsyncThunk.

How do I validate an API response before splitting it across domain packages?

Validate the raw response at the api layer boundary before any entity consumes it, so downstream packages receive trusted, typed data. The Skill's canonical document defines the validation approach to follow.

How do I test a data layer spanning multiple domain packages?

Write tests that exercise the full flow from the shared API response through each affected entity package, rather than testing packages in isolation. The Skill includes guidance for these cross-package test scenarios.

When should I not use a shared-response data layer pattern?

Avoid it when entities have independent lifecycles or refetch needs, since coupling them to one response forces unnecessary refetches. In those cases, separate endpoints per entity are the better fit.