Agent skill

Rtk Query API

by LedgerHQ in LedgerHQ/ledger-live

“RTK Query createApi best practices”

— description from SKILL.md by LedgerHQ
MITAuto-check passedFrontend & Design

Install Rtk Query API

skills CLI
$ npx skills add LedgerHQ/ledger-live --skill rtk-query-api -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install LedgerHQ/ledger-live rtk-query-api --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/LedgerHQ/ledger-live.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/rtk-query-api .claude/skills/rtk-query-api && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rtk-query-api
GitHub stars
621
Token cost
~1.6k tokens
SKILL.md length
570 words
Files
1
Skills in repo
50
Repo updated
First seen
Licence
MIT

At a glance

  • SKILL.md covers Structure, Splitting backend access from…, Endpoints and Caching & Tags, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

About this skill

Rtk Query API is a skill in LedgerHQ/ledger-live (621 stars). Its SKILL.md is about 1.6k tokens. Licence: MIT.

What it can do on your machine

Read from SKILL.md and the folder at commit a3861a2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • redux-toolkit.js.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Rtk Query API loads about 1.6k tokens when it runs. Until then it costs about 12 tokens; SKILL.md has 570 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~12
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from LedgerHQ/ledger-live at commit a3861a2, republished under its MIT licence (© LedgerHQ). 570 words, ~1,599 tokens.

