stream-android

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Stream Android - skill router + execution flow

Stream Android - 技能路由与执行流程

Rules: Read
RULES.md
once per session - every non-negotiable rule is stated there, nowhere else.
This file is the single entrypoint: intent classification, local project detection, and module pointers for Stream work in Android apps.

规则: 每个会话需阅读一次**
RULES.md
**——所有不可协商的规则均在此文件中,无其他存放位置。
本文件是唯一入口:用于Android应用中Stream相关工作的意图分类、本地项目检测以及模块指引。

Step 0: Intent classifier (mandatory first - never skip)

步骤0:意图分类器(必须首先执行,切勿跳过)

Before any tool call, decide the track from the user's input alone - no probes first.
在调用任何工具前,仅根据用户输入确定处理路径——不要先进行探测。

Signals -> track

信号 → 处理路径

Signal in user inputTrack
Explicit product/framework token:
Chat Compose
,
Chat XML
,
Video Android
,
Video Compose
,
Feeds Android
,
Feeds Compose
, etc.
C - Reference lookup
Words "docs" or "documentation" around Stream Android/Compose workC - Reference lookup
"How do I {X} in Compose/XML/Android?", "What does {SDK type/Composable/View/Fragment} do?"C - Reference lookup
"Build me a new Android app", "create a Compose app", "new Android app" + Stream productA - New app
"Add/integrate Stream into this app", "wire Chat/Video/Feeds into my Android project"B - Existing app
"Install Stream packages", "set up Stream in Android Studio", "wire auth/token flow" with no broader feature requestD - Bootstrap / setup
Bare
/stream-android
with no args
List the tracks briefly and wait
用户输入中的信号处理路径
明确的产品/框架标识:
Chat Compose
Chat XML
Video Android
Video Compose
Feeds Android
Feeds Compose
C - 参考查询
围绕Stream Android/Compose工作提及“docs”或“documentation”(文档)C - 参考查询
“如何在Compose/XML/Android中实现{X}?”、“{SDK类型/Composable/View/Fragment}有什么作用?”C - 参考查询
“帮我构建一个新的Android应用”、“创建一个Compose应用”、“新Android应用”+Stream产品A - 新建应用
“将Stream添加/集成到这个应用中”、“在我的Android项目中接入Chat/Video/Feeds”B - 已有应用
“安装Stream包”、“在Android Studio中配置Stream”、“接入认证/令牌流程”且无更宽泛的功能需求D - 初始化/配置
仅输入
/stream-android
且无参数
简要列出各处理路径并等待用户进一步说明

Disambiguation flow

歧义处理流程

If the request is ambiguous between build/integrate and reference lookup, ask one short question and wait:
Do you want me to wire this into the project, or just map the Android SDK pattern and files?
如果请求在构建/集成参考查询之间存在歧义,提出一个简短问题并等待回复:
你希望我将该功能接入项目中,还是仅为你梳理Android SDK的模式和相关文件?

After classification

分类完成后

  • Tracks A, B, D -> run Step 0.5 (credentials) first, then Project signals once per session, then continue in
    builder.md
    and
    sdk.md
    . Do not probe the project before credentials.
  • Track C -> skip both steps if the product + UI layer are explicit. Only run Project signals on demand if the SDK or UI layer is ambiguous.

  • 处理路径A、B、D → 首先执行步骤0.5(凭证),每个会话执行一次项目信号检测,之后继续参考
    builder.md
    sdk.md
    。在获取凭证前不要探测项目。
  • 处理路径C → 如果产品和UI层明确,则跳过上述两个步骤。仅当SDK或UI层存在歧义时,按需执行项目信号检测。

Step 0.5: Credentials, token, and seed data (tracks A, B, D only)

步骤0.5:凭证、令牌和初始数据(仅适用于处理路径A、B、D)

Order: intent classification -> Step 0.5 (this step) -> Project signals probe -> track work. Do this before running the Project signals shell command, even if a track table below lists "Detect" as phase 1. Run once per session for tracks A, B, and D. Skip for Track C.
Follow
credentials.md
to:
  • collect the Stream API key from the dashboard (or from the user)
  • generate a user token via the Stream CLI (or accept one from the user)
  • run any product-specific setup (Chat: optionally seed channels; Feeds: confirm feed groups; Video: nothing — calls are ephemeral)
