/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
Generated from the plugin's indexed repository (polkadot-community-foundation/polkadot-skills) — no native marketplace selected
npx claudepluginhub p/polkadot-community-foundation-polkadot-skills11 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-storageUse when uploading or retrieving data via Cloud Storage, working with CID-based decentralized storage, or the CloudStorageClient SDK. Covers the store() upload builder, chunked uploads, container-only reads (fetch/query), CID helpers, and authorization.
/product-sdk-contractsUse when interacting with smart contracts (PolkaVM/Solidity) on Asset Hub, using ContractManager with cdm.json manifests, createContract for ad-hoc contracts, ContractRuntime creation, or contract type codegen. Covers @parity/product-sdk-contracts.
/product-sdk-individualityUse when reading a person's personhood or membership standing on the individuality chain from a DotNS username or an account address, when reading the usernames an account holds, or when sending a transaction that must run under a person, lite-person or score-participant origin instead of an account origin. Covers readPersonhoodState, lookupUsername, the seven-state PersonhoodState union, the pure derivation without a chain client and the decode helpers for raw Score.Participants and Resources.Consumers values; the game surface, its prize draws, claiming and sign-up with its airdrop VRFs; productContext, personhoodContext, peopleRing, litePeopleRing and readScoreContext for the ring-VRF proof contexts; withAsPerson, withLiteAlias and the RestrictOrigins requirement that otherwise fails every call; the two-transaction lite personhood bind then sign-up flow with buildLiteAliasBindTx, readLiteSignUpRequirement and signUpWithLiteInviteTx; game registration in one call with registerForGame, readGameSeat, deriveSeat, bindGameSeat and the /host entry's hostGameRegistrationCapabilities; and full-personhood registration with registerMessage, Score.register and withScoreParticipant.
/product-sdk-nftsUse when reading Scarcity NFT collections or their item catalogues on Asset Hub, which collections a claim can mint into, every collection, and what one of them holds. Covers getClaimableCollections, getCollections and getCollectionItems, getApprovedCollections for the collections apps offer per network, the one storage map that separates claimable from merely existing, the chain client they require and why a TypedApi is not enough, the descriptor entries they touch and what a pruned whitelist does, the open metadata schema and the two readings of ImageRef, why a missing collection is a success value rather than an error, getClaims across the People chain and Asset Hub with the four states a credit can be in, previewClaim and why it is the item a claim will produce, getVerifiedArtwork and why bytes are withheld unless they hash to the reference, getInstanceDisplays for the display metadata of minted NFTs by instance id with Found/NotFound per instance, and the purse-scoped reads that do not exist yet.
2 plugins in one repository ship this exact skill · first indexed Sep 21, 2026
Other plugins' skills for the same job