stream-react-native
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseStream React Native - skill router + execution flow
Stream React Native - 技能路由与执行流程
Rules: Read once per session. Every non-negotiable React Native Chat rule is stated there.
RULES.mdThis file is the single entrypoint: intent classification, project detection, and module pointers for Stream Chat React Native work.
规则: 每次会话需阅读****一次。所有不可协商的React Native Chat规则均已在其中说明。
RULES.md本文件是唯一入口点:用于Stream Chat React Native相关工作的意图分类、项目检测以及模块指引。
Step 0: Intent classifier (mandatory first - never skip)
步骤0:意图分类器(必须首先执行 - 不可跳过)
Before any tool call, decide the track from the user's input alone. Do not probe the filesystem first.
在调用任何工具之前,仅根据用户输入确定处理路径。不要先探测文件系统。
Signals -> track
信号 -> 处理路径
| Signal in user input | Track |
|---|---|
| "Build/create/scaffold a new React Native app", "create an Expo app", "new Stream Chat RN app", empty directory + React Native/Expo Chat | A - New app |
| "Add/integrate Stream Chat into this app", "wire Chat RN", "set up stream-chat-expo", "change/customize this Chat UI" | B - Existing app |
| C - Reference lookup if the user only asks how/docs; otherwise B - Existing app |
| Words "docs" or "documentation" around Stream Chat React Native / Expo work | C - Reference lookup |
| "How do I {X} in React Native/Expo?", "What does {SDK component/hook/prop} do?" | C - Reference lookup |
| "Install Stream packages", "set up Chat RN", "wire auth/token flow" with no broader feature request | D - Bootstrap / setup |
| Video, Feeds, Moderation review UI, or non-Chat Stream RN product | Reject bundled scope and route to live docs only if the user wants docs |
Bare | List the tracks briefly and wait |
| 用户输入中的信号 | 处理路径 |
|---|---|
| "Build/create/scaffold a new React Native app"、"create an Expo app"、"new Stream Chat RN app"、空目录 + React Native/Expo聊天应用需求 | A - 新应用 |
| "Add/integrate Stream Chat into this app"、"wire Chat RN"、"set up stream-chat-expo"、"change/customize this Chat UI" | B - 现有应用 |
| 若用户仅询问方法/文档,则为C - 参考查询;否则为B - 现有应用 |
| 提及Stream Chat React Native / Expo相关工作时出现"docs"或"documentation"词汇 | C - 参考查询 |
| "How do I {X} in React Native/Expo?"、"What does {SDK component/hook/prop} do?" | C - 参考查询 |
| "Install Stream packages"、"set up Chat RN"、"wire auth/token flow"且无更广泛的功能需求 | D - 初始化/设置 |
| Video、Feeds、Moderation审核UI或非Chat类Stream RN产品 | 拒绝该范围请求,仅当用户需要文档时跳转至在线文档 |
仅输入 | 简要列出所有处理路径并等待用户进一步输入 |
Disambiguation flow
歧义处理流程
If the request is ambiguous between wiring code and reference lookup, ask one short question and wait:
Do you want me to wire this into the project, or just map the React Native SDK pattern and files?
If the user wants a new app but did not name Expo or RN CLI, default to Expo because it is the shortest successful path. Use RN CLI when the user asks for it or when native project constraints require it.
若请求在代码集成与参考查询之间存在歧义,提出一个简短问题并等待回复:
你希望我将此功能集成到项目中,还是仅提供React Native SDK的模式与文件说明?
若用户需要创建新应用但未指定Expo或RN CLI,默认使用Expo,因为这是最快捷的成功路径。仅当用户明确要求或原生项目限制需要时,才使用RN CLI。
Scope rejection
范围拒绝
This v1 skill bundles Chat React Native only. If the user asks for Stream Video, Feeds, or Moderation UI in React Native, say:
The React Native skill currently bundles Chat references only. I can help with Chat RN here, or switch to live docs for Video/Feeds.
Do not invent missing React Native Video or Feeds API details from memory.
本v1技能仅包含Chat React Native相关内容。若用户询问React Native中的Stream Video、Feeds或Moderation UI,回复:
当前React Native技能仅包含Chat相关参考内容。我可以在此处协助处理Chat RN相关问题,或切换至在线文档处理Video/Feeds相关需求。
请勿凭记忆编造缺失的React Native Video或Feeds API细节。
After classification
分类后操作
- Tracks A, B, D -> run Project signals, then continue in and
builder.md. Runsdk.mdbefore writing Chat connection code or creating requested demo data.credentials.md - Track C -> skip credentials and project probes if the product + runtime are explicit. Only run a read-only probe if RN CLI vs Expo is ambiguous and the answer affects the guidance.
- 路径A、B、D -> 运行项目信号检测,然后继续参考和
builder.md。在编写Chat连接代码或创建请求的演示数据之前,先运行sdk.md。credentials.md - 路径C -> 若产品+运行时明确,跳过凭证与项目探测。仅当RN CLI与Expo存在歧义且答案会影响指导内容时,才进行只读探测。
Step 0.5: Credentials, token, and demo data (tracks A, B, D only)
步骤0.5:凭证、令牌与演示数据(仅适用于路径A、B、D)
Use once per session before writing code that connects to Stream Chat.
credentials.mdIt resolves:
- Stream API key
- user id and display name
- user token or token provider plan
- optional demo data, only when requested, via Stream CLI calls such as ,
UpdateUsers, andGetOrCreateChannelSendMessage
For Track A, it is acceptable to scaffold the app first if the runtime or target directory must be resolved before credentials. Do not render a connected Chat UI until credentials or a token-provider plan are resolved.
在编写连接Stream Chat的代码之前,每次会话需使用一次。
credentials.md它用于解决以下问题:
- Stream API密钥
- 用户ID与显示名称
- 用户令牌或令牌提供方案
- 可选演示数据,仅在用户请求时通过Stream CLI调用(如、
UpdateUsers和GetOrCreateChannel)生成SendMessage
对于路径A,若必须先确定运行时或目标目录才能处理凭证,可以先搭建应用框架。但在凭证或令牌提供方案确定之前,不要渲染已连接的Chat界面。
Project signals (tracks A/B/D - once per session; Track C on demand only)
项目信号检测(路径A/B/D - 每次会话一次;路径C按需执行)
Read-only local probe. Use it to detect empty/new workspace, RN CLI vs Expo, New Architecture hints, navigation setup, and existing Stream packages.
bash
bash -c 'echo "=== PACKAGE ==="; test -f package.json && grep -oE "\"(stream-chat-react-native|stream-chat-expo|react-native|expo|@react-navigation/[^\"]+|expo-router|react-native-reanimated|react-native-worklets|react-native-teleport|@op-engineering/op-sqlite)\": *\"[^\"]*\"" package.json 2>/dev/null; echo "=== EXPO ==="; find . -maxdepth 2 \( -name "app.json" -o -name "app.config.js" -o -name "app.config.ts" -o -path "./app/_layout.*" \) -print 2>/dev/null; echo "=== NATIVE ==="; find . -maxdepth 2 \( -name "ios" -o -name "android" \) -type d -print 2>/dev/null; echo "=== CONFIG ==="; find . -maxdepth 2 \( -name "babel.config.js" -o -name "metro.config.js" \) -print 2>/dev/null; echo "=== EMPTY ==="; test -z "$(ls -A 2>/dev/null)" && echo "EMPTY_CWD" || echo "NON_EMPTY"'Hold the result in conversation context. Do not re-run unless the user changes directory, packages are installed, or the project shape changes.
Use the result to produce a one-line status, for example:
Empty workspace detected - defaulting to Expo new app unless the user asked for RN CLIExpo app detected - stream-chat-expo absent - Expo Router present - ready for Chat setupRN CLI app detected - ios/android present - stream-chat-react-native installed - checking provider placementNo RN/Expo app detected in a non-empty directory - create a new app in a child directory or ask before reusing this directory
If there is no RN/Expo project and Track A applies, scaffold one through > 2. New app scaffold. If Track B/D applies in a non-RN directory, ask before creating a child app because that changes project ownership.
builder.md只读本地探测。用于检测空/新工作区、RN CLI与Expo、新架构提示、导航设置以及已安装的Stream包。
bash
bash -c 'echo "=== PACKAGE ==="; test -f package.json && grep -oE "\"(stream-chat-react-native|stream-chat-expo|react-native|expo|@react-navigation/[^\"]+|expo-router|react-native-reanimated|react-native-worklets|react-native-teleport|@op-engineering/op-sqlite)\": *\"[^\"]*\"" package.json 2>/dev/null; echo "=== EXPO ==="; find . -maxdepth 2 \( -name "app.json" -o -name "app.config.js" -o -name "app.config.ts" -o -path "./app/_layout.*" \) -print 2>/dev/null; echo "=== NATIVE ==="; find . -maxdepth 2 \( -name "ios" -o -name "android" \) -type d -print 2>/dev/null; echo "=== CONFIG ==="; find . -maxdepth 2 \( -name "babel.config.js" -o -name "metro.config.js" \) -print 2>/dev/null; echo "=== EMPTY ==="; test -z "$(ls -A 2>/dev/null)" && echo "EMPTY_CWD" || echo "NON_EMPTY"'将结果保存在会话上下文中。除非用户切换目录、安装包或项目结构变更,否则不要重新运行。
使用结果生成一行状态说明,例如:
检测到空工作区 - 除非用户要求RN CLI,否则默认创建Expo新应用检测到Expo应用 - 未安装stream-chat-expo - 已配置Expo Router - 可进行Chat设置检测到RN CLI应用 - 存在ios/android目录 - 已安装stream-chat-react-native - 正在检查提供器位置在非空目录中未检测到RN/Expo应用 - 在子目录中创建新应用,或在复用此目录前询问用户
若不存在RN/Expo项目且适用路径A,通过 > 2. 新应用搭建创建应用框架。若在非RN目录中适用路径B/D,创建子应用前需询问用户,因为这会改变项目归属。
builder.mdModule map
模块映射
| Track | Module(s) |
|---|---|
| A - New app | |
| B - Existing app | |
| C - Reference lookup | |
| D - Bootstrap / setup | |
| 处理路径 | 模块 |
|---|---|
| A - 新应用 | |
| B - 现有应用 | |
| C - 参考查询 | |
| D - 初始化/设置 | |
Reference layout
参考内容结构
Shared React Native and Expo patterns live in .
sdk.mdChat-specific setup, docs lookup, gotchas, and UI blueprints live under :
references/- docs lookup:
llms.txtreferences/DOCS.md - Chat setup/reference:
references/CHAT-REACT-NATIVE.md - Chat screen/component blueprints:
references/CHAT-REACT-NATIVE-blueprints.md
Future React Native product coverage should stay in this naming family instead of creating more top-level skills:
VIDEO-REACT-NATIVE.mdFEEDS-REACT-NATIVE.md
If the requested product file is not bundled yet, say so plainly and only switch to live docs if the user asks.
通用React Native与Expo模式位于****中。
sdk.mdChat特定的设置、文档查询、注意事项以及UI蓝图位于****目录下:
references/- 文档查询:
llms.txtreferences/DOCS.md - Chat设置/参考:
references/CHAT-REACT-NATIVE.md - Chat屏幕/组件蓝图:
references/CHAT-REACT-NATIVE-blueprints.md
未来React Native产品相关内容应沿用此命名规则,而非创建更多顶级技能:
VIDEO-REACT-NATIVE.mdFEEDS-REACT-NATIVE.md
若请求的产品文件未包含在当前技能中,直接告知用户,仅当用户要求时切换至在线文档。
Track A - New app
路径A - 新应用
Full detail: - use the new-app path.
builder.md| Phase | Name | What you do |
|---|---|---|
| A1 | Detect | Run Project signals. Empty workspace is valid for Track A. |
| A2 | Choose lane | Default to Expo if unspecified; use RN CLI when requested. |
| A3 | Scaffold | Create the app with current framework tooling; do not explain full RN/Expo environment setup. |
| A4 | Install + wire | Use the primary |
| A5 | Verify | Confirm install, Babel plugin, root providers, auth, and first rendered Chat screen. |
详细说明: - 使用新应用路径。
builder.md| 阶段 | 名称 | 操作内容 |
|---|---|---|
| A1 | 检测 | 运行项目信号检测。空工作区适用于路径A。 |
| A2 | 选择方式 | 未指定时默认使用Expo;用户要求时使用RN CLI。 |
| A3 | 搭建框架 | 使用当前框架工具创建应用;无需解释完整的RN/Expo环境设置。 |
| A4 | 安装与集成 | 使用主 |
| A5 | 验证 | 确认安装、Babel插件、根提供器、认证以及首个渲染的Chat屏幕正常工作。 |
Track B - Existing app
路径B - 现有应用
Full detail: - use the existing-project path.
builder.md| Phase | Name | What you do |
|---|---|---|
| B1 | Detect | Run Project signals and inspect existing app structure before editing. |
| B2 | Preserve | Keep Expo/RN CLI lane, package manager, navigation stack, and auth architecture unless asked to migrate. |
| B3 | Integrate | Use |
| B4 | Verify | Confirm the requested Stream Chat flow builds and renders in the existing app. |
详细说明: - 使用现有项目路径。
builder.md| 阶段 | 名称 | 操作内容 |
|---|---|---|
| B1 | 检测 | 运行项目信号检测并检查现有应用结构后再进行编辑。 |
| B2 | 保留原有配置 | 保留Expo/RN CLI方式、包管理器、导航栈以及认证架构,除非用户要求迁移。 |
| B3 | 集成 | 使用 |
| B4 | 验证 | 确认请求的Stream Chat流程在现有应用中可构建并正常渲染。 |
Track C - Reference lookup
路径C - 参考查询
Load only the relevant files:
- manifest lookup rules ->
llms.txtreferences/DOCS.md - Shared lifecycle / auth / provider / runtime patterns ->
sdk.md - Chat RN setup and gotchas ->
references/CHAT-REACT-NATIVE.md - Chat RN screen/component structure ->
references/CHAT-REACT-NATIVE-blueprints.md
If the user asks for exact API details not bundled here, use to fetch the right manifest and selected markdown page. If implementation still needs source-level confirmation, inspect the installed package under the target app's after dependencies are installed. Do not use machine-specific documentation paths.
references/DOCS.mdnode_modules仅加载相关文件:
- 清单查询规则 ->
llms.txtreferences/DOCS.md - 通用生命周期/认证/提供器/运行时模式 ->
sdk.md - Chat RN设置与注意事项 ->
references/CHAT-REACT-NATIVE.md - Chat RN屏幕/组件结构 ->
references/CHAT-REACT-NATIVE-blueprints.md
若用户询问当前技能未包含的精确API细节,使用获取正确的清单与选定的markdown页面。若仍需源码级确认,在安装依赖后检查目标应用下的已安装包。请勿使用特定机器的文档路径。
references/DOCS.mdnode_modulesTrack D - Bootstrap / setup
路径D - 初始化/设置
Use when the user wants package install and shared wiring more than a full feature build:
- detect RN CLI vs Expo
- use lookup for Installation docs and verify current npm dist-tags
llms.txt - install the correct Chat package and required peers
- add Reanimated/Worklets Babel plugin as the last plugin
- wrap the entry point with
GestureHandlerRootView - place and
OverlayProvidercorrectlyChat - wire or the app's backend token provider
useCreateChatClient - stop before product-specific UI if the user only asked for setup
适用于用户仅需要包安装与通用集成,而非完整功能构建的场景:
- 检测RN CLI与Expo
- 使用查询安装文档并验证当前npm dist-tags
llms.txt - 安装正确的Chat包及其必要依赖
- 添加Reanimated/Worklets Babel插件作为最后一个插件
- 使用包裹入口点
GestureHandlerRootView - 正确放置与
OverlayProviderChat - 集成或应用的后端令牌提供器
useCreateChatClient - 若用户仅要求设置,在产品特定UI之前停止操作