ic-reactor
/ic-reactor
Write, review and fix app code that calls Internet Computer (ICP) canisters with ic-reactor 4 (@ic-reactor/core, @ic-reactor/react, @ic-reactor/vite-plugin) over a module generated by candid-core-cli gen, in React or plain TypeScript. Use when the project depends on an @ic-reactor/* package at version 4, or the user asks to set up a canister client (createClient, ReactorProvider), read or write a canister with TanStack Query (client.queryOptions, client.mutationOptions), sign users in (useAuth), decide whether a failed call may have executed (ReactorError, kind, mayHaveExecuted), parse or show
- Author
- b3pay ↗
- Repository
- ic-reactor ↗
- Licence
- MIT
- Last repository change
- 26.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Write, review and fix app code that calls Internet Computer (ICP) canisters with ic-reactor 4 (@ic-reactor/core, @ic-reactor/react, @ic-reactor/vite-plugin) over a module generated by candid-core-cli gen, in React or plain TypeScript. Use when the project depends on an @ic-reactor/* package at version 4, or the user asks to set up a canister client (createClient, ReactorProvider), read or write a canister with TanStack Query (client.queryOptions, client.mutationOptions), sign users in (useAuth), decide whether a failed call may have executed (ReactorError, kind, mayHaveExecuted), parse or show
Original author description
Write, review and fix app code that calls Internet Computer (ICP) canisters with ic-reactor 4 (@ic-reactor/core, @ic-reactor/react, @ic-reactor/vite-plugin) over a module generated by candid-core-cli gen, in React or plain TypeScript. Use when the project depends on an @ic-reactor/* package at version 4, or the user asks to set up a canister client (createClient, ReactorProvider), read or write a canister with TanStack Query (client.queryOptions, client.mutationOptions), sign users in (useAuth), decide whether a failed call may have executed (ReactorError, kind, mayHaveExecuted), parse or show
How it works
- Workflow
- Before you finish
SKILL.md preview
---
name: ic-reactor
description: >-
Write, review and fix app code that calls Internet Computer (ICP) canisters
with ic-reactor 4 (@ic-reactor/core, @ic-reactor/react,
@ic-reactor/vite-plugin) over a module generated by candid-core-cli gen, in
React or plain TypeScript. Use when the project depends on an @ic-reactor/*
package at version 4, or the user asks to set up a canister client
(createClient, ReactorProvider), read or write a canister with TanStack Query
(client.queryOptions, client.mutationOptions), sign users in (useAuth),
decide whether a failed call may have executed (ReactorError, kind,
mayHaveExecuted), parse or show token amounts (parseUnits, formatUnits),
generate the module from a .did file, or test canister code. Not for
changing the ic-reactor library itself.
license: MIT
---
# ic-reactor 4 in an app
This skill is a workflow. The API and its rules are in one guide that ships
with the package, `node_modules/@ic-reactor/core/llms.txt`: read it before
writing code, and follow it over anything here, including your memory of
earlier ic-reactor versions (their names are gone in 4).
This skill describes these versions:
- `@ic-reactor/core`: `4.0.0`
- `@ic-reactor/react`: `4.0.0`
- `@ic-reactor/vite-plugin`: `4.0.0`
## Workflow
1. **Read the installed guide.** Its `Applies to` line names the release it
describes; when that differs from the list above, the installed guide wins.
2. **Install the exact peers.** `@ic-reactor/core` with `@icp-sdk/core` and
`@tanstack/query-core`; for React, `@ic-reactor/react` (at exactly core's
version), `@tanstack/react-query` and `react`, with `@tanstack/query-core`
at the exact version `@tanstack/react-query` depends on, so that
`npm ls @tanstack/query-core` shows one copy; `@icp-sdk/auth` for Internet
Identity sign-in. `@candid-core/schema` must be the exact version
`@ic-reactor/core` lists in its `peerDependencies`, and the generator
`@candid-core/cli` the exact version `@ic-reactor/vite-plugin` lists:
install both with `--save-exact`. The `@ic-reactor/*` packages are on npm's
`latest` dist-tag: install them bare, and never pin a 3.x version, whose
names this guide does not describe.
3. **Generate the module** from each canister's `.did`, with
`npx candid-core-cli gen <file>.did -o src/generated`, or with the Vite
plugin, which regenerates on change:
```ts
// vite.config.ts
import { defineConfig } from "vite"
import { icReactor } from "@ic-reactor/vite-plugin"
export default defineConfig({
plugins: [
icReactor({
canisters: {
ledger: { didFile: "did/icrc1.did", outDir: "src/generated" },
},
}),
],
})
```
The module is named after the `.did` file: for `icrc1.did` both write
`src/generated/icrc1.ts`, which the guide imports as `./generated/icrc1`.
Without `outDir` the plugin writes to `src/canisters/`, and the imports
must follow. Never edit the generated file; take method names and value
shapes from its `type Actor`, and never guess them. In CI, `candid-core-cli gen ... --check`
fails on a stale module.
4. **Create one client** with `createClient({ network, identity | auth })`:
one per browser tab, or one per request on a server. Choose the network and
the caller as the guide's Setup section says, including its rule for an
identity that may be anonymous.
5. **In React**, render `ReactorProvider` with a client factory around the
tree that calls canisters, and read the client and the caller with
`useClient()` and `useAuth()`.
6. **Read and write** with `useQuery(client.queryOptions(...))` and
`useMutation(client.mutationOptions(...))`, or call the canister's methods
directly outside React. Build options in render from that render's
`useClient()`, never from a module-scope client, and add neither `retry` to
a write nor data carried across keys.
7. **Handle failures** by `isReactorError(error)`, then `kind` and
`mayHaveExecuted`: when it is `true`, tell the user the outcome is unknown
and re-read; never re-send by hand. A write that timed out (`timeoutMs`,
code `"timeout"`) after its request went out is such an unknown outcome,
and a `cancelled` with that code is a real timeout to show, not ignore.
Only a method the canister deduplicates (an ICRC-1 transfer with
`created_at_time`) may offer the same argument again, through
`client.resendOf(error, canister, method, { dedupedBy })`.
After a direct call, use
`isReactorError(error, canister, method)` to read a typed `err`; never cast it.
8. **Test** through `createTestClient()` from `@ic-reactor/core/testing`, a
real client over an in-memory replica, not with stubbed calls; then run the
app's type check and tests.
## Before you finish
Check the code against the guide's "Do not" list, item by item.
Versions
The database has no other skills named ic-reactor.
Database snapshot: 13.11.2026 · package version bb604c754045 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 100service-discoverability
Make a canister app discoverable to an AI agent from just its URL, including through ICP MCP. Covers publishing a /.well-known/ic-architecture manifest of your canisters — generated at deploy time from real canister IDs via the static-site recipe's presync hook and envsubst —… - 90TanStack Query Core
This skill should be used when the user asks about "TanStack Query", "React Query", "useQuery", "query keys", "staleTime", "query client setup", "query factories", "queryOptions", or needs guidance on core TanStack Query concepts, mental models, and setup patterns. - 100icp-cli
Guides use of the icp command-line tool for building and deploying Internet Computer applications. Covers project configuration (icp.yaml), recipes, environments, canister lifecycle, identity management, and bundling a project into a self-contained .icp package (icp project… - 100react-ts-vite
React + TypeScript + Vite frontend development. Use whenever building, scaffolding, extending or refactoring a React app in TypeScript: "create a React component", "build a page with React", "add a feature to my React app", "scaffold a new Vite project", "write a custom hook",… - 90TanStack Types
This skill should be used when the user asks about "type-safe React Query", "queryOptions typing", "Zod validation", "TypeScript with TanStack Query", "generic useQuery", "DataTag", "infer query types", or needs guidance on type safety patterns, runtime validation, and… - 100setup
First-time setup or upgrade for Reel Reactor. Checks Node and the plugin's browser tools, creates or upgrades the config, walks the user through a manual Instagram login in the plugin's own browser, and creates or updates the scheduled task. Use when the user says "set up reel…