Use the resulting API key and token in every code snippet — never placeholder strings. If a track A/B/D task reaches code work and credentials haven't been collected yet, return to
credentials.md
before continuing.

顺序: 意图分类 → 步骤0.5(本步骤) → 项目信号探测 → 对应路径工作。即使下方路径表格中列出“检测”为第一阶段,也要在运行项目信号shell命令之前执行本步骤。每个会话针对处理路径A、B、D执行一次。处理路径C跳过本步骤。
遵循
credentials.md
完成以下操作:
  • 从控制台获取Stream API密钥(或向用户索要)
  • 通过Stream CLI生成用户令牌(或接受用户提供的令牌)
  • 执行任何产品特定的配置(Chat:可选初始化频道;Feeds:确认Feed分组;Video:无操作——通话为临时会话)
在所有代码片段中使用获取到的API密钥和令牌——切勿使用占位符字符串。如果处理路径A/B/D的任务进入代码工作阶段但尚未收集凭证,需先回到
credentials.md
完成操作后再继续。

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 whether the user is in an Android Studio / Gradle project, a Kotlin module, or an empty directory.
bash
bash -c 'echo "=== GRADLE ROOT ==="; find . -maxdepth 2 \( -name "settings.gradle.kts" -o -name "settings.gradle" -o -name "build.gradle.kts" -o -name "build.gradle" \) -print 2>/dev/null; echo "=== APP MODULES ==="; find . -maxdepth 3 -type f \( -name "build.gradle.kts" -o -name "build.gradle" \) -path "*/*/build.gradle*" -print 2>/dev/null; echo "=== VERSION CATALOG ==="; find . -maxdepth 3 -name "libs.versions.toml" -print 2>/dev/null; echo "=== MANIFESTS ==="; find . -maxdepth 4 -name "AndroidManifest.xml" -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. Don't re-run it unless the user changes directory or the project shape clearly changed.
Use the result to produce a one-line status, for example:
  • Compose app detected - app/build.gradle.kts - libs.versions.toml present - ready for Stream wiring
  • Multi-module Gradle project detected - preserve existing module layout
  • XML / View-based app detected - keep current UI layer unless the user asks to migrate
  • No Gradle project found - user needs to create the app in Android Studio first

只读本地探测。用于检测用户所处环境是Android Studio/Gradle项目、Kotlin模块还是空目录。
bash
bash -c 'echo "=== GRADLE ROOT ==="; find . -maxdepth 2 \( -name "settings.gradle.kts" -o -name "settings.gradle" -o -name "build.gradle.kts" -o -name "build.gradle" \) -print 2>/dev/null; echo "=== APP MODULES ==="; find . -maxdepth 3 -type f \( -name "build.gradle.kts" -o -name "build.gradle" \) -path "*/*/build.gradle*" -print 2>/dev/null; echo "=== VERSION CATALOG ==="; find . -maxdepth 3 -name "libs.versions.toml" -print 2>/dev/null; echo "=== MANIFESTS ==="; find . -maxdepth 4 -name "AndroidManifest.xml" -print 2>/dev/null; echo "=== EMPTY ==="; test -z "$(ls -A 2>/dev/null)" && echo "EMPTY_CWD" || echo "NON_EMPTY"'
将结果保存在对话上下文中。除非用户切换目录或项目结构明显变化,否则不要重新运行该命令。
根据结果生成单行状态说明,例如:
  • 检测到Compose应用 - app/build.gradle.kts - 存在libs.versions.toml - 可接入Stream
  • 检测到多模块Gradle项目 - 保留现有模块布局
  • 检测到XML/View架构应用 - 除非用户要求迁移,否则保留当前UI层
  • 未找到Gradle项目 - 用户需先在Android Studio中创建应用

Module map

模块映射

TrackModule(s)
A - New app
builder.md
+
sdk.md
+ relevant reference files
B - Existing app
builder.md
+
sdk.md
+ relevant reference files
C - Reference lookup
sdk.md
+ relevant reference files
D - Bootstrap / setup
builder.md
+
sdk.md

