agentleFS
LedgerHQLedgerHQ/ledger-live/.agents/skills/client-ids/SKILL.md

client-ids

Skill627 starsChanged 8 days agoMITView on GitHub

Handle device, user and Datadog identifiers through the redacted `DeviceId`, `UserId` and `DatadogId` classes of `@domain/entity-client-identity`, reading a raw value only through an export method allowlisted in `export-rules.json`. Use when reading, storing or sending a device id, user id or Datadog id, adding an `export*For*()` method or a new id class, editing `domain/entity/client-identity/**`, or when the `check-export-rules` CI target fails.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 3 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Never: use raw string IDs for devices, users, or analytics.

    line 12
  2. Very specific:

    Always: use DeviceId, UserId, or DatadogId classes from @domain/entity-client-identity.

    line 13
  3. Very specific:

    Every export method must be allowlisted in domain/entity/client-identity/export-rules.json.

    line 15
  4. Distinctive:

    Never: create raw string IDs for devices, users, or analytics

    line 32
  5. Very specific:

    Every ID usage must be explicitly declared through a dedicated export method (e.g., exportUserIdForSomethingSomething())

    line 44
  6. Very specific:

    Add a new export method on the class (e.g., exportUserIdForSomethingSomething())

    line 53
  7. Very specific:

    Add your file to domain/entity/client-identity/export-rules.json:

    line 54
  8. Distinctive:

    Use the method only from the allowlisted file (at the system boundary)

    line 64
  9. Very specific:

    Create a new class in domain/entity/client-identity/src/ids/ (e.g., NewId.ts)

    line 68
  10. Very specific:

    Follow the pattern from DeviceId.ts: Symbol storage, redacted toString/toJSON, export methods

    line 69
  11. Very specific:

    Add export methods with allowlist rules in export-rules.json

    line 70

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Client Identity Domain (@domain/entity-client-identity)

Privacy & Security

Sensitive identifiers (DeviceId, UserId, DatadogId) must always use the domain entity package:

  • Never use raw string IDs for devices, users, or analytics.
  • Always use DeviceId, UserId, or DatadogId classes from @domain/entity-client-identity.
  • ID values are only accessible through explicit export methods (e.g., exportUserIdForSomething()).
  • Every export method must be allowlisted in domain/entity/client-identity/export-rules.json.
  • Export IDs only at system boundaries (API calls, persistence) — never in the middle of processing.
  • toString() and toJSON() return [DeviceId:REDACTED] by design.

Package layout

PackageLocationWhat it contains
@domain/entity-client-identitydomain/entity/client-identity/DeviceId, UserId, DatadogId classes + Redux slice, selectors, persistence
@domain/api-push-devicesdomain/api/push-devices/RTK Query mutation + Redux sync middleware

Core Principles

1. All ID Usage Must Go Through This Package

  • Never create raw string IDs for devices, users, or analytics
  • Always use DeviceId, UserId, or DatadogId classes from @domain/entity-client-identity
  • IDs are protected by Symbols and automatically redacted in logs/JSON

2. Privacy Protection

  • IDs are stored in Symbol fields to prevent accidental access
  • toString() and toJSON() return [DeviceId:REDACTED] by default
  • Actual ID values are only accessible through explicit export methods

3. Explicit Use Cases

  • Every ID usage must be explicitly declared through a dedicated export method (e.g., exportUserIdForSomethingSomething())
  • Export methods represent specific, documented use cases and can only be called from allowlisted files
  • The export-rules.json file in domain/entity/client-identity/ serves as a registry of all allowed use cases
  • The check-export-rules target (scripts/check-export-rules.mjs) enforces the allowlist in CI

Usage Requirements

Using an existing ID for a new use case

  • Add a new export method on the class (e.g., exportUserIdForSomethingSomething())
  • Add your file to domain/entity/client-identity/export-rules.json:
    {
      "domain/entity/client-identity/src/ids/UserId.ts": {
        "exportUserIdForSomethingSomething": [
          "your/new/file/path.ts"
        ]
      }
    }
  • Use the method only from the allowlisted file (at the system boundary)

Introducing a new kind of ID

  • Create a new class in domain/entity/client-identity/src/ids/ (e.g., NewId.ts)
  • Follow the pattern from DeviceId.ts: Symbol storage, redacted toString/toJSON, export methods
  • Add export methods with allowlist rules in export-rules.json
import { DeviceId } from "@domain/entity-client-identity";

// ✅ Correct: Use the domain entity
const deviceId = DeviceId.fromString("device-123");

// ❌ Wrong: Don't use raw strings
const deviceId = "device-123"; // BAD

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.