Types, State, And Mocks
SkillDev toolsLets your agent structure a data layer where each API response maps to one entity slice with types, state, and mocks.
Available today. Use it from your connected AI after setup.
No other account needed.
Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
Then ask your AI: use the Types, State, And Mocks skill
About this skill
Structure a simple Ledger Wallet data layer where one API response maps to one entity slice. Use when creating or reviewing domain/entity schemas, inferred types, initial state, mocks, selectors, slices, domain/api clients, and their tests.
What this skill tells your AI
The instructions your AI receives, as published by ledgerhq/ledger-live in .agents/skills/types-state-mocks/SKILL.md and read by ahel’s review.
Apply this pattern when one API resource maps to one entity slice. Use data-layer-advanced when one response hydrates several entities.
Source: Types, Initial State & Mocks
Place Files
domain/entity/<entity>/src/
├── schema.ts
├── schema.mock.ts
├── schema.test.ts
├── selectors.ts
├── selectors.test.ts
├── slice.ts
└── slice.test.ts
domain/api/<entity>/src/
├── api.ts
└── api.test.ts
Export only the contracts consumers need from each package index.ts.
Keep Ownership Clear
| File | Responsibility |
|---|---|
schema.ts | Define the runtime schema, infer the TypeScript type, and declare a complete initial state |
schema.mock.ts | Build valid entity data with sensible defaults and optional overrides |
slice.ts | Own focused entity reducers and actions |
selectors.ts | Read or derive entity state without importing an app store type |
api.ts | Own transport contracts, network calls, and transformations |
Follow the package's runtime-schema precedent (Zod or Typia). Do not maintain a separate handwritten type that can drift from the schema.
Validate The Contract
- Give every entity property an explicit initial value.
- Make every mock pass the runtime schema.
- Keep mock-only helpers out of production behavior.
- Give reducers one clear state transition each.
- Parse untrusted API data before storing it when the API layer does not already guarantee the contract.
- Register reducers and API middleware in each app composition root; never import an app store from a domain package.
Test
- Schema: accept a mock, reject an invalid payload, and cover initial defaults.
- Mock: return valid data and honor supported overrides.
- Slice: cover initial state, replacement/reset, and focused updates.
- Selectors: cover direct and derived values with a minimal local state shape.
- API: cover success, relevant failures, and transformations with a local test store or existing domain test harness.
Signals
- GitHub stars
- 620
- Forks
- 490
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Key
types-state-mocks- Source
- github.com/ledgerhq/ledger-live