处理路径模块
A - 新建应用
builder.md
+
sdk.md
+ 相关参考文件
B - 已有应用
builder.md
+
sdk.md
+ 相关参考文件
C - 参考查询
sdk.md
+ 相关参考文件
D - 初始化/配置
builder.md
+
sdk.md

Reference layout

参考文件结构

Shared Android/Kotlin patterns live in
sdk.md
.
Product and UI-layer specifics live under
references/
using a flat naming scheme that can grow with the full Stream Android surface:
  • Reference:
    references/<PRODUCT>-<UI_LAYER>.md
  • Blueprints:
    references/<PRODUCT>-<UI_LAYER>-blueprints.md
Current extracted modules:
  • Chat + Compose:
    references/CHAT-COMPOSE.md
    +
    references/CHAT-COMPOSE-blueprints.md
  • Chat + XML:
    references/CHAT-XML.md
    +
    references/CHAT-XML-blueprints.md
  • Video + Compose:
    references/VIDEO-COMPOSE.md
    +
    references/VIDEO-COMPOSE-blueprints.md
  • Feeds + Compose:
    references/FEEDS-COMPOSE.md
    +
    references/FEEDS-COMPOSE-blueprints.md
Feeds has no pre-built UI components.
FEEDS-COMPOSE.md
covers the headless data SDK (FeedsClient, FeedState, ActivityState);
FEEDS-COMPOSE-blueprints.md
is custom Composable scaffolding driven by those state flows. Load both for any Feeds request.
Future Android product coverage should stay in this naming family instead of creating more top-level skills.
If the requested product/UI layer file is not bundled yet, say so plainly, use
sdk.md
for the shared Android patterns, and only switch to live docs if the user asks.

通用Android/Kotlin模式存放在**
sdk.md
**中。
产品和UI层的具体内容存放在**
references/
**目录下,采用扁平化命名方案,可随Stream Android的完整功能扩展:
  • 参考文件:
    references/<PRODUCT>-<UI_LAYER>.md
  • 界面蓝图:
    references/<PRODUCT>-<UI_LAYER>-blueprints.md
当前已提取的模块:
  • Chat + Compose:
    references/CHAT-COMPOSE.md
    +
    references/CHAT-COMPOSE-blueprints.md
  • Chat + XML:
    references/CHAT-XML.md
    +
    references/CHAT-XML-blueprints.md
  • Video + Compose:
    references/VIDEO-COMPOSE.md
    +
    references/VIDEO-COMPOSE-blueprints.md
  • Feeds + Compose:
    references/FEEDS-COMPOSE.md
    +
    references/FEEDS-COMPOSE-blueprints.md
Feeds无预构建UI组件。
FEEDS-COMPOSE.md
涵盖无头数据SDK(FeedsClient、FeedState、ActivityState);
FEEDS-COMPOSE-blueprints.md
是基于这些状态流构建的自定义Composable脚手架。处理任何Feeds请求时需同时加载这两个文件。
未来的Android产品覆盖范围应保持该命名规则,而非创建更多顶级技能模块。
如果请求的产品/UI层组合文件未包含在内,需明确告知用户,使用
sdk.md
中的通用Android模式,仅当用户要求时再切换至在线文档。

Track A - New app

处理路径A - 新建应用

Full detail:
builder.md
- use the new-project path.
PhaseNameWhat you do
A1DetectAfter Step 0.5 (credentials), run Project signals. If there is no Android app yet, tell the user to create one in Android Studio first.
A2Choose laneConfirm product(s) and UI layer: Compose, XML/Views, or mixed.
A3Install + wireFollow
builder.md
+
sdk.md
, then load only the needed product references.
A4VerifyConfirm Gradle sync,
ChatClient
lifetime, auth, and first rendered screen.