Download SKILL.mdSave it as .claude/skills/rtk-query-api/SKILL.md (or your agent's skills folder).
name
rtk-query-api
description
RTK Query createApi best practices

RTK Query - createApi

Structure

  • One API slice per base URL / data source — never two createApi calls against the same backend
  • Export generated hooks alongside the API
typescript
// ✅ GOOD - state-manager/api.ts
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react";
import { EntityTags } from "./types";

export const myApi = createApi({
  reducerPath: "myApi",
  baseQuery: fetchBaseQuery({ baseUrl: "/api" }),
  tagTypes: [EntityTags.Entity, EntityTags.Entities],
  endpoints: (build) => ({
    getEntity: build.query<Entity, string>({
      query: (id) => `entities/${id}`,
      providesTags: [EntityTags.Entity],
    }),
  }),
});

export const { useGetEntityQuery } = myApi;

Define tags as enums in state-manager/types.ts:

typescript
export enum EntityTags {
  Entity = "Entity",
  Entities = "Entities",
}

Splitting backend access from use case

In domain/api/, this is the default — not something you reach for once a second use case appears. Always split reaching the backend from what you ask it for:

HalfOwnerContains
Reaching a backend@shared/api-services — one dir per backendBase URL, base query, retry, reducerPath, extraArgument contract
What you ask it for@domain/api-<name>Endpoints, wire schemas, transforms, cache tags, hooks

Doing it upfront costs nothing and means the second use case is a one-line addition rather than a migration. Two createApi calls against one backend would give you two store slices, two caches and two middlewares for one service.

The shared half declares an empty api. The use-case half adds to it with injectEndpoints for endpoints and enhanceEndpoints({ addTagTypes }) for tags. Both mutate and return the same api object, so one reducer, one middleware and one cache serve every use case.

There are no exceptions. If a backend's base query currently needs use-case knowledge — mock handlers keyed by endpoint URL, endpoint-name lookups, response types from its own wire schemas — that is a problem to fix in the base query, not a reason to keep a second createApi.

typescript
// ✅ GOOD - the service api: base query + config. No endpoints, no tags.
export const myServiceApi = createApi({
  reducerPath: "myServiceApi",
  baseQuery: myServiceBaseQuery,
  tagTypes: [],
  endpoints: () => ({}),
});
typescript
// ✅ GOOD - a use case adds its own tags, then its endpoints
export const FIRST_USE_CASE_TAGS = ["Entity"] as const;

export const firstUseCaseApi = myServiceApi
  .enhanceEndpoints({ addTagTypes: FIRST_USE_CASE_TAGS })
  .injectEndpoints({
    endpoints: build => ({
      getEntity: build.query<Entity, string>({
        query: id => `entities/${id}`,
        providesTags: [...FIRST_USE_CASE_TAGS],
      }),
    }),
  });

export const { useGetEntityQuery } = firstUseCaseApi;
  • Cache tags belong to the use case, not the shared api. injectEndpoints does not accept tagTypes, which makes it tempting to declare every tag upfront in the shared file — don't. enhanceEndpoints({ addTagTypes }) widens the tag union in place, so a tag stays next to the endpoints that provide it and adding a use case never means editing a shared file.
  • Register the service api; call endpoints on the use case. Only the injected reference is typed with the endpoints — injectEndpoints cannot retype the original.
  • Injection is a module-level side effect. An endpoint exists only once its use-case module has been evaluated as a value import; a type-only import will not trigger it. Never import an api from @shared/api-services in order to call endpoints on it.
  • A tag-less api has a narrower state type. The registered api declares no tags, so a helper typed on an injected reference (whose use case added some) will not accept an app's State. Type such helpers on the service api.
  • overrideExisting defaults to false — injecting an endpoint name that already exists is silently ignored unless you opt in.
Show full SKILL.md (162 more words)Show less

Endpoints

  • Use build.query for GET requests
  • Use build.mutation for POST/PUT/DELETE
  • Type both response and argument: build.query<ResponseType, ArgType>
  • Use void for no arguments: build.query<Data[], void>

Caching & Tags

  • Define tags as enums in types.ts
  • Use providesTags on queries for cache invalidation
  • Use invalidatesTags on mutations to trigger refetch
  • Use keepUnusedDataFor for custom cache duration
typescript
endpoints: (build) => ({
  getItems: build.query<Item[], void>({
    query: () => "items",
    providesTags: [ItemTags.Items],
    keepUnusedDataFor: 60, // seconds
  }),
  addItem: build.mutation<Item, Partial<Item>>({
    query: (body) => ({ url: "items", method: "POST", body }),
    invalidatesTags: [ItemTags.Items],
  }),
}),

Transform Responses

  • Use transformResponse to reshape API data
  • Use transformErrorResponse for custom error handling
typescript
getItems: build.query<Item[], void>({
  query: () => "items",
  transformResponse: (response: ApiResponse) => response.data.items,
}),

Error Handling

  • Always catch errors in custom baseQuery or queryFn
  • Return { data } on success, { error } on failure
typescript
// ✅ GOOD - errors are caught and returned
queryFn: async (arg) => {
  try {
    const data = await fetchData(arg);
    return { data };
  } catch (error) {
    return { error: { status: "CUSTOM_ERROR", data: error } };
  }
},

Registration

Register APIs in reducers/rtkQueryApi.ts, keyed by reducerPath. For a shared backend, register the service api — its endpoints arrive via the use-case packages the view-models import. The registry then reads as a list of the backends the app talks to:

typescript
const APIs = {
  [myApi.reducerPath]: myApi,
  [myServiceApi.reducerPath]: myServiceApi,
};

Two entries whose reducerPath resolves to the same string is a compile error (TS1117: An object literal cannot have multiple properties with the same name), even for computed properties — which is what catches an accidental double-registration of one backend.

© LedgerHQ, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/rtk-query-api of LedgerHQ/ledger-live.

Open the folder on GitHubat commit a3861a2

Compare with similar skills

Rtk Query API next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Rtk Query API compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Rtk Query API this skillLedgerHQ/ledger-live621—~1.6kAutomated safety check: PassMIT
React State Managementinvolvex/youtube-music-cli45612 repos~3kAutomated safety check: PassMIT
Frontendredis/RedisInsight8.9k—~3.2kAutomated safety check: PassCustom licence
Reactvalkey-io/valkey-admin148—~766Automated safety check: PassApache-2.0
Nekocap Redux Featurenopol10/nekocap105—~939Automated safety check: PassGPL-3.0
React ExpertJeffallan/claude-skills12k—~1.4kAutomated safety check: PassMIT

Similar skills

  • React State Management

    involvex/youtube-music-cli

    Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query.

    456 GitHub starsUsed in 12 repos~3k tokens
    Frontend & DesignAuto-check passed
  • Frontend

    redis/RedisInsight

    Official

    React/Redux frontend development patterns for RedisInsight UI: component folder structure, styled-components, hooks, named exports, barrel files, layout components, and theme usage.

    8.9k GitHub stars~3.2k tokensUpdated 3 days ago
    Frontend & DesignAuto-check passed
  • React

    valkey-io/valkey-admin

    Guidance for React frontend work. An agent skill from valkey-io/valkey-admin.

    148 GitHub stars~766 tokensUpdated 2 days ago
    Frontend & DesignAuto-check passed
  • Nekocap Redux Feature

    nopol10/nekocap

    A skill your agent uses when adding or modifying a Redux feature folder in the nekocap frontend — creating slices, writing sagas, defining selectors, changing persisted state shape, or touching…

    105 GitHub stars~939 tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • React Expert

    Jeffallan/claude-skills

    Builds React 19 components in TypeScript with Server Components, useActionState forms, custom hooks and state libraries, checked with tsc and React Testing Library.

    12k GitHub stars~1.4k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Sentry React SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for React. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~4.8k tokensUpdated today
    Frontend & DesignAuto-check passed

More from LedgerHQ/ledger-live

All 50 skills in this repo
  • Impacting PRs

    LedgerHQ/ledger-live

    Find which open PRs are impacted by a migration/sunset/refactor and notify their authors — blocking review when the old path is already gone from develop, heads-up comment when it is only deprecated…

    621 GitHub stars~3.3k tokensUpdated today
    Auto-check passed
  • Cloud Sync Module

    LedgerHQ/ledger-live

    Write, review or debug a cloudSyncModule.ts — a CloudSyncDataManager that syncs one slice of user data through Ledger Sync (Cloud Sync).

    621 GitHub stars~2.4k tokensUpdated today
    Auto-check passed
  • Codeownership

    LedgerHQ/ledger-live

    Maintain CODEOWNERS file and team directories. An agent skill from LedgerHQ/ledger-live.

    621 GitHub stars~687 tokensUpdated today
    Auto-check passed
  • Coin Families Contract

    LedgerHQ/ledger-live

    Coin-specific families logic must live in families/. An agent skill from LedgerHQ/ledger-live.

    621 GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Data Layer Advanced

    LedgerHQ/ledger-live

    Structure a Ledger Wallet data layer where one API response serves several entities.

    621 GitHub stars~509 tokensUpdated today
    Auto-check passed
  • Debug Rn Native Crash

    LedgerHQ/ledger-live

    Investigate native React Native crashes (Fabric/Hermes/iOS) in ledger-live-mobile when JS error logs are missing or unhelpful.

    621 GitHub stars~1.2k tokensUpdated today
    Auto-check passed

Works with

Questions about Rtk Query API

How do I install Rtk Query API in Claude Code?

Run `npx skills add LedgerHQ/ledger-live --skill rtk-query-api -a claude-code`. Or copy the skill folder (.agents/skills/rtk-query-api in LedgerHQ/ledger-live) into .claude/skills/rtk-query-api in your project. Claude Code loads it when a task matches its description.

How do I install Rtk Query API in Codex?

Run `npx skills add LedgerHQ/ledger-live --skill rtk-query-api -a codex`. Or copy the skill folder (.agents/skills/rtk-query-api in LedgerHQ/ledger-live) into .agents/skills/rtk-query-api in your project. Codex loads it when a task matches its description.

Can I use Rtk Query API in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add LedgerHQ/ledger-live --skill rtk-query-api -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rtk-query-api, .gemini/skills/rtk-query-api, .github/skills/rtk-query-api and .opencode/skills/rtk-query-api in your project.

What does Rtk Query API need to run?

SKILL.md names no scripts, command-line tools or credentials: Rtk Query API is instructions for the agent only.

Does Rtk Query API access the network?

SKILL.md names 1 domain. As links in the text: redux-toolkit.js.org. This is read from the text; nothing was executed.

Is Rtk Query API safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Rtk Query API use?

Rtk Query API is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Rtk Query API use?

About 1.6k tokens (SKILL.md is roughly 6.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Rtk Query API?

Skills that share tags, products or a category with Rtk Query API: React State Management (involvex/youtube-music-cli, 456 stars), Frontend (redis/RedisInsight, 8.9k stars), React (valkey-io/valkey-admin, 148 stars) and Nekocap Redux Feature (nopol10/nekocap, 105 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Rtk Query API?

LedgerHQ (a GitHub organization) maintains it in LedgerHQ/ledger-live, which has 621 GitHub stars. The repository holds 50 skills in this directory. The repository was last updated on October 7, 2026.

Source: LedgerHQ/ledger-live on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.