Package Public Apiのロゴ

Package Public Api

組織
LedgerHQ
package-public-api

新しいアーキテクチャのパッケージ(shared/、domain/、features/)では、`export *`だけを含むバレルを通じてAPIを公開し、非公開コードはinternalsディレクトリに配置します。shared/、domain/、features/の下にパッケージを作成するとき、`index.*`ファイルを編集するとき、または`lint:structure`チェックに失敗したときに参照してください。

概要

公開者LedgerHQ
リポジトリledger-live
スキル名package-public-api
スター
622
フォーク
491
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    LedgerHQがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Package Public Api」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/LedgerHQ/ledger-live/tree/develop/.agents/skills/package-public-api
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/LedgerHQ/ledger-live.git /tmp/ledger-live
mkdir -p .claude/skills
cp -r /tmp/ledger-live/.agents/skills/package-public-api .claude/skills/package-public-api
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでPackage Public Apiを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にPackage Public Apiを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Package Public Apiは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Barrels and internals

An index.* file is a barrel: a pure regrouping point, nothing else.

ts
// ✅
export * from "./schema";
export type * from "./types";
export { default } from "./useEnv"; // the one tolerated exception

// ❌  sorting in the export proves ./slice mixes public and private
export { accountNamesSlice, bulkSetAccountNames as setAccountNames } from "./slice";

// ❌  an index that contains code is not an index
export const CurrencySchema = z.discriminatedUnion("type", [...]);

Why the sorting matters. If you need to pick which names leave a file, that file holds both public and private code. The fix is never a longer export list — it is moving the private part to an internals location. export * then becomes honest: everything in that file is public.

Enforced by nx run <project>:lint:structure (the plugin), on every index.* under src/, at any depth.

Where private code goes

Three recognised forms, usable at any depth:

FormUse for
internals/a private area with several files
internals.tsone private helper in a folder
<name>.internals.tsthe private half of a file, e.g. slice.ts + slice.internals.ts

A barrel must never re-export any of them — that would make private code public and defeat the point. Everything else can: a test sitting next to slice.internals.ts imports it directly, so private code stays fully testable without being part of the package API.

Never re-export another package

ts
// ❌  this package becomes a proxy
export * from "@features/flow-contacts-add-contact";
export { useContacts } from "@features/platform-contacts";

Two import paths for the same symbol, and a reader who cannot tell who provides it. Consumers must import the original provider, and declare the dependency themselves. This holds for @shared/*, @domain/*, @features/*, @support/* and @ledgerhq/* alike.

Facade is not proxy. Wrapping a legacy lib behind a typed API — as shared/env does over @ledgerhq/live-env — is legitimate: it owns real code and holds a declared BOUNDARY_EXCEPTION. Keeping that wrapping in a named file rather than the barrel is the cheapest way to stay conformant; shared/env instead carries a temporary skip in exceptions.js. Entries there are team decisions with an exit condition, not a way around a failing check — never add one to make your own package pass.

Traps

  • export * does not propagate a rename. export { bulkSetAccountNames as setAccountNames } cannot become export *. Rename at the source and update the callers, so one thing has one name.
  • export * does not propagate a default either. Only the re-export form (export { default } from "./x") is tolerated in a barrel. A local export default myThing needs an import above it, which is code in an index — extract it.
  • A package can have several barrels. With a react-native condition in exports, both index.ts and index.native.ts are barrels and both must stay pure.
  • An index.* holding code is not an index. Move the code to a named file (useEnv.ts, schema.ts, CardLogin.web.tsx) and leave export * from "./thatFile" behind. Import paths for consumers do not change.
  • A folder holding only index.ts should not be a folder. definitions/team-qaa/index.ts becomes definitions/team-qaa.ts: same import specifier, one less file, no barrel to keep pure.

New package

Start conformant, it costs nothing:

text
src/
├── index.ts          # export * from "./schema";
├── schema.ts
├── schema.test.ts
└── internals.ts      # whatever schema.ts should not expose

See structure-flow for where the package itself belongs.

Reviewing

Refuse and point here when you see:

  • a named re-export (export { a, b } from "./x") in any index.*
  • an import, a declaration or a local export default in any index.*
  • export * as ns from — namespacing is still sorting
  • a barrel re-exporting internals, or re-exporting another workspace package

よくある質問

AIスキル「Package Public Api」では何ができますか?

新しいアーキテクチャのパッケージ(shared/、domain/、features/)では、`export *`だけを含むバレルを通じてAPIを公開し、非公開コードはinternalsディレクトリに配置します。shared/、domain/、features/の下にパッケージを作成するとき、`index.*`ファイルを編集するとき、または`lint:structure`チェックに失敗したときに参照してください。

TypingMindでPackage Public Apiを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Package Public Apiはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにPackage Public Apiをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/LedgerHQ/ledger-live/tree/develop/.agents/skills/package-public-apiを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Package Public Apiを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Package Public Apiで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもPackage Public Apiを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Package Public Api」は無料ですか?

はい。LedgerHQがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