agentleFS
LedgerHQLedgerHQ/ledger-live/.agents/skills/new-package/SKILL.md

new-package

Skill627 starsChanged 9 days agoMITView on GitHub

Scaffold a new package under `shared/`, `domain/` or `features/` with the nx generator, then finish its README, CODEOWNERS line and knip-ready exports. Use when adding a new internal package in the monorepo layers, or when a package still lacks a README status marker or a CODEOWNERS entry.

  • Installs packages

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Add a rule for the package directory in the root CODEOWNERS.

    line 44
  2. Very specific:

    Before the PR merges, run knip on the package alone from that package's directory (or through its scripts.unimported entry when you add …

    line 66
  3. Distinctive:

    Before committing, run validate-changes.

    line 83

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “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

New package: generate, then register

Pick the layer with structure-flow before running the generator. The generator writes the tool scripts and presets the layer expects; this skill covers what still belongs in the first PR.

1. Generate the package

From the repository root:

pnpm nx g @ledgerhq/generators:package <name> \
  --layer <shared|domain-entity|domain-api|feature-platform|feature-flow> \
  --platform <logic|web|native|dual> \
  [--description "One line on what the package owns"]
pnpm i

You choose name (kebab-case folder; the layer prefixes the npm name), layer, and platform (a forbidden pair is rejected with the allowed list). Optional description is one line for package.json and the README title. Every option is defined in tools/nx-plugins/generators/package/schema.json.

The generator creates a placeholder module and test, a pure export * barrel, an internals.ts stub per package-public-api, explicit exports (no ./* wildcard), README with an UNSTABLE status callout, tsconfig on the right @support/tsconfig archetype, a one-line jest config on the matching @support/jest factory, and project.json when the layer uses one. Tooling details live in support-config; change them only when the generated preset is wrong for the package.

2. README and status marker

Replace the generator's one-line description with a short scope: problem solved, main exports, who consumes it. Keep the status callout directly under the # Title heading. Templates and when to move between STABLE, UNSTABLE and DEPRECATED are in docs/new-library.md.

3. CODEOWNERS

Add a rule for the package directory in the root CODEOWNERS. Match a neighbour of the same layer and team, or resolve owners with codeownership:

node .agents/skills/codeownership/resolve-codeowners.js <path/to/new/file.ts>
node .agents/skills/codeownership/resolve-codeowners.js --check

Example:

domain/entity/contact/    @ledgerhq/wallet-xp

4. Knip

New layer packages start knip-clean: explicit exports only, no entry in support/knip/knip.json. Dual-platform packages add knip.web.config.mjs and knip.native.config.mjs per knip-migration.

Before the PR merges, run knip on the package alone from that package's directory (or through its scripts.unimported entry when you add one). Command shape, --directory hops and dual-platform passes are in knip-migration; an unimported script holding the command is optional and CI does not run it.

After the scaffold

Layer / shapeRead next
domain/entity or domain/apidomain-data
features/flowflow-package and mvvm-architecture
Platform-split React UIuniversal-components

Review an existing package against the checklist in docs/new-library.md.

Validate

Before committing, run validate-changes.

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.