Agent skill

Android Architecture Reference

by Kototoro-app in Kototoro-app/Kototoro

Android 架构、依赖注入、数据层、测试规范官方参考。涵盖 UDF/MVI 模式、Hilt/Dagger、Room、Paging、 DataStore、WorkManager、ViewModel、测试策略等。安卓开发第一要义:参考官方文档和案例!

Apache-2.0Auto-check passedMobile

Install Android Architecture Reference

skills CLI
$ npx skills add Kototoro-app/Kototoro --skill android-architecture-reference -a claude-code

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

GitHub CLI
$ gh skill install Kototoro-app/Kototoro android-architecture-reference --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/Kototoro-app/Kototoro.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.pi/skills/android-architecture-reference .claude/skills/android-architecture-reference && 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
android-architecture-reference
GitHub stars
605
Token cost
~1.7k tokens
SKILL.md length
170 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
Apache-2.0

At a glance

Android 架构、依赖注入、数据层、测试规范官方参考。涵盖 UDF/MVI 模式、Hilt/Dagger、Room、Paging、 DataStore、WorkManager、ViewModel、测试策略等。安卓开发第一要义:参考官方文档和案例!

  • Mobile work in your project
  • SKILL.md covers 🏗️ 架构模式, 💉 依赖注入:Hilt, 💾 数据层 and ⚡ WorkManager, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Android Architecture Reference is an agent skill from Kototoro-app/Kototoro. Android 架构、依赖注入、数据层、测试规范官方参考。涵盖 UDF/MVI 模式、Hilt/Dagger、Room、Paging、 DataStore、WorkManager、ViewModel、测试策略等。安卓开发第一要义:参考官方文档和案例! Triggers: "Android 架构", "MVVM", "MVI", "UDF", "Hilt", "Dagger", "Room", "Paging", "ViewModel", "WorkManager", "DataStore", "测试", "架构设计", "DI", "依赖注入"

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Mobile. It works with Android and Gradle. The repository describes itself as: Manga, Novel, and Video reader for Android. The licence is Apache-2.0.

When your agent uses it

  • Mobile work in your project

Example prompts

  • “Android 架构”
  • “Dagger”
  • “Paging”
  • “/android-architecture-reference”

What it can do on your machine

Read from SKILL.md and the folder at commit 3df24c7. 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 kotlin).

    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):

    • github.com

    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

Android Architecture Reference loads about 1.7k tokens when it runs. Until then it costs about 77 tokens; SKILL.md has 170 words of instructions outside code blocks.

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

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 Kototoro-app/Kototoro at commit 3df24c7, republished under its Apache-2.0 licence (© Kototoro-app). 170 words, ~1,678 tokens.

