/polkadot-skills:product-sdk-chain-connectionfrom polkadot-skills
Connects to Polkadot chains via @parity/product-sdk-chain-client, covering preset vs BYOD paths, typed chain queries, storage subscriptions, and descriptor selection.
Ships in polkadot-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
@parity/product-sdk-chain-client provides typed access to Polkadot parachains via polkadot-api (PAPI). It offers two paths: preset (zero-config for known environments) and BYOD (bring your own descriptors for custom setups).
import { getChainAPI } from "@parity/product-sdk-chain-client";
// Inside a container, omit the environment: the host reports which chains it
// serves and the matching descriptors are loaded for you.
const client = await getChainAPI();
// Pin it explicitly when you need a specific environment, or when the host
// predates chain discovery (where the zero-arg form throws).
const paseo = await getChainAPI("paseo");
// Query balance
const account = await client.assetHub.query.System.Account.getValue(
"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
);
console.log("Free balance:", account.data.free);
// Clean up
client.destroy();
import { createChainClient } from "@parity/product-sdk-chain-client";
import { paseo_asset_hub } from "@parity/product-sdk-descriptors/paseo-asset-hub";
const client = await createChainClient({
chains: { assetHub: paseo_asset_hub },
});
const account = await client.assetHub.query.System.Account.getValue(
"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
);
client.destroy();
getChainAPI (Preset) | createChainClient (BYOD) | |
|---|---|---|
| When | Known environments (paseo, devnet; polkadot and kusama reserved), or whatever the host reports when called with no argument | Custom chains or a subset of chains, as long as the host routes them |
| Descriptors | Built-in, lazy-loaded | You import and provide them |
| Chains | Always assetHub + bulletin + individuality | Any combination you choose |
| Bundle size | Slightly larger (~6.3 MB for all 3 chains) | Minimal (only what you import) |
Use getChainAPI when you want zero-config connection to a standard environment.
Use createChainClient when you need:
Descriptors decide what is typed, the host decides what is reachable. There is no
WebSocket fallback, so check with isChainSupported(genesisHash) from @parity/product-sdk-host.
// Get current block number
const blockNumber = await client.assetHub.query.System.Number.getValue();
// Get account info
const account = await client.assetHub.query.System.Account.getValue(address);
// Get specific asset balance
const balance = await client.assetHub.query.Assets.Account.getValue(
assetId,
address
);
// Subscribe to balance changes
const unsubscribe = client.assetHub.query.System.Account.watchValue(
address,
(account) => {
console.log("Balance changed:", account.data.free);
}
);
// Later: stop subscription
unsubscribe();
// Get all entries in a storage map
const entries = await client.assetHub.query.System.Account.getEntries();
for (const [key, value] of entries) {
console.log(key, value.data.free);
}
For advanced use cases (like creating ContractRuntime for contracts), access the raw PAPI client:
import { createContractRuntime } from "@parity/product-sdk-contracts";
const runtime = createContractRuntime(client.raw.assetHub, { atBest: true });
WARNING: Only the
"paseo"and"devnet"environments are currently available. Using"polkadot"or"kusama"will throw an error.
| Environment | Asset Hub | Bulletin | Individuality |
|---|---|---|---|
| paseo (Paseo Next v2) | Yes | Yes | Yes |
| devnet (public Paseo testnet) | Yes | Yes | Yes |
| polkadot (mainnet) | Planned | Planned | Planned |
| kusama (canary) | Planned | Planned | Planned |
Call getChainAPI() with no argument to derive the environment from the host instead of
hard-coding it. The host reports a genesis hash per chain role (AssetHub, Bulletin,
People) and the environment is the bundle whose asset hub genesis matches, so a host on
its own network id still resolves correctly. An explicit environment is cross-checked the
same way: it throws EnvironmentMismatchError when it is not the network the host runs,
and GenesisMismatchError when a bundled descriptor's genesis disagrees with the host
(a stale descriptor bundle, for example after a testnet reset).
"paseo"is not the public Paseo testnet. It targets the Paseo Next v2 chain instances (*-next-*.polkadot.io). For the community-run products devnet on the long-lived Paseo testnet system chains (Asset Hub 1000, People 1004, Bulletin 1010), use"devnet". Endpoint selection is host-owned: descriptors pin chain identity (genesis hash) and the host container picks the RPC — there is no standalone (non-host) transport path.
Always destroy clients when done to close WebSocket connections:
// Single client
client.destroy();
// All clients (useful in tests)
import { destroyAll } from "@parity/product-sdk-chain-client";
destroyAll();
Forgetting await — getChainAPI() and createChainClient() return Promises.
Using unavailable environments — Only "paseo" and "devnet" work. "polkadot" and "kusama" throw.
Not cleaning up — Call client.destroy() when done to close the host provider connections.
Barrel importing descriptors — Use subpath imports: @parity/product-sdk-descriptors/paseo-bulletin, NOT @parity/product-sdk-descriptors.
Missing polkadot-api — It's a peer dependency. Always install it alongside chain-client.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub polkadot-community-foundation/polkadot-skills --plugin polkadot-skills2 plugins in one repository ship this exact skill · first indexed Sep 21, 2026
11 skills in this plugin
/migrating-to-product-sdkUse when migrating a product codebase to @parity/product-sdk — detects legacy stacks (polkadot-apps, novasamatech, hand-rolled crypto/IPFS, polkadot-api 1.x) in the target repo, decides which migration areas apply, writes a per-repo migration spec, then hands off to writing-plans.
/product-sdk-app-builderEnd-to-end scaffolding and implementation of Polkadot applications using @parity/product-sdk packages. Use when: creating a new Polkadot project, building a dApp, scaffolding chain interactions, choosing which @parity/product-sdk packages to install, or when a user says "build me a Polkadot app". Handles both developer-guided and fully autonomous (non-developer) workflows.
/product-sdk-cloud-storageOther plugins' skills for the same job