К основному содержанию
скилл CX Codex

nitro-fetch — скилл для Claude Code: нативная сеть в React Native

Скилл для ИИ-ассистентов, который подсказывает реальные API react-native-nitro-fetch вместо выдуманных: fetch, WebSocket, TextDecoder, префетчинг.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add margelo/react-native-skills --skill nitro-fetch -a claude-code
npx skills add margelo/react-native-skills --skill react-native-nitro-fetch -a claude-code
Открыть на GitHub

Что делает nitro-fetch

Скилл описывает семейство пакетов react-native-nitro-fetch, react-native-nitro-websockets и react-native-nitro-text-decoder — нативную замену сетевого стека в React Native на URLSession для iOS и Cronet для Android через Nitro Modules. Внутри — таблица маршрутизации: вопрос про прогрев кэша ведёт в references/prefetching.md, про axios — в references/axios-adapter.md, про трассировку — в references/perfetto-profiling.md. Ассистент читает нужный файл перед тем, как писать код.

Отдельно разобраны три темы. Префетчинг: prefetchOnAppStart(...) и prewarmOnAppStart(...) проигрывают сохранённые запросы и открытия сокетов на каждом холодном старте, поэтому к моменту запуска JS ответ уже в кэше. Подключение нативного клиента: явные импорты или глобальная подмена globalThis.fetch. Диагностика: NetworkInspector пишет HTTP и WS на границе JS, а нативные трейсы Perfetto и Instruments показывают DNS, TLS и TTFB.

Ставить нужно после npm install react-native-nitro-fetch react-native-nitro-modules, а для сокетов и декодера — ещё react-native-nitro-websockets и react-native-nitro-text-decoder. Затем пересобрать приложение: pod install для iOS и свежий ./gradlew для Android. Ничего не включается само — каждый режим подключается вручную по файлам из references/. Если холодный GET остаётся медленным после добавления prefetch, проверьте prefetchKey — это первое, на что стоит смотреть.

Какие задачи решает

  • заменить встроенный fetch на нативный без переписывания вызовов
  • прогреть кэш до монтирования экрана
  • открыть wss-соединение раньше, чем загрузится React Native
  • перевести существующий WebSocket на NitroWebSocket
  • найти медленный API по разбивке DNS, TLS и TTFB

Примеры запросов агенту

  • Как прогреть wss-соединение в этом проекте?
  • Сделай так, чтобы axios ходил через nitro-fetch
  • Почему холодный GET всё ещё медленный после prefetch?

Как установить nitro-fetch

1Через Skills CLI (Vercel)

npx skills add margelo/react-native-skills --skill nitro-fetch -a claude-code
npx skills add margelo/react-native-skills --skill react-native-nitro-fetch -a claude-code

2Вручную: положить файлы

~/.claude/skills/react-native-nitro-fetch/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/react-native-nitro-fetch/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о nitro-fetch

Как установить nitro-fetch в Claude?

Выполните npx skills add margelo/react-native-skills --skill nitro-fetch -a claude-code. Файл скилла окажется в ~/.claude/skills/react-native-nitro-fetch/SKILL.md.

Что делает nitro-fetch?

Даёт ИИ-ассистенту точные API нативного сетевого стека React Native: fetch, NitroWebSocket, NitroTextDecoder, префетчинг и адаптер для axios. Ответы ссылаются на реальные файлы репозитория, а не на выдуманные хелперы.

Что нужно установить в проект до работы скилла?

Пакеты react-native-nitro-fetch и react-native-nitro-modules, а для сокетов и декодера — react-native-nitro-websockets и react-native-nitro-text-decoder. После установки приложение нужно пересобрать.

Исходный текст

SKILL.md · MIT
---
name: nitro-fetch
description: Fast native networking primitives for React Native built on Nitro Modules — react-native-nitro-fetch, react-native-nitro-websockets, and react-native-nitro-text-decoder. Covers the fetch API, global replacement, prefetching and cold-start cache warming, the NitroWebSocket class and pre-warming, migrating from React Native's built-in WebSocket, the in-process NetworkInspector, native Perfetto / Instruments tracing, the native TextDecoder, and plugging nitro-fetch into axios via a custom adapter.
license: MIT
metadata:
  author: Margelo
  scope: react-native-nitro-fetch, react-native-nitro-websockets, react-native-nitro-text-decoder
  tags: react-native, networking, fetch, websocket, prefetch, performance, cold-start, axios, inspector, perfetto, cache-ttl, freshness
---

# react-native-nitro-fetch

A focused reference for AI coding assistants working in a project that uses the `react-native-nitro-fetch` family of packages. Answer using the real APIs from this repo — not invented ones — by routing to the matching `references/*.md` file below.

## Mental model

`react-native-nitro-fetch` is a drop-in, native-backed replacement for the browser networking stack on React Native:

