data-layer-advanced
Skill627 starsChanged 7 days agoMITView on GitHub
Structure a Ledger Wallet data layer where one API response serves several entities. Use when creating or reviewing cross-entity domain/api orchestration with RTK Query, createAsyncThunk, or both, including response validation and tests spanning multiple domain/entity packages.
In this repository70 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- analyticsSkill
- batch-feature-devSkill
- ci-runnersSkill
- ci-workflow-refsSkill
- cleanupSkill
- client-idsSkill
- cloud-sync-moduleSkill
- codeownershipSkill
- coin-families-contractSkill
- coin-modulesSkill
- commentsSkill
- configurationSkill
- console-logSkill
- create-changesetSkill
- create-prSkill
- debug-rn-native-crashSkill
- dependency-patchesSkill
- detect-data-leaksSkill
- device-intent-executorSkill
- devtools-import-boundarySkill
- dialogs-sliceSkill
- docs-migrateSkill
- docs-update-or-createSkill
- domain-dataSkill
- e2e-desktop-add-or-updateSkill
- e2e-desktop-onboardSkill
- e2e-earnSkill
- e2e-mobile-add-or-updateSkill
- e2e-mobile-onboardSkill
- e2e-swapSkill
- errorsSkill
- feature-devSkill
- fix-ciSkill
- flow-packageSkill
- get-pr-commentsSkill
- git-conventionsSkill
- i18n-keysSkill
- impacting-prsSkill
- knip-migrationSkill
- ldls-nativeSkill
- ldls-webSkill
- ledger-wallet-cliSkill
- legacy-migrationSkill
- mvvm-architectureSkill
- new-packageSkill
- package-public-apiSkill
- pnpm-resolutionSkill
- prefer-set-hasSkill
- pre-reviewSkill
- react-generalSkill
- rebuild-to-fix-lib-import-errorsSkill
- remove-feature-flagSkill
- run-buildsSkill
- run-e2e-ciSkill
- runner-imagesSkill
- run-testsSkill
- slack-pr-messageSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 22
Keep UI and feature state in features/flow.
- Distinctive: line 23
Keep app composition out of the domain package.
- Distinctive: line 29
Keep the result in RTK Query or dispatch the validated entities when slices must be hydrated.
- Distinctive: line 35
Use entity mock builders when available.
- Distinctive: line 36
Test RTK Query endpoints, thunks, or their integration according to the chosen orchestration.
- Distinctive: line 37
When reducers are involved, create a minimal local store or use an existing domain test harness.
- Distinctive: line 38
Never import an app store or app alias into a domain test.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Data Layer: Multiple Entities
Apply only when one API response maps to several autonomous entities. Use domain-data for the rules inside each entity and api package.
Source: Data Layer Advanced Use Case
Split Ownership
domain/entity/<first>/src/schema.ts
domain/entity/<second>/src/schema.ts
domain/api/<orchestrator>/src/api.ts- Let each entity own its schema and inferred type. Add state, selectors, mocks, and tests only when that entity needs them.
- Let one
domain/apipackage own the cross-entity response contract, request, transformation, and validation. - Keep UI and feature state in
features/flow. - Keep app composition out of the domain package.
Process The Response
- Fetch with RTK Query,
createAsyncThunk, or both. - In the API layer, validate and transform each response collection with its owning entity schema.
- Keep the result in RTK Query or dispatch the validated entities when slices must be hydrated.
Validate the collection before iterating over it: prefer entitySchema.array().parse(value) to .map() on untrusted data.
Test The Orchestration
- Use entity mock builders when available; otherwise build schema-valid fixtures.
- Test RTK Query endpoints, thunks, or their integration according to the chosen orchestration.
- When reducers are involved, create a minimal local store or use an existing domain test harness.
- Never import an app store or app alias into a domain test.
- Assert the validated result, cache entry, and any hydrated slice that the orchestration owns.
- Cover transport failure, invalid collection shape, and invalid entity data when relevant.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

