Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Place and organize Ledger Wallet code in the DDD monorepo. Use when creating, moving, or reviewing code under apps, features, domain, shared, or support; deciding which layer owns a concern; structuring packages and flow steps; or checking package names, dependency boundaries, platform variants, and legacy imports.
.claude/skills/ledgerhq-ddd-structure-flow/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 7% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 25% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -15% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 6% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 25% | 0% |
Use the lowest layer that can own the concern without depending on a higher layer.
Read the canonical architecture guide and the package creation checklist before creating a package.
Upstream source: Structure & Flow
| Concern | Location | Owns | Does not own | | ---------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------------------------- | | Platform entry point | apps/<app> | Screens, global routing, store composition, analytics, observability, app glue | Reusable feature internals | | User-visible capability | features/flow/<feature> | Business-aware UI, user journeys, local state, flow routing | App-specific screen composition | | Capability shared across flows | features/platform/<feature> | Hooks, selectors, NFR rules, React glue, and components shared by several flows or use cases | Single-flow internals and fully generic components | | Business object | domain/entity/<entity> | Runtime schema, inferred type, defaults, mocks, selectors, slice | Network calls and feature state | | Network/data access | domain/api/<name> | API contracts, calls, transformations, RTK Query, thunks | UI and app composition | | Business-agnostic primitive or component | shared/<name> | Generic schemas, utilities, Redux primitives, and components without domain or feature knowledge | Domain or app knowledge | | Development-only tooling | support/<name> | Shared test, TypeScript, lint, and format configuration | Runtime code |
Use these distinctions:
features/flow package; do not promote it to an entity.features/flow when it belongs to one flow or use case.features/platform when several flows or use cases need it, especially when it connects them to the domain.shared or the existing design-system package..web and .native variants beside each other inside the owning feature.Every unit is a private package with package.json, src/, explicit exports, and no cross-package relative imports.
textfeatures/flow/<feature>/src/ ├── components/ # shared by several steps ├── hooks/ ├── router/ # flow-local routing only ├── state/ # feature-scoped state ├── steps/<StepName>/ │ ├── components/ # used only by this step │ ├── viewModel.ts # state and orchestration │ ├── view.ts # rendering and callbacks │ ├── view.test.ts │ └── index.ts ├── utils/ └── index.ts # minimal public API domain/entity/<entity>/src/ ├── schema.ts ├── schema.mock.ts ├── selectors.ts ├── slice.ts └── index.ts domain/api/<name>/src/ ├── api.ts └── index.ts
Colocate tests with the files they cover. Add folders only when they group files that change together.
Every index.ts above is a barrel: only export * from "./x" lines, with private code kept in an internals location. See package-public-api for the rules and the lint:structure check that enforces them.
Dependencies flow downward:
textapps → features/flow → features/platform → domain → shared
More precisely:
| Source | May depend on | | ------------------- | -------------------------------------------------------------- | | shared | shared | | domain/entity | domain/entity, shared | | domain/api | domain/api, domain/entity, shared | | features/platform | features/platform, domain, shared | | features/flow | features/flow, features/platform, domain, shared | | apps | Any new-architecture layer | | support | Development tooling only; consume it through devDependencies |
libs/* packages from shared, domain, or features.| Location | Package name | | -------------------------- | --------------------------- | | shared/<name> | @shared/<name> | | domain/entity/<name> | @domain/entity-<name> | | domain/api/<name> | @domain/api-<name> | | features/platform/<name> | @features/platform-<name> | | features/flow/<name> | @features/flow-<name> | | support/<name> | @support/<name> |
index.* is a pure barrel and no package re-exports another — seepackage-public-api.
Other measured skills in the registry, with their headline benchmark lift.