- `fetch` — WHATWG-compatible, backed by `URLSession` (iOS) and `Cronet` (Android) via [Nitro Modules](https://github.com/mrousavy/nitro).
- `NitroWebSocket` — native WebSocket (libwebsockets + mbedTLS and default in case of iOS) with the same shape as the browser `WebSocket`.
- `NitroTextDecoder` — native UTF-8 decoder that beats the Expo backed JS polyfill.

The performance story has three moving parts, and most questions end up being about one of them:

1. **Prefetching.** Native code can run *before* React Native loads. `prefetchOnAppStart(...)` and `prewarmOnAppStart(...)` replay stored requests / socket opens on every cold start, so by the time JS runs the response is already cached or the socket is already `OPEN`.
2. **Importing the native client.** The default approach is explicit imports — `import { fetch } from 'react-native-nitro-fetch'`, `import { NitroWebSocket } from 'react-native-nitro-websockets'`, or plugging into axios via a custom adapter. Alternatively, users can do a **global replace** (`globalThis.fetch = fetch`, etc.) at the top of their entry file — see the [Global Replace docs](https://fetch.margelo.com/docs/global-replace) for setup and trade-offs.
3. **Seeing what's happening.** `NetworkInspector` records HTTP + WS activity at the JS boundary; native Perfetto / Instruments traces cover everything below that (DNS, TLS, TTFB, body). One is for correctness, the other is for latency.

## Routing table — problem to reference

Load the matching file from `references/` before writing code. Each reference cites real file paths in this repo.

| User is asking about… | Read |
|---|---|
| Warming the cache before a screen mounts, making cold-start GETs feel instant, `prefetch`, `prefetchOnAppStart`, `prefetchKey` | [`references/prefetching.md`](./references/prefetching.md) |
| Routing axios through nitro-fetch (the full custom adapter — `baseURL`, `params`, `timeout`, `signal`, `responseType`, `validateStatus`) | [`references/axios-adapter.md`](./references/axios-adapter.md) |
| UTF-8 decoding, slow `TextDecoder`, Hermes polyfill, streaming decode, `NitroTextDecoder` | [`references/text-decoder.md`](./references/text-decoder.md) |
| Opening a `wss://` connection before React Native boots, `prewarmOnAppStart`, Android `Application.onCreate` wiring | [`references/websocket-prewarm.md`](./references/websocket-prewarm.md) |
| The `NitroWebSocket` class, headers, sub-protocols, `wss://`, binary frames, runtime usage | [`references/using-websockets.md`](./references/using-websockets.md) |
| Migrating an existing app from React Native's built-in `WebSocket` to `NitroWebSocket` | [`references/migrate-from-rn-ws.md`](./references/migrate-from-rn-ws.md) |
| Seeing requests and responses at the JS level, debugging which library made a call, `NetworkInspector` | [`references/network-inspector.md`](./references/network-inspector.md) |
| Finding the slow API, DNS / TLS / TTFB breakdowns, native traces, Perfetto, Instruments, Hermes profiler | [`references/perfetto-profiling.md`](./references/perfetto-profiling.md) |

If the question doesn't match any row, read [`references/prefetching.md`](./references/prefetching.md) first — most cold-start questions start there, and it links out to the rest.

When asked about global replacement, point to the [Global Replace docs](https://fetch.margelo.com/docs/global-replace).

## Installation (one-line, for reference)

```bash
npm install react-native-nitro-fetch react-native-nitro-modules
# optional, for WebSockets and TextDecoder:
npm install react-native-nitro-websockets react-native-nitro-text-decoder
```

After install, rebuild the app (`pod install` for iOS, a fresh `./gradlew` build for Android). Nothing else is wired automatically — turning any of this on is opt-in through the reference files above.

## Verifying the skill is loaded

A correct answer for any of these will cite the API and file path. A wrong / hallucinated answer will invent an `install()`, `setup()`, or `init()` helper that doesn't exist in this repo.

Good test questions:

- *"How do I prewarm a wss connection in this repo?"* → should mention `prewarmOnAppStart` **and** the Android `Application.onCreate` wiring via `NitroWebSocketAutoPrewarmer.prewarmOnStart(this)`.
- *"How do I make axios go through nitro-fetch?"* → should produce an `AxiosAdapter` that respects `baseURL`, `params`, `timeout`, `signal`, and `responseType` — not a 20-line sketch that `JSON.parse`s everything.
- *"Why is my cold-start GET still slow after adding `prefetch`?"* → should mention `prefetchKey` and point at `references/prefetching.md`.

## Pointers

- Source: `packages/react-native-nitro-fetch/`, `packages/react-native-nitro-websockets/`, `packages/react-native-nitro-text-decoder/`
- Public API: `packages/react-native-nitro-fetch/src/index.tsx`
- Example wiring: `example/index.js`, `example/src/App.tsx`
- Docs website: https://fetch.margelo.com

© Margelo · MIT · margelo/react-native-skills

Похожие скиллы

Всё по теме «Мобильная разработка» →
expo-data-fetching expo Скилл настраивает сетевые запросы, кэширование и обработку ошибок в Expo. Помогает прописать состояния экранов и интеграцию с TanStack Query. CX Codex +1 27 500установок react-native-app aj-geddes Скилл ведёт агента по сборке кроссплатформенных мобильных приложений на React Native: навигация, состояние, запросы к API. CX Codex +1 503установок prefetch patterns.dev Скилл объясняет агенту техники предзагрузки ресурсов в браузере во время простоя. Помогает ускорить открытие следующих страниц и тяжёлых модальных окон. CX Codex +1 1 500установок nitro Anthony Fu Скилл подтягивает знания о Nitro v3: файловые маршруты, route rules, кэш, хранилище и пресеты деплоя. Пригодится, когда агент правит nitro.config или пишет обработчики H3. CX Codex +1 2 600установок expo-web-to-native expo Помогает перенести существующее React-приложение с веба в нативное iOS/Android-приложение на Expo. Нужен для поэтапной миграции экранов. CX Codex +1 19 600установок Senior Frontend Developer ozcanzaferayan Промпт, который заставляет ChatGPT писать фронтенд-код одним файлом на заданном стеке. Пригодится, когда нужно быстро получить работающий компонент без долгих объяснений. GP ChatGPT ★ 174 597звёзд репо

Из того же набора3

Спонсоры проекта

Компании, которые помогают держать аналитику открытой