Download SKILL.mdSave it as .claude/skills/android-architecture-reference/SKILL.md (or your agent's skills folder).
name
android-architecture-reference
description
Android 架构、依赖注入、数据层、测试规范官方参考。涵盖 UDF/MVI 模式、Hilt/Dagger、Room、Paging、 DataStore、WorkManager、ViewModel、测试策略等。安卓开发第一要义:参考官方文档和案例! Triggers: "Android 架构", "MVVM", "MVI", "UDF", "Hilt", "Dagger", "Room", "Paging", "ViewModel", "WorkManager", "DataStore", "测试", "架构设计", "DI", "依赖注入"

Android 架构与数据层官方参考

安卓开发第一要义:参考官方文档和案例!


🏗️ 架构模式

主仓库:architecture-samples ⭐45.7k

官方推荐的架构演进路径:

传统 MVP/MVVM → 推荐 UDF (Unidirectional Data Flow)

当前推荐模式(main 分支):

  • UI Layer:Jetpack Compose + ViewModel
  • Domain Layer:UseCase(可选)
  • Data Layer:Repository + DataSource + Room

核心原则:

  • 数据向下流动(ViewModel → UI State → Compose)
  • 事件向上流动(User Action → ViewModel → Repository)
  • 状态通过 StateFlow 暴露
  • UI 只负责渲染,不包含业务逻辑
kotlin
// 推荐模式
@HiltViewModel
class TaskViewModel @Inject constructor(
    private val taskRepository: TaskRepository,
) : ViewModel() {
    private val _uiState = MutableStateFlow(TaskUiState())
    val uiState: StateFlow<TaskUiState> = _uiState.asStateFlow()
    
    fun onAction(action: TaskAction) { /* 处理用户操作 */ }
}

生产级参考:nowinandroid ⭐21.4k

💡 这是 Kototoro 最相关的单一参考仓库 — 一个仓库覆盖 Compose、Room、Hilt、Navigation、Coroutines、WorkManager、Paging、DataStore 八项核心技术栈。

模块化架构参考:

app/
├── :core:data           → 数据层(Room DAO、Entity、Repository、离线优先)
├── :core:datastore      → DataStore 偏好存储
├── :core:domain         → 领域层(UseCase)
├── :core:model          → 数据模型
├── :core:network        → 网络层(OkHttp + Retrofit + kotlinx-serialization)
├── :core:ui             → UI 基础组件(主题、导航、通用 Compose)
├── :core:data-test     → 测试数据
├── :core:testing       → 测试工具
├── :sync:work           → WorkManager 后台同步
├── :feature:for_you    → 推荐页 Feature
├── :feature:bookmarks  → 书签 Feature
├── :feature:topic      → 话题 Feature
├── :feature:settings   → 设置 Feature
└── :benchmark           → Macrobenchmark 性能测试

构建系统:

⚠️ Kototoro 差异:nowinandroid 使用 Kotlin DSL (.kts),而 Kototoro 的 app/build.gradle 使用 Groovy DSL —— 学习架构和代码模式,但不要直接复制构建脚本。

与本项目的技术栈对应:

NIA 模块Kototoro 对应学习重点
:core:datamanga 数据层Room DAO 模式、Entity 设计、Flow 查询
:core:networkOkHttp 网络层拦截器、缓存策略、离线处理
:core:uiCompose 基础组件Material3 主题、导航基础设施
:core:datastore用户偏好阅读设置、主题选择
:sync:work章节下载/同步Worker 约束、唯一定期任务
:feature:*各 Feature 模块页面级 Composition、ViewModel
:benchmark(建议添加)启动性能、滚动性能

💉 依赖注入:Hilt

官方 Hilt 参考在 architecture-samples 和 nowinandroid 中。

关键模式:

kotlin
// 1. Application 级模块
@Module
@InstallIn(SingletonComponent::class)
object DataModule {
    @Provides @Singleton
    fun provideDatabase(@ApplicationContext ctx: Context): AppDatabase =
        Room.databaseBuilder(ctx, AppDatabase::class.java, "app.db").build()
}

// 2. ViewModel 注入
@HiltViewModel
class FeatureViewModel @Inject constructor(
    private val repository: FeatureRepository,
) : ViewModel()

// 3. Compose 集成
@Composable
fun FeatureScreen(
    viewModel: FeatureViewModel = hiltViewModel(),
)

💾 数据层

Room 数据库

参考:codelab-android-room-with-a-view ⭐768

kotlin
@Entity(tableName = "items")
data class Item(
    @PrimaryKey val id: String,
    val title: String,
    val timestamp: Long,
)

@Dao
interface ItemDao {
    @Query("SELECT * FROM items ORDER BY timestamp DESC LIMIT :limit")
    fun getRecent(limit: Int = 20): Flow<List<Item>>
}

@Database(entities = [Item::class], version = 1)
abstract class AppDatabase : RoomDatabase()
Paging 分页

参考:codelab-android-paging ⭐512

kotlin
// Room 分页
@Query("SELECT * FROM items ORDER BY timestamp DESC")
fun pagingSource(): PagingSource<Int, Item>

// Repository 层
fun getItems(): Flow<PagingData<Item>> = Pager(
    config = PagingConfig(pageSize = 20),
    pagingSourceFactory = { dao.pagingSource() }
).flow
DataStore

参考:storage-samples ⭐1.7k

kotlin
// Preferences DataStore
val Context.dataStore by preferencesDataStore(name = "settings")

⚡ WorkManager

参考:codelab-android-workmanager ⭐559

kotlin
// 定义 Worker
@HiltWorker
class SyncWorker @AssistedInject constructor(
    @Assisted ctx: Context,
    @Assisted params: WorkerParameters,
    private val repository: SyncRepository,
) : CoroutineWorker(ctx, params) {
    override suspend fun doWork(): Result {
        return try {
            repository.sync()
            Result.success()
        } catch (e: Exception) {
            Result.retry()
        }
    }
}

// 调度
val request = PeriodicWorkRequestBuilder<SyncWorker>(15, TimeUnit.MINUTES)
    .setConstraints(Constraints(requiredNetworkType = NetworkType.CONNECTED))
    .build()
WorkManager.getInstance(context).enqueue(request)

🧪 测试策略

参考:testing-samples ⭐9.3k

三层测试金字塔
         /\
        /UI\        10% - Compose UI 测试(少量端到端验证)
       /----\
      / 集成 \      20% - Hilt + Room 集成测试
     /--------\
    /  单元测试  \   70% - Repository / ViewModel 单元测试
   /------------\
本项目测试工具链
层级工具参考
单元测试JUnit5 + Kotest + MockKtesting-samples
集成测试Hilt Testing + Room In-Memorynowinandroid
UI 测试Compose Testing + Espressocompose-samples
Mock WebMockWebServer (OkHttp)本项目已有
快照测试Roborazzi / Paparazzinowinandroid
ViewModel 单元测试示例
kotlin
@Test
fun `when data loaded, uiState shows items`() = runTest {
    val repo = mockk<FeatureRepository> { coEvery { getItems() } returns flowOf(testItems) }
    val viewModel = FeatureViewModel(repo)
    viewModel.uiState.test {
        assertEquals(expectItemCount, awaitItem().items.size)
    }
}

🚀 本项目架构决策参考

当遇到架构决策时:

1. architecture-samples   → 看推荐模式(UDF + StateFlow)
2. nowinandroid           → 看模块化划分、Gradle 配置
3. sunflower              → 看 Room + Paging + WorkManager 组合用法
4. testing-samples        → 看测试如何组织

关键原则:

  • 不盲目跟风第三方方案,以官方为准
  • 架构选择要匹配项目规模(Kototoro 不需要过度工程化)
  • 每个决策都要能在官方示例中找到依据

© Kototoro-app, Apache-2.0. 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 .pi/skills/android-architecture-reference of Kototoro-app/Kototoro.

Open the folder on GitHubat commit 3df24c7

Compare with similar skills

Android Architecture Reference 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.

Android Architecture Reference compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Android Architecture Reference this skillKototoro-app/Kototoro605—~1.7kAutomated safety check: PassApache-2.0
Android API Diffgkd-kit/gkd43k—~796Automated safety check: PassGPL-3.0
Android Developmentdpconde/claude-android-skill336—~1.7kAutomated safety check: PassMIT
Run Jetpack Android Appwordpress-mobile/WordPress-Android3.2k—~886Automated safety check: PassGPL-2.0
Orca Android Emulator Controlstablyai/orca87k—~558Automated safety check: PassApache-2.0
Claude Android NinjaDrjacky/claude-android-ninja124—~5.2kAutomated safety check: PassApache-2.0

Similar skills

  • Android API Diff

    gkd-kit/gkd

    Looks up Android framework Java and AIDL APIs across versions with the android-api-diff CLI: signatures, availability, source files and hidden-API access code.

    43k GitHub stars~796 tokensUpdated 2 days ago
    MobileAuto-check passed
  • Android Development

    dpconde/claude-android-skill

    Create production-quality Android applications following Google's official architecture guidance and NowInAndroid best practices.

    336 GitHub stars~1.7k tokensUpdated 10 mo ago
    MobileAuto-check passed
  • Run Jetpack Android App

    wordpress-mobile/WordPress-Android

    Builds the Jetpack debug app with Gradle and installs it on a connected Android device or an emulator started from an available AVD.

    3.2k GitHub stars~886 tokensUpdated yesterday
    MobileAuto-check passed
  • Android device and emulator control from inside Orca over adb, with the live device view in Orca's emulator pane. Use when driving an adb-connected emulator…

    87k GitHub stars~558 tokensUpdated yesterday
    MobileAuto-check passed
  • Claude Android Ninja

    Drjacky/claude-android-ninja

    Build and migrate Android apps with Kotlin, Jetpack Compose, MVVM, Hilt, Room 3 (KSP, SQLiteDriver, Flow/suspend DAOs), Navigation3, and multi-module Gradle.

    124 GitHub stars~5.2k tokensUpdated 9 days ago
    MobileAuto-check passed
  • Expo Brownfield Integration

    mweinbach/agent-coworker

    Helps add Expo and React Native to an existing native iOS or Android app, and choose between a prebuilt AAR or XCFramework and a fully integrated build.

    156 GitHub starsUsed in 2 repos~900 tokens
    MobileAuto-check: notes

More from Kototoro-app/Kototoro

All 10 skills in this repo
  • Android Compose Reference

    Kototoro-app/Kototoro

    Jetpack Compose 官方示例与最佳实践参考。涵盖 Compose UI 实现、动画、手势、导航、Material3 主题、 性能优化、测试等所有方面。安卓开发第一要义:参考官方文档和案例!

    605 GitHub stars~1.3k tokensUpdated 2 days ago
    Auto-check passed
  • Android Official Samples

    Kototoro-app/Kototoro

    Android 官方示例代码库完整索引。涵盖架构、Compose UI、性能、测试、存储、网络、相机、媒体、安全等所有领域。

    605 GitHub stars~3.6k tokensUpdated 2 days ago
    Auto-check passed
  • Compose Idle Redraw

    Kototoro-app/Kototoro

    诊断 Kototoro 主壳"空闲永不定居"式 Compose 自持重绘循环(idle 帧数不为 0). An agent skill from Kototoro-app/Kototoro.

    605 GitHub stars~1.9k tokensUpdated 2 days ago
    Auto-check passed
  • Kototoro Browse Source Scroll

    Kototoro-app/Kototoro

    Diagnose and fix Kototoro Browse/Explore page content source scrolling jank when many sources exist.

    605 GitHub stars~793 tokensUpdated 2 days ago
    Auto-check passed
  • Diagnose and fix Kototoro Android issues where returning from reader or video player to details causes flicker, cover reload, panorama reload, progress reset, status bar jump, Compose subtree…

    605 GitHub stars~946 tokensUpdated 2 days ago
    Auto-check passed
  • Kototoro Main Loading Stability

    Kototoro-app/Kototoro

    Diagnose and fix Kototoro main screen loading flicker, blank flashes, chrome jumps, transient empty states, and route switching flashes.

    605 GitHub stars~904 tokensUpdated 2 days ago
    Auto-check passed

Works with

Categories

Questions about Android Architecture Reference

What does Android Architecture Reference do?

Android 架构、依赖注入、数据层、测试规范官方参考。涵盖 UDF/MVI 模式、Hilt/Dagger、Room、Paging、 DataStore、WorkManager、ViewModel、测试策略等。安卓开发第一要义:参考官方文档和案例!. Android Architecture Reference is an agent skill from Kototoro-app/Kototoro.

When should I use Android Architecture Reference?

Android Architecture Reference fits situations like: mobile work in your project.

How do I install Android Architecture Reference in Claude Code?

Run `npx skills add Kototoro-app/Kototoro --skill android-architecture-reference -a claude-code`. Or copy the skill folder (.pi/skills/android-architecture-reference in Kototoro-app/Kototoro) into .claude/skills/android-architecture-reference in your project. Claude Code loads it when a task matches its description.

How do I install Android Architecture Reference in Codex?

Run `npx skills add Kototoro-app/Kototoro --skill android-architecture-reference -a codex`. Or copy the skill folder (.pi/skills/android-architecture-reference in Kototoro-app/Kototoro) into .agents/skills/android-architecture-reference in your project. Codex loads it when a task matches its description.

Can I use Android Architecture Reference 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 Kototoro-app/Kototoro --skill android-architecture-reference -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/android-architecture-reference, .gemini/skills/android-architecture-reference, .github/skills/android-architecture-reference and .opencode/skills/android-architecture-reference in your project.

What does Android Architecture Reference need to run?

SKILL.md names no scripts, command-line tools or credentials: Android Architecture Reference is instructions for the agent only.

Does Android Architecture Reference access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Android Architecture Reference 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 Android Architecture Reference use?

Android Architecture Reference is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Android Architecture Reference use?

About 1.7k tokens (SKILL.md is roughly 6.7k 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 Android Architecture Reference?

Skills that share tags, products or a category with Android Architecture Reference: Android API Diff (gkd-kit/gkd, 43k stars), Android Development (dpconde/claude-android-skill, 336 stars), Run Jetpack Android App (wordpress-mobile/WordPress-Android, 3.2k stars) and Orca Android Emulator Control (stablyai/orca, 87k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Android Architecture Reference?

Kototoro-app (a GitHub organization) maintains it in Kototoro-app/Kototoro, which has 605 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 7, 2026.

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