coin-families-contract

Enforces coin-specific logic isolation in families folders for Ledger Wallet UI code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generic screens, hooks, and ViewModels in Ledger Wallet Desktop and Mobile often accumulate coin-specific branches like if (currency.family === "evm"), which breaks modularity and blocks lazy loading. This Skill guides developers to keep all coin-specific UI and behavior inside families/<family>/ folders and expose it only through a typed contract.

Core Features & Use Cases

  • Anti-pattern detection: Identifies forbidden family-name branching in generic code under renderer/, mvvm/, and screens/ directories.
  • Contract extension pattern: Shows how to add optional slots to LLDCoinFamily in types.ts (Desktop) or generated family maps (Mobile), implement them per family, and consume them via lookups like getLLDCoinFamily(currency.family).SlotName.
  • Use Case: When adding a custom "no associated accounts" screen for Hedera, implement NoAssociatedAccounts.tsx in families/hedera/, register it in the family contract, and let generic scan-device code read the slot without any Hedera-specific branch.

Quick Start

Review my changes in the scan accounts flow and refactor any coin-specific branching to use the families contract pattern.

Frequently Asked Questions about coin-families-contract

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

FAQPage Schema
How do I add coin-specific UI to a generic screen in Ledger Live?

Add an optional slot to the families contract (e.g. a property on LLDCoinFamily in types.ts), implement the component inside families/<family>/, and have the generic screen read it via getLLDCoinFamily(currency.family).SlotName without branching on the family name.

Why is if (currency.family === "evm") not allowed in shared Ledger Live code?

Family-name branching in generic code couples shared screens to specific coins, breaking modularity and lazy loading. The families contract keeps generic code family-agnostic by exposing optional slots that each family implements independently.

Is type narrowing on transaction.family ever acceptable in Ledger Live?

Yes, type narrowing like invariant(transaction.family === "bitcoin") is acceptable inside a family folder such as families/bitcoin/. The prohibition applies only to generic shared code outside families/ directories.

How does the families contract differ between Ledger Live Desktop and Mobile?

Desktop defines optional slots on LLDCoinFamily in renderer/families/types.ts with aggregation in generated.ts. Mobile uses generated maps or helpers like getCustomNoAssociatedAccounts so generic ViewModels never branch on family names.

What should I do when a new coin needs custom behavior in a shared flow?

Extend the contract by adding a new optional slot and documenting it, implement the behavior in the relevant family folder, and have generic code only read from the contract. Do not add new if (family === "...") branches in shared UI.