AI Context File
AI Friendliness
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.
context.txt
Section titled “context.txt”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:
Agent Skills
Section titled “Agent Skills”The ic-reactor-hooks skill is available in two places:
- In-repo:
skill-packages/ic-reactor-hooks/— used by agents working directly in this repository - External:
B3Pay/ic-reactor-skills— standalone installable skill for use in any ICP project
Use this skill when asking an AI agent to generate or refactor IC Reactor integrations, especially when you need:
createActorHooks(...)patterns- reusable
createQuery/createMutationfactory 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)
Example Prompt
Section titled “Example Prompt”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.Example Install (skills CLI)
Section titled “Example Install (skills CLI)”npx skills add B3Pay/ic-reactor-skills --full-depth --skill ic-reactor-hooksEnd-to-End Type Safety
Section titled “End-to-End Type Safety”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.
Tip: Provide the IDL Factory
Section titled “Tip: Provide 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.
Display Types (Auto Transformations)
Section titled “Display Types (Auto Transformations)”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)Prompting Examples
Section titled “Prompting Examples”“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.”
Data Fetching
Section titled “Data Fetching”“Show me how to use useActorQuery to fetch a user’s balance from a Ledger canister using IC Reactor hooks.”
Mutations
Section titled “Mutations”“Write a React component that uses useActorMutation to transfer tokens between two accounts.”
Tools and Extensions
Section titled “Tools and Extensions”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.