stream-android
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseStream Android - skill router + execution flow
Stream Android - 技能路由与执行流程
Rules: Read once per session - every non-negotiable rule is stated there, nowhere else.
RULES.mdThis 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 input | Track |
|---|---|
Explicit product/framework token: | C - Reference lookup |
| Words "docs" or "documentation" around Stream Android/Compose work | C - 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 product | A - 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 request | D - Bootstrap / setup |
Bare | List the tracks briefly and wait |
| 用户输入中的信号 | 处理路径 |
|---|---|
明确的产品/框架标识: | 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 - 初始化/配置 |
仅输入 | 简要列出各处理路径并等待用户进一步说明 |
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 and
builder.md. Do not probe the project before credentials.sdk.md - 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 to:
credentials.md- 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 before continuing.
credentials.md顺序: 意图分类 → 步骤0.5(本步骤) → 项目信号探测 → 对应路径工作。即使下方路径表格中列出“检测”为第一阶段,也要在运行项目信号shell命令之前执行本步骤。每个会话针对处理路径A、B、D执行一次。处理路径C跳过本步骤。
遵循完成以下操作:
credentials.md- 从控制台获取Stream API密钥(或向用户索要)
- 通过Stream CLI生成用户令牌(或接受用户提供的令牌)
- 执行任何产品特定的配置(Chat:可选初始化频道;Feeds:确认Feed分组;Video:无操作——通话为临时会话)
在所有代码片段中使用获取到的API密钥和令牌——切勿使用占位符字符串。如果处理路径A/B/D的任务进入代码工作阶段但尚未收集凭证,需先回到完成操作后再继续。
credentials.mdProject 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 wiringMulti-module Gradle project detected - preserve existing module layoutXML / View-based app detected - keep current UI layer unless the user asks to migrateNo 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
模块映射
| Track | Module(s) |
|---|---|
| A - New app | |
| B - Existing app | |
| C - Reference lookup | |
| D - Bootstrap / setup | |
| 处理路径 | 模块 |
|---|---|
| A - 新建应用 | |
| B - 已有应用 | |
| C - 参考查询 | |
| D - 初始化/配置 | |
Reference layout
参考文件结构
Shared Android/Kotlin patterns live in .
sdk.mdProduct and UI-layer specifics live under using a flat naming scheme that can grow with the full Stream Android surface:
references/- Reference:
references/<PRODUCT>-<UI_LAYER>.md - Blueprints:
references/<PRODUCT>-<UI_LAYER>-blueprints.md
Current extracted modules:
- Chat + Compose: +
references/CHAT-COMPOSE.mdreferences/CHAT-COMPOSE-blueprints.md - Chat + XML: +
references/CHAT-XML.mdreferences/CHAT-XML-blueprints.md - Video + Compose: +
references/VIDEO-COMPOSE.mdreferences/VIDEO-COMPOSE-blueprints.md - Feeds + Compose: +
references/FEEDS-COMPOSE.mdreferences/FEEDS-COMPOSE-blueprints.md
Feeds has no pre-built UI components.covers the headless data SDK (FeedsClient, FeedState, ActivityState);FEEDS-COMPOSE.mdis custom Composable scaffolding driven by those state flows. Load both for any Feeds request.FEEDS-COMPOSE-blueprints.md
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 for the shared Android patterns, and only switch to live docs if the user asks.
sdk.md通用Android/Kotlin模式存放在****中。
sdk.md产品和UI层的具体内容存放在****目录下,采用扁平化命名方案,可随Stream Android的完整功能扩展:
references/- 参考文件:
references/<PRODUCT>-<UI_LAYER>.md - 界面蓝图:
references/<PRODUCT>-<UI_LAYER>-blueprints.md
当前已提取的模块:
- Chat + Compose: +
references/CHAT-COMPOSE.mdreferences/CHAT-COMPOSE-blueprints.md - Chat + XML: +
references/CHAT-XML.mdreferences/CHAT-XML-blueprints.md - Video + Compose: +
references/VIDEO-COMPOSE.mdreferences/VIDEO-COMPOSE-blueprints.md - Feeds + Compose: +
references/FEEDS-COMPOSE.mdreferences/FEEDS-COMPOSE-blueprints.md
Feeds无预构建UI组件。涵盖无头数据SDK(FeedsClient、FeedState、ActivityState);FEEDS-COMPOSE.md是基于这些状态流构建的自定义Composable脚手架。处理任何Feeds请求时需同时加载这两个文件。FEEDS-COMPOSE-blueprints.md
未来的Android产品覆盖范围应保持该命名规则,而非创建更多顶级技能模块。
如果请求的产品/UI层组合文件未包含在内,需明确告知用户,使用中的通用Android模式,仅当用户要求时再切换至在线文档。
sdk.mdTrack A - New app
处理路径A - 新建应用
Full detail: - use the new-project path.
builder.md| Phase | Name | What you do |
|---|---|---|
| A1 | Detect | After Step 0.5 (credentials), run Project signals. If there is no Android app yet, tell the user to create one in Android Studio first. |
| A2 | Choose lane | Confirm product(s) and UI layer: Compose, XML/Views, or mixed. |
| A3 | Install + wire | Follow |
| A4 | Verify | Confirm Gradle sync, |
详细说明: - 使用新项目流程。
builder.md| 阶段 | 名称 | 操作内容 |
|---|---|---|
| A1 | 检测 | 完成步骤0.5(凭证)后,执行项目信号检测。如果尚未创建Android应用,告知用户先在Android Studio中创建应用。 |
| A2 | 选择方向 | 确认产品和UI层:Compose、XML/Views或混合架构。 |
| A3 | 安装与接入 | 遵循 |
| A4 | 验证 | 确认Gradle同步、 |
Track B - Existing app
处理路径B - 已有应用
Full detail: - use the existing-project path.
builder.md| Phase | Name | What you do |
|---|---|---|
| B1 | Detect | After Step 0.5 (credentials), run Project signals and inspect the existing app structure before editing. |
| B2 | Preserve | Keep the current UI layer, dependency strategy (version catalog vs inline), and navigation setup unless the user asks for a migration. |
| B3 | Integrate | Use |
| B4 | Verify | Confirm the requested Stream flow builds and renders inside the existing app. |
详细说明: - 使用已有项目流程。
builder.md| 阶段 | 名称 | 操作内容 |
|---|---|---|
| B1 | 检测 | 完成步骤0.5(凭证)后,执行项目信号检测并在编辑前检查现有应用结构。 |
| B2 | 保留现有配置 | 保留当前UI层、依赖策略(版本目录 vs 内联配置)和导航设置,除非用户要求迁移。 |
| B3 | 集成 | 使用 |
| 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 lifetime via
ChatClientsdk.md - stop before product-specific UI if the user only asked for setup
适用于用户更关注安装和接入流程而非功能构建的场景:
- 首先执行步骤0.5(凭证)
- 检测项目结构
- 选择Compose或XML架构
- 使用项目现有依赖策略(版本目录或内联配置)安装Stream包
- 通过接入认证和
sdk.md生命周期ChatClient - 如果用户仅要求配置,在完成产品特定UI前停止操作