详细说明:
builder.md
- 使用新项目流程
阶段名称操作内容
A1检测完成步骤0.5(凭证)后,执行项目信号检测。如果尚未创建Android应用,告知用户先在Android Studio中创建应用。
A2选择方向确认产品和UI层:Compose、XML/Views或混合架构。
A3安装与接入遵循
builder.md
+
sdk.md
,然后仅加载所需的产品参考文件。
A4验证确认Gradle同步、
ChatClient
生命周期、认证以及首个渲染界面正常。

Track B - Existing app

处理路径B - 已有应用

Full detail:
builder.md
- use the existing-project path.
PhaseNameWhat you do
B1DetectAfter Step 0.5 (credentials), run Project signals and inspect the existing app structure before editing.
B2PreserveKeep the current UI layer, dependency strategy (version catalog vs inline), and navigation setup unless the user asks for a migration.
B3IntegrateUse
sdk.md
for shared wiring, then load only the needed product reference files.
B4VerifyConfirm the requested Stream flow builds and renders inside the existing app.

详细说明:
builder.md
- 使用已有项目流程
阶段名称操作内容
B1检测完成步骤0.5(凭证)后,执行项目信号检测并在编辑前检查现有应用结构。
B2保留现有配置保留当前UI层、依赖策略(版本目录 vs 内联配置)和导航设置,除非用户要求迁移。
B3集成使用
sdk.md
进行通用接入,然后仅加载所需的产品参考文件。
B4验证确认请求的Stream流程在已有应用中可构建并正常渲染。

Track C - Reference lookup

处理路径C - 参考查询

Load only the relevant files for the requested product and UI layer.
  • Shared lifecycle / auth / state patterns ->
    sdk.md
  • Chat Compose setup and gotchas ->
    references/CHAT-COMPOSE.md
  • Chat Compose screen structure ->
    references/CHAT-COMPOSE-blueprints.md
  • Chat XML setup and gotchas ->
    references/CHAT-XML.md
  • Chat XML screen structure ->
    references/CHAT-XML-blueprints.md
  • Video Compose setup and gotchas ->
    references/VIDEO-COMPOSE.md
  • Video Compose call/screen structure ->
    references/VIDEO-COMPOSE-blueprints.md
  • Feeds Compose SDK patterns ->
    references/FEEDS-COMPOSE.md
  • Feeds Compose blueprints ->
    references/FEEDS-COMPOSE-blueprints.md
If the user asks for a product/UI-layer combo that is not bundled (e.g. Video XML, Feeds XML), say that clearly instead of inventing API details.

仅加载与请求产品和UI层相关的文件。
  • 通用生命周期/认证/状态模式 →
    sdk.md
  • Chat Compose配置与注意事项 →
    references/CHAT-COMPOSE.md
  • Chat Compose界面结构 →
    references/CHAT-COMPOSE-blueprints.md
  • Chat XML配置与注意事项 →
    references/CHAT-XML.md
  • Chat XML界面结构 →
    references/CHAT-XML-blueprints.md
  • Video Compose配置与注意事项 →
    references/VIDEO-COMPOSE.md
  • Video Compose通话/界面结构 →
    references/VIDEO-COMPOSE-blueprints.md
  • Feeds Compose SDK模式 →
    references/FEEDS-COMPOSE.md
  • Feeds Compose界面蓝图 →
    references/FEEDS-COMPOSE-blueprints.md
如果用户请求的产品/UI层组合未包含在内(例如Video XML、Feeds XML),需明确告知用户,而非编造API细节。

Track D - Bootstrap / setup

处理路径D - 初始化/配置

Use when the user wants the install and wiring path more than a feature build:
  • run Step 0.5 (credentials) first
  • detect the project shape
  • choose Compose vs XML ownership
  • install Stream packages with the project's existing dependency strategy (version catalog or inline)
  • wire auth and
    ChatClient
    lifetime via
    sdk.md
  • stop before product-specific UI if the user only asked for setup
适用于用户更关注安装和接入流程而非功能构建的场景:
  • 首先执行步骤0.5(凭证)
  • 检测项目结构
  • 选择Compose或XML架构
  • 使用项目现有依赖策略(版本目录或内联配置)安装Stream包
  • 通过
    sdk.md
    接入认证和
    ChatClient
    生命周期
  • 如果用户仅要求配置,在完成产品特定UI前停止操作