Skip to content

IC Reactor is designed to be highly compatible with AI coding assistants (like ChatGPT, Claude, and GitHub Copilot) and LLMs. This guide explains how to get the best results when using AI to build with IC Reactor.

We provide a structured overview of the library at /llms.txt (located at the root of the repository). You can feed this file to any LLM to give it immediate context about:

  • Core concepts (Reactor, ClientManager)
  • Key packages and their roles
  • Common code patterns for initialization and React hooks
  • Best practices for type safety and transformations

You can download the context file to provide to your AI assistant:

The ic-reactor-hooks skill is available in two places:

Use this skill when asking an AI agent to generate or refactor IC Reactor integrations, especially when you need:

  • createActorHooks(...) patterns
  • reusable createQuery / createMutation factory modules
  • guidance for using the same query or mutation objects inside React and outside React
  • cache invalidation wiring with getQueryKey() / invalidate()
  • guidance on when to use manual hooks vs generated hooks (CLI / Vite plugin)
Use $ic-reactor-hooks to refactor this canister integration into reusable query and mutation factories, then show usage in a React component and a loader/action.
Terminal window
npx skills add B3Pay/ic-reactor-skills --full-depth --skill ic-reactor-hooks

Since IC Reactor is built with extreme type safety in mind, AI assistants can easily infer the available methods and argument types for your canisters once you’ve defined the IDL factory.

When asking an AI to write code for a specific canister, always provide the generated IDL factory (e.g., my_canister.did.js) or the Candid interface. The AI can then write perfectly typed useActorQuery or useActorMutation hooks.

To make AI-generated code cleaner and less error-prone, you can use DisplayReactor. This allows the AI to write code using standard JavaScript types (like string for BigInt or Principals) instead of specialized classes, which is what most LLMs are naturally trained on.

import { DisplayReactor } from "@ic-reactor/core"
import { createActorHooks } from "@ic-reactor/react"
const reactor = new DisplayReactor({
clientManager,
idlFactory,
name: "backend",
canisterId: "...",
})
const { useActorQuery, useActorMutation } = createActorHooks(reactor)

“Help me set up an IC Reactor actor for a canister with ID rrkah-fqaaa-aaaaa-aaaaq-cai and an IDL factory imported from ./declarations/my_canister.”

“Show me how to use useActorQuery to fetch a user’s balance from a Ledger canister using IC Reactor hooks.”

“Write a React component that uses useActorMutation to transfer tokens between two accounts.”

If you use Cursor, this project includes a .cursorrules file that automatically configures the AI to follow the project’s specific coding standards and architecture.

If you use GitHub Copilot, the repository includes .github/copilot-instructions.md and skill metadata at skill-packages/ic-reactor-hooks/agents/copilot.yaml. You can also install the external skills from B3Pay/ic-reactor-skills.

If you use Claude, the repository includes a CLAUDE.md project context file and skill metadata at skill-packages/ic-reactor-hooks/agents/claude.yaml.

If you use OpenAI Codex, the repository includes AGENTS.md and skill metadata at skill-packages/ic-reactor-hooks/agents/openai.